Configure `caas_oam` as flannel interface
[ta/caas-danm.git] / ansible / roles / flannel / defaults / main.yaml
diff --git a/ansible/roles/flannel/defaults/main.yaml b/ansible/roles/flannel/defaults/main.yaml
new file mode 100644 (file)
index 0000000..61a737d
--- /dev/null
@@ -0,0 +1,26 @@
+---
+# Copyright 2019 Nokia
+#
+# 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.
+
+attached_network_profile: "{{ hosts[ansible_hostname]['network_profiles'][0] }}"
+attached_network_profile_data: "{{ hostvars[ansible_hostname]['network_profiles'][attached_network_profile] }}"
+interface_net_mapping: "{{ attached_network_profile_data['interface_net_mapping'] }}"
+
+caas_oam_network: |
+  {% set bound_host_networks = [] %}
+  {% for host_networks in (interface_net_mapping.keys() | map('extract', interface_net_mapping)| list) %}
+      {% set _ = bound_host_networks.extend(host_networks) %}
+  {% endfor %}
+  {% if 'caas_oam' not in bound_host_networks %}infra_internal{% else %}caas_oam{% endif %}
+interface_query: "[*].networking.{{ caas_oam_network | trim }}.interface"