From cfe77bc51f848c28416e06711eeb94f8d5a51e48 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 2 Oct 2019 15:36:30 +0200 Subject: [PATCH] main: exclude client nodes from facts gathering when delegate_facts_host This commit excludes client nodes from facts gathering, they are not needed and can speed up this task. Signed-off-by: Guillaume Abrioux (cherry picked from commit 865d2eac9ba81bdb9ecbd841e4b73608648dfae2) --- infrastructure-playbooks/rolling_update.yml | 9 +++++---- site-docker.yml.sample | 4 ++-- site.yml.sample | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index cdd9292ad..4fc784e6e 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -59,19 +59,20 @@ gather_facts: False vars: delegate_facts_host: True - tasks: + roles: + - ceph-defaults + post_tasks: - debug: msg="gather facts on all Ceph hosts for following reference" - name: gather facts setup: - when: - - not delegate_facts_host | bool + when: not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, []) - name: gather and delegate facts setup: delegate_to: "{{ item }}" delegate_facts: True - with_items: "{{ groups['all'] }}" + with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}" run_once: true when: - delegate_facts_host | bool diff --git a/site-docker.yml.sample b/site-docker.yml.sample index 7ade7d3dc..b9299317d 100644 --- a/site-docker.yml.sample +++ b/site-docker.yml.sample @@ -24,14 +24,14 @@ pre_tasks: - name: gather facts setup: - when: not delegate_facts_host | bool + when: not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, []) tags: always - name: gather and delegate facts setup: delegate_to: "{{ item }}" delegate_facts: True - with_items: "{{ groups['all'] }}" + with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}" run_once: true when: delegate_facts_host | bool tags: always diff --git a/site.yml.sample b/site.yml.sample index e6d4159da..900f1875a 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -54,13 +54,13 @@ - name: gather facts setup: when: - - not delegate_facts_host | bool + - not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, []) - name: gather and delegate facts setup: delegate_to: "{{ item }}" delegate_facts: True - with_items: "{{ groups['all'] }}" + with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}" run_once: true when: - delegate_facts_host | bool