From 865d2eac9ba81bdb9ecbd841e4b73608648dfae2 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 --- infrastructure-playbooks/add-mon.yml | 3 ++- infrastructure-playbooks/docker-to-podman.yml | 4 ++-- infrastructure-playbooks/rolling_update.yml | 4 ++-- site-container.yml.sample | 5 +++-- site.yml.sample | 5 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/infrastructure-playbooks/add-mon.yml b/infrastructure-playbooks/add-mon.yml index bfd91995e..ae561862c 100644 --- a/infrastructure-playbooks/add-mon.yml +++ b/infrastructure-playbooks/add-mon.yml @@ -13,9 +13,10 @@ 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, []) - import_role: name: ceph-defaults + - name: gather and delegate facts setup: delegate_to: "{{ item }}" diff --git a/infrastructure-playbooks/docker-to-podman.yml b/infrastructure-playbooks/docker-to-podman.yml index 861d95704..2d997a488 100644 --- a/infrastructure-playbooks/docker-to-podman.yml +++ b/infrastructure-playbooks/docker-to-podman.yml @@ -24,13 +24,13 @@ # pre-tasks for following import - - 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/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 9e13ad8ed..7953ed620 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -59,13 +59,13 @@ - 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-container.yml.sample b/site-container.yml.sample index 204cf771e..59efb62ac 100644 --- a/site-container.yml.sample +++ b/site-container.yml.sample @@ -28,13 +28,14 @@ # pre-tasks for following import - - 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.yml.sample b/site.yml.sample index 44e19aad7..fe7876f62 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -32,13 +32,14 @@ - 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