Matteo Scandolo | 60b640f | 2017-08-08 13:05:22 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Zack Williams | ce63eb0 | 2017-02-28 10:46:22 -0700 | [diff] [blame] | 17 | --- |
| 18 | # ansible/genconfig.yml |
| 19 | # Generate configuration files |
| 20 | |
| 21 | - name: Load pod and scenario config files |
| 22 | hosts: localhost |
| 23 | connection: local |
| 24 | gather_facts: False |
| 25 | tasks: |
| 26 | |
| 27 | - name: Set pod_config_path fact |
| 28 | set_fact: |
| 29 | pod_config_path: "{{ cord_podconfig | realpath }}" |
| 30 | |
| 31 | - name: Load pod config |
| 32 | include_vars: "{{ pod_config_path }}" |
| 33 | |
| 34 | - name: Set scenario_config_path fact |
| 35 | set_fact: |
| 36 | scenario_config_path: "{{ (scenarios_dir ~ '/' ~ cord_scenario ~ '/config.yml') | realpath }}" |
| 37 | |
| 38 | - name: Load scenario config |
| 39 | include_vars: "{{ scenario_config_path }}" |
| 40 | |
| 41 | - name: Reload pod config to take precedence |
| 42 | include_vars: "{{ pod_config_path }}" |
| 43 | |
| 44 | - name: Load pod and scenario configs into facts |
| 45 | set_fact: |
| 46 | pod_config: "{{ lookup('file', pod_config_path) | from_yaml }}" |
| 47 | scenario_config: "{{ lookup('file', scenario_config_path) | from_yaml }}" |
| 48 | |
| 49 | - name: Combine pod and scenario config into master config |
| 50 | set_fact: |
| 51 | master_config: "{{ scenario_config | combine(pod_config) }}" |
| 52 | |
| 53 | - name: Print vars |
| 54 | debug: |
| 55 | var: master_config |
| 56 | |
| 57 | - name: Generate config files |
| 58 | hosts: localhost |
| 59 | connection: local |
| 60 | gather_facts: False |
| 61 | roles: |
| 62 | - genconfig |
| 63 | |