--- # Copyright 2019, Rackspace US, Inc. # # 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. # Dynamic construction of the system fabric for all hosts within the agents group skydive_fabric: |- {% set fabric = [] %} {% set nodes = [] %} {% for node in groups['skydive_analyzers'] %} {% if node in ansible_play_hosts %} {% set agents_loop = loop %} {% for interface in (hostvars[node]['ansible_interfaces'] | map('replace', '-','_') | list) %} {% if interface != 'lo' %} {% set ansible_interface_name = "ansible_" ~ interface %} {% set port_entry = "TOR[Name=TOR] -> TOR_PORT" ~ agents_loop.index ~ "[Name=port" ~ agents_loop.index ~ "]" %} {% if hostvars[node][ansible_interface_name] is defined %} {% set interface_data = hostvars[node][ansible_interface_name] %} {% if interface_data['mtu'] is defined %} {% set port_entry = "TOR[Name=TOR] -> [color=red] TOR_PORT" ~ agents_loop.index ~ "[Name=port" ~ agents_loop.index ~ ",MTU=" ~ interface_data['mtu'] ~ "]" %} {% endif %} {% endif %} {% set _ = fabric.append((port_entry)) %} {% if not interface in nodes %} {% set host_entry = "TOR_PORT" ~ agents_loop.index ~ "-> *[Type=host,Name=" ~ hostvars[node]['ansible_hostname'] ~ "/" ~ interface %} {% set _ = fabric.append((host_entry)) %} {% endif %} {% set _ = nodes.append(interface) %} {% endif %} {% endfor %} {% endif %} {% endfor %} {{ fabric }} # Inject the required basic authentication information _skydive_basic_auth_users: "{{ skydive_username }}": "{{ skydive_password }}" skydive_ssl_cnf: "/var/lib/skydive/ssl/skydive-openssl.cnf" skydive_ssl_key: "/var/lib/skydive/ssl/skydive.key" skydive_ssl_csr: "/var/lib/skydive/ssl/skydive.csr" skydive_ssl_cert: "/var/lib/skydive/ssl/skydive-{{ inventory_hostname | replace('_', '-') | replace(' ', '-') }}.crt" skydive_ssl_signed_subject: "/C=XX/L=OpenStack-Cloud/O=OpenStack/OU=IT/CN={{ ((ansible_fqdn | length) > 0) | ternary(ansible_fqdn, ansible_hostname) }}" skydive_ssl_ca_key: "/var/lib/skydive/ssl/skydive-ca.key" skydive_ssl_ca_cert: "/var/lib/skydive/ssl/skydive-ca.crt" skydive_ssl_ca_subject: "/C=XX/L=OpenStack-Cloud/O=OpenStack" skydive_ssl_bundle: - path: "{{ skydive_ssl_csr }}" - path: "{{ skydive_ssl_cert }}" - path: "{{ skydive_ssl_key }}" - path: "{{ skydive_ssl_ca_cert }}"