Merge "Fix bootstrap-servers with invalid api_interface"

This commit is contained in:
Jenkins 2017-07-05 00:21:09 +00:00 committed by Gerrit Code Review
commit 9f80f2d8d7

View File

@ -21,11 +21,18 @@
dest: /etc/hosts
marker: "# {mark} ANSIBLE GENERATED HOSTS"
block: |
{% for host in groups['all'] %}
{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }}
{% for host in groups['baremetal'] %}
{% set api_interface = hostvars[host]['api_interface'] %}
{% if host not in groups['bifrost'] or 'ansible_' + api_interface in hostvars[host] %}
{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }}
{% endif %}
{% endfor %}
become: True
when: customize_etc_hosts | bool
when:
- customize_etc_hosts | bool
# Skip hosts in the bifrost group that do not have a valid api_interface.
- inventory_hostname not in groups['bifrost'] or
'ansible_' + hostvars[inventory_hostname]['api_interface'] in hostvars[inventory_hostname]
- name: Ensure sudo group is present
group: name=sudo state=present