Limit hostfile generation to control nodes

With current implementation generation of hostfile is N^2, let's at
least limit this to controller nodes. Currently only RabbitMQ requires
hostnames, and these lands on control.

TrivialFix

Change-Id: I15f8d98386ede8bbc89f66923f21547efe20ff37
This commit is contained in:
Michal (inc0) Jastrzebski 2016-08-30 16:41:16 +00:00
parent db0dc4ae48
commit 7d0a2aa9f0
2 changed files with 5 additions and 5 deletions
ansible/roles/baremetal/tasks

@ -2,12 +2,12 @@
- name: get real node hostname
shell: echo $(hostname)
register: real_node_hostname
delegate_to: "{{ baremetal_node }}"
delegate_to: "{{ control_node }}"
- name: get real node ip
shell: ip -4 addr show "{{ hostvars[baremetal_node]['baremetal_nic'] }}" | grep -oP "(?<=inet )[\d\.]+(?=/)"
shell: ip -4 addr show "{{ hostvars[control_node]['baremetal_nic'] }}" | grep -oP "(?<=inet )[\d\.]+(?=/)"
register: real_node_ip
delegate_to: "{{ baremetal_node }}"
delegate_to: "{{ control_node }}"
- name: Insert hosts entries for all kolla-ansible hosts
lineinfile:

@ -39,9 +39,9 @@
when: customize_etc_hosts | bool == True
- include: append_to_etc_hosts.yml
with_inventory_hostnames: baremetal
with_inventory_hostnames: control
loop_control:
loop_var: baremetal_node
loop_var: control_node
become: True
when: customize_etc_hosts | bool == True