Some tasks fail if NIC names differ

During configuration file generation one uses local variable
api_interface that reference remote host. Instead we should
use hostvars to find out correct interface name for each host
mentioned in configuration.

Change-Id: I9f64fdf2cd18bcc0bbf1c4193349186d9a7658bc
Closes-Bug: #1650195
This commit is contained in:
Vladislav Belogrudov 2016-12-15 12:37:18 +03:00
parent 7deee0485e
commit 073cfb2a33
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@
ETCD_INITIAL_ADVERTISE_PEER_URLS: "{{ internal_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_peer_port }}"
ETCD_LISTEN_PEER_URLS: "{{ internal_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_peer_port }}"
ETCD_INITIAL_CLUSTER_TOKEN: "{{ etcd_cluster_token }}"
ETCD_INITIAL_CLUSTER: "{% for host in groups['etcd'] %}{{ hostvars[host]['ansible_hostname'] }}={{ internal_protocol }}://{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_peer_port }}{% if not loop.last %},{% endif %}{% endfor %}"
ETCD_INITIAL_CLUSTER: "{% for host in groups['etcd'] %}{{ hostvars[host]['ansible_hostname'] }}={{ internal_protocol }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ etcd_peer_port }}{% if not loop.last %},{% endif %}{% endfor %}"
ETCD_INITIAL_CLUSTER_STATE: "new"
ETCD_OUT_FILE: "/var/log/kolla/etcd/etcd.log"
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"

View File

@ -6,7 +6,7 @@ printjson(rs.initiate(
{% for host in groups["mongodb"] %}
{
"_id" : {{ loop.index }},
"host" : "{{ hostvars[host]['ansible_' + storage_interface]['ipv4']['address'] }}:{{ mongodb_port }}"
"host" : "{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}:{{ mongodb_port }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]