blob: 03b126b1d806053938649fde6cd2b2c3d6e0c527 [file] [log] [blame]
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
# ansible/genconfig.yml
# Generate configuration files
- name: Load pod and scenario config files
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: Set pod_config_path fact
set_fact:
pod_config_path: "{{ cord_podconfig | realpath }}"
- name: Load pod config
include_vars: "{{ pod_config_path }}"
- name: Set scenario_config_path fact
set_fact:
scenario_config_path: "{{ (scenarios_dir ~ '/' ~ cord_scenario ~ '/config.yml') | realpath }}"
- name: Load scenario config
include_vars: "{{ scenario_config_path }}"
- name: Reload pod config to take precedence
include_vars: "{{ pod_config_path }}"
- name: Load pod and scenario configs into facts
set_fact:
pod_config: "{{ lookup('file', pod_config_path) | from_yaml }}"
scenario_config: "{{ lookup('file', scenario_config_path) | from_yaml }}"
- name: Combine pod and scenario config into master config
set_fact:
master_config: "{{ scenario_config | combine(pod_config) }}"
- name: Print vars
debug:
var: master_config
- name: Generate config files
hosts: localhost
connection: local
gather_facts: False
roles:
- genconfig