blob: 7e18bf02e1042f4fc46d162e8cded0721625caa0 [file] [log] [blame]
Scott Baker7a327592016-06-20 17:34:06 -07001---
2- hosts: 127.0.0.1
3 connection: local
4 vars:
5 appname: {{ appname }}
6 dependencies: {{ dependencies }}
7{% if component_configs %}
8 component_configs:
9{% for component_config in component_configs %}
10 - component: {{ component_config.component }}
11 config_params: {{ component_config.config_params }}
12{% endfor %}
13{% endif %}
14{% if rest_configs %}
15 rest_configs:
16{% for rest_config in rest_configs %}
17 - endpoint: {{ rest_config.endpoint }}
18 body: "{{ '{{' }} lookup('file', '{{ files_dir }}/{{ rest_config.fn }}') {{ '}}' }}"
19{% endfor %}
20{% endif %}
Scott Baker7a327592016-06-20 17:34:06 -070021 rest_hostname: {{ rest_hostname }}
22 rest_port: {{ rest_port }}
23
24 tasks:
Andy Bavier4a503b12016-06-21 11:41:29 -040025{% if install_dependencies %}
26 # Couldn't figure out how to get uri module to accept JSON in a string
27 - name: Install ONOS apps by URL
28 command: curl -sS --user onos:rocks -X POST -HContent-Type:application/json -d '{{ '{{' }} item.body | to_json {{ '}}' }}' http://{{ rest_hostname }}:{{ rest_port }}/{{ '{{' }} item.endpoint {{ '}}' }}
29 with_items:
30 {% for install_dependency in install_dependencies %}
31 - endpoint: "onos/v1/applications"
32 body:
33 url: "{{ install_dependency }}"
34 activate: "true"
35 {% endfor %}
36{% endif %}
37
Scott Baker7a327592016-06-20 17:34:06 -070038{% if dependencies %}
39 - name: Add dependencies to ONOS
40 uri:
Andy Bavier4a503b12016-06-21 11:41:29 -040041 url: http://{{ rest_hostname }}:{{ rest_port }}/onos/v1/applications/{{ '{{' }} item {{ '}}' }}/active
Scott Baker7a327592016-06-20 17:34:06 -070042 method: POST
43 user: karaf
44 password: karaf
45 with_items:
46 {% for dependency in dependencies %}
47 - {{ dependency }}
48 {% endfor %}
49{% endif %}
50
51{% if rest_configs %}
52# Do this after services have been activated, or it will cause an exception.
53# vOLT will re-read its net config; vbng may not.
54 - name: Add ONOS configuration values
55 uri:
Andy Bavier4a503b12016-06-21 11:41:29 -040056 url: http://{{ rest_hostname }}:{{ rest_port }}/{{ '{{' }} item.endpoint {{ '}}' }} #http://localhost:8181/onos/v1/network/configuration/
Scott Baker7a327592016-06-20 17:34:06 -070057 body: "{{ '{{' }} item.body {{ '}}' }}"
Zack Williamsd60c7732016-06-27 13:15:21 -070058 body_format: json
Scott Baker7a327592016-06-20 17:34:06 -070059 method: POST
60 user: karaf
61 password: karaf
62 with_items: "rest_configs"
63{% endif %}