Skip to content
Snippets Groups Projects
Commit 7d0a2aa9 authored by Michal (inc0) Jastrzebski's avatar Michal (inc0) Jastrzebski
Browse files

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
parent db0dc4ae
No related branches found
No related tags found
No related merge requests found
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
- name: get real node hostname - name: get real node hostname
shell: echo $(hostname) shell: echo $(hostname)
register: real_node_hostname register: real_node_hostname
delegate_to: "{{ baremetal_node }}" delegate_to: "{{ control_node }}"
- name: get real node ip - 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 register: real_node_ip
delegate_to: "{{ baremetal_node }}" delegate_to: "{{ control_node }}"
- name: Insert hosts entries for all kolla-ansible hosts - name: Insert hosts entries for all kolla-ansible hosts
lineinfile: lineinfile:
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
when: customize_etc_hosts | bool == True when: customize_etc_hosts | bool == True
- include: append_to_etc_hosts.yml - include: append_to_etc_hosts.yml
with_inventory_hostnames: baremetal with_inventory_hostnames: control
loop_control: loop_control:
loop_var: baremetal_node loop_var: control_node
become: True become: True
when: customize_etc_hosts | bool == True when: customize_etc_hosts | bool == True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment