aboutsummaryrefslogtreecommitdiff
path: root/ansible/kolla-host.yml
diff options
context:
space:
mode:
authorSoeren Becker <mail@soerenbecker.org>2017-08-29 14:49:48 +0200
committerSoeren Becker <mail@soerenbecker.org>2017-08-29 15:13:48 +0200
commitc24afe6d6839786a7624c28fb3c180716d1b2cb1 (patch)
tree6256407553d1b306df40d1047e8e19d77a9074b9 /ansible/kolla-host.yml
parent15061940133e55bea194e92658ac3d93879efdd1 (diff)
downloadkolla-ansible-c24afe6d6839786a7624c28fb3c180716d1b2cb1.tar.gz
kolla-ansible-c24afe6d6839786a7624c28fb3c180716d1b2cb1.zip
Enable use of --limit when using bootstrap-servers
The ansible/kolla-host.yml playbook failed when called with a --limit flag. This was due to the fact that only the facts of the subset of hosts were gathered but the "Generate /etc/hosts for all of the nodes" task is using the ansible_<IFACE>.ipv4.address variable of all hosts. The code for this fix is copied from the site.yml playbook where it was used for the same reason. Change-Id: I7e70caf750506ad8ab36ec024bd9647dd733fbd0 Closes-Bug: #1713725
Diffstat (limited to 'ansible/kolla-host.yml')
-rw-r--r--ansible/kolla-host.yml32
1 files changed, 32 insertions, 0 deletions
diff --git a/ansible/kolla-host.yml b/ansible/kolla-host.yml
index 6265a05c9..097b8de55 100644
--- a/ansible/kolla-host.yml
+++ b/ansible/kolla-host.yml
@@ -1,4 +1,36 @@
---
+# NOTE(awiddersheim): Gather facts for all hosts as a
+# first step since several plays below require them when
+# building their configurations. The below 'gather_facts'
+# set to 'false' is a bit confusing but this is to avoid
+# Ansible gathering facts twice.
+- name: Gather facts for all hosts
+ hosts: all
+ serial: '{{ serial|default("0") }}'
+ gather_facts: false
+ tasks:
+ - setup:
+ tags: always
+
+# NOTE(pbourke): This case covers deploying subsets of hosts using --limit. The
+# limit arg will cause the first play to gather facts only about that node,
+# meaning facts such as IP addresses for rabbitmq nodes etc. will be undefined
+# in the case of adding a single compute node.
+# We don't want to add the delegate parameters to the above play as it will
+# result in ((num_nodes-1)^2) number of SSHs when running for all nodes
+# which can be very inefficient.
+- name: Gather facts for all hosts (if using --limit)
+ hosts: all
+ serial: '{{ serial|default("0") }}'
+ gather_facts: false
+ tasks:
+ - setup:
+ delegate_facts: True
+ delegate_to: "{{ item }}"
+ with_items: "{{ groups['all'] }}"
+ when:
+ - (ansible_play_batch | length) != (groups['all'] | length)
+
- name: Apply role baremetal
hosts: baremetal
gather_facts: no