Scott Baker | 7a32759 | 2016-06-20 17:34:06 -0700 | [diff] [blame] | 1 | --- |
| 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 %} |
| 21 | {% if early_rest_configs %} |
| 22 | early_rest_configs: |
| 23 | {% for early_rest_config in early_rest_configs %} |
| 24 | - endpoint: {{ early_rest_config.endpoint }} |
| 25 | body: "{{ '{{' }} lookup('file', '{{ files_dir }}/{{ early_rest_config.fn }}') {{ '}}' }}" |
| 26 | {% endfor %} |
| 27 | {% endif %} |
| 28 | rest_hostname: {{ rest_hostname }} |
| 29 | rest_port: {{ rest_port }} |
| 30 | |
| 31 | tasks: |
| 32 | {% if dependencies %} |
| 33 | - name: Add dependencies to ONOS |
| 34 | uri: |
| 35 | url: http://{{ '{{' }} rest_hostname {{ '}}' }}:{{ '{{' }} rest_port {{ '}}' }}/onos/v1/applications/{{ '{{' }} item {{ '}}' }}/active |
| 36 | method: POST |
| 37 | user: karaf |
| 38 | password: karaf |
| 39 | with_items: |
| 40 | {% for dependency in dependencies %} |
| 41 | - {{ dependency }} |
| 42 | {% endfor %} |
| 43 | {% endif %} |
| 44 | |
| 45 | {% if rest_configs %} |
| 46 | # Do this after services have been activated, or it will cause an exception. |
| 47 | # vOLT will re-read its net config; vbng may not. |
| 48 | - name: Add ONOS configuration values |
| 49 | uri: |
| 50 | url: http://{{ '{{' }} rest_hostname {{ '}}' }}:{{ '{{' }} rest_port {{ '}}' }}/{{ '{{' }} item.endpoint {{ '}}' }} #http://localhost:8181/onos/v1/network/configuration/ |
| 51 | body: "{{ '{{' }} item.body {{ '}}' }}" |
| 52 | body_format: raw |
| 53 | method: POST |
| 54 | user: karaf |
| 55 | password: karaf |
| 56 | with_items: "rest_configs" |
| 57 | {% endif %} |