Merge "Document for Euphrates test case results"
[yardstick.git] / ansible / roles / infra_deploy_openstack / templates / multinode.j2
1 {% set control_dict = {} %}
2 {% set compute_dict = {} %}
3 {% for host in groups['ostack'] %}
4 {% if  hostvars[host].node_type is defined and hostvars[host].node_type == 'controller' %}
5 {% set control_dict = control_dict.update({hostvars[host].ansible_host: hostvars[host].ansible_default_ipv4.interface}) %}
6 {% endif %}
7 {% endfor %}
8 {% for host in groups['ostack'] %}
9 {% if  hostvars[host].node_type is defined and hostvars[host].node_type == 'compute' %}
10 {% for iface in hostvars[host].ansible_interfaces %}
11 {%- if ((hostvars[host]['ansible_' + iface.replace('-', '_')].ipv4 is defined) and
12         (hostvars[host]['ansible_' + iface.replace('-', '_')].ipv4.address is defined) and
13         (hostvars[host]['ansible_' + iface.replace('-', '_')].ipv4.address == hostvars[host].secondary_ip)) -%}
14 {% set compute_dict = compute_dict.update({hostvars[host].ansible_host: iface}) %}
15 {% endif %}
16 {% endfor %}
17 {% endif %}
18 {% endfor %}
19 {% macro print_node(in_dict, iface_str='', cnt=1) %}
20 {%- for host, iface in in_dict | dictsort -%}
21 {% if loop.index <= cnt %}
22 {% if iface_str %}
23 {{ host }} ansible_ssh_user={{ hostvars[host].ansible_user }} ansible_private_key_file=/root/.ssh/id_rsa ansible_become=True {{ iface_str }}={{ iface }}
24 {% else %}
25 {{ host }} ansible_ssh_user={{ hostvars[host].ansible_user }} ansible_private_key_file=/root/.ssh/id_rsa ansible_become=True
26 {% endif %}
27 {% endif %}
28 {% endfor %}
29 {% endmacro %}
30 [control]
31 {{ print_node(control_dict, iface_str='network_interface', cnt=control_dict | length) }}
32 [compute]
33 {{ print_node(compute_dict, iface_str='network_interface', cnt=compute_dict | length) }}
34 [network]
35 {{ print_node(control_dict, iface_str='', cnt=control_dict | length) }}
36 [monitoring]
37 {{ print_node(control_dict) }}
38 [storage]
39 {{ print_node(control_dict, iface_str='', cnt=control_dict | length) }}