Merge "Fix fact gathering when using --limit"
This commit is contained in:
commit
7abbecda30
@ -5,14 +5,32 @@
|
|||||||
# set to 'false' is a bit confusing but this is to avoid
|
# set to 'false' is a bit confusing but this is to avoid
|
||||||
# Ansible gathering facts twice.
|
# Ansible gathering facts twice.
|
||||||
- name: Gather facts for all hosts
|
- name: Gather facts for all hosts
|
||||||
hosts:
|
hosts: all
|
||||||
- all
|
|
||||||
serial: '{{ serial|default("0") }}'
|
serial: '{{ serial|default("0") }}'
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
tasks:
|
tasks:
|
||||||
- setup:
|
- setup:
|
||||||
tags: always
|
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:
|
||||||
|
- (play_hosts | length) != (groups['all'] | length)
|
||||||
|
|
||||||
- hosts:
|
- hosts:
|
||||||
- all
|
- all
|
||||||
roles:
|
roles:
|
||||||
|
Loading…
Reference in New Issue
Block a user