From 545eee0bfe6c620c9a52209acd613708d7d69c54 Mon Sep 17 00:00:00 2001 From: Sergey Bondarev Date: Fri, 10 Apr 2020 17:55:41 +0300 Subject: [PATCH 1/4] add gather facts on all hosts in inventory --- cluster.yml | 4 ++++ scale.yml | 4 ++++ upgrade-cluster.yml | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cluster.yml b/cluster.yml index 6c6dd36c0d2..1f82a74abee 100644 --- a/cluster.yml +++ b/cluster.yml @@ -33,6 +33,10 @@ - { role: kubespray-defaults } - { role: bastion-ssh-config, tags: ["localhost", "bastion"] } +- name: Gather facts + hosts: k8s-cluster:etcd:calico-rr + gather_facts: True + - hosts: k8s-cluster:etcd any_errors_fatal: "{{ any_errors_fatal | default(true) }}" gather_facts: false diff --git a/scale.yml b/scale.yml index 08b9a0290fc..637af8f125f 100644 --- a/scale.yml +++ b/scale.yml @@ -33,6 +33,10 @@ - { role: kubespray-defaults } - { role: bastion-ssh-config, tags: ["localhost", "bastion"] } +- name: Gather facts + hosts: k8s-cluster:etcd:calico-rr + gather_facts: True + - name: Bootstrap any new workers hosts: kube-node any_errors_fatal: "{{ any_errors_fatal | default(true) }}" diff --git a/upgrade-cluster.yml b/upgrade-cluster.yml index a61c3f452c8..412e8c5e5a0 100644 --- a/upgrade-cluster.yml +++ b/upgrade-cluster.yml @@ -35,7 +35,7 @@ - hosts: k8s-cluster:etcd:calico-rr any_errors_fatal: "{{ any_errors_fatal | default(true) }}" - gather_facts: false + gather_facts: True vars: # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled. From b463b0c54dde4ba0a63e19b7f813f10619a7f4d3 Mon Sep 17 00:00:00 2001 From: Sergey Bondarev Date: Sat, 11 Apr 2020 00:21:17 +0300 Subject: [PATCH 2/4] move gather facts after bootstrap os --- cluster.yml | 8 ++++---- scale.yml | 8 ++++---- upgrade-cluster.yml | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cluster.yml b/cluster.yml index 1f82a74abee..6d69efdf223 100644 --- a/cluster.yml +++ b/cluster.yml @@ -33,10 +33,6 @@ - { role: kubespray-defaults } - { role: bastion-ssh-config, tags: ["localhost", "bastion"] } -- name: Gather facts - hosts: k8s-cluster:etcd:calico-rr - gather_facts: True - - hosts: k8s-cluster:etcd any_errors_fatal: "{{ any_errors_fatal | default(true) }}" gather_facts: false @@ -44,6 +40,10 @@ - { role: kubespray-defaults } - { role: bootstrap-os, tags: bootstrap-os} +- name: Gather facts + hosts: k8s-cluster:etcd:calico-rr + gather_facts: True + - hosts: k8s-cluster:etcd any_errors_fatal: "{{ any_errors_fatal | default(true) }}" roles: diff --git a/scale.yml b/scale.yml index 637af8f125f..2f530080d1a 100644 --- a/scale.yml +++ b/scale.yml @@ -33,10 +33,6 @@ - { role: kubespray-defaults } - { role: bastion-ssh-config, tags: ["localhost", "bastion"] } -- name: Gather facts - hosts: k8s-cluster:etcd:calico-rr - gather_facts: True - - name: Bootstrap any new workers hosts: kube-node any_errors_fatal: "{{ any_errors_fatal | default(true) }}" @@ -45,6 +41,10 @@ - { role: kubespray-defaults } - { role: bootstrap-os, tags: bootstrap-os} +- name: Gather facts + hosts: k8s-cluster:etcd:calico-rr + gather_facts: True + - name: Generate the etcd certificates beforehand hosts: etcd any_errors_fatal: "{{ any_errors_fatal | default(true) }}" diff --git a/upgrade-cluster.yml b/upgrade-cluster.yml index 412e8c5e5a0..d37aa886d99 100644 --- a/upgrade-cluster.yml +++ b/upgrade-cluster.yml @@ -35,7 +35,7 @@ - hosts: k8s-cluster:etcd:calico-rr any_errors_fatal: "{{ any_errors_fatal | default(true) }}" - gather_facts: True + gather_facts: false vars: # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled. @@ -44,6 +44,10 @@ - { role: kubespray-defaults } - { role: bootstrap-os, tags: bootstrap-os} +- name: Gather facts + hosts: k8s-cluster:etcd:calico-rr + gather_facts: True + - name: Download images to ansible host cache via first kube-master node hosts: kube-master[0] any_errors_fatal: "{{ any_errors_fatal | default(true) }}" From 8e7b5d2f293156acdb99d1bcfa6d7c177f58594b Mon Sep 17 00:00:00 2001 From: Sergey Bondarev Date: Sat, 11 Apr 2020 00:34:27 +0300 Subject: [PATCH 3/4] gather facts without --limit limits --- cluster.yml | 12 ++++++++++-- scale.yml | 12 ++++++++++-- upgrade-cluster.yml | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/cluster.yml b/cluster.yml index 6d69efdf223..61d4edf4284 100644 --- a/cluster.yml +++ b/cluster.yml @@ -41,8 +41,16 @@ - { role: bootstrap-os, tags: bootstrap-os} - name: Gather facts - hosts: k8s-cluster:etcd:calico-rr - gather_facts: True + hosts: localhost + gather_facts: false + become: no + tasks: + - name: Gather facts from ALL hosts (regardless of limit or tags) + setup: + delegate_to: "{{ item }}" + delegate_facts: True + when: hostvars[item]['ansible_machine_id'] is not defined + with_items: "{{ groups['all'] }}" - hosts: k8s-cluster:etcd any_errors_fatal: "{{ any_errors_fatal | default(true) }}" diff --git a/scale.yml b/scale.yml index 2f530080d1a..838ab7e591d 100644 --- a/scale.yml +++ b/scale.yml @@ -42,8 +42,16 @@ - { role: bootstrap-os, tags: bootstrap-os} - name: Gather facts - hosts: k8s-cluster:etcd:calico-rr - gather_facts: True + hosts: localhost + gather_facts: false + become: no + tasks: + - name: Gather facts from ALL hosts (regardless of limit or tags) + setup: + delegate_to: "{{ item }}" + delegate_facts: True + when: hostvars[item]['ansible_machine_id'] is not defined + with_items: "{{ groups['all'] }}" - name: Generate the etcd certificates beforehand hosts: etcd diff --git a/upgrade-cluster.yml b/upgrade-cluster.yml index d37aa886d99..27a14b1a3a6 100644 --- a/upgrade-cluster.yml +++ b/upgrade-cluster.yml @@ -45,8 +45,16 @@ - { role: bootstrap-os, tags: bootstrap-os} - name: Gather facts - hosts: k8s-cluster:etcd:calico-rr - gather_facts: True + hosts: localhost + gather_facts: false + become: no + tasks: + - name: Gather facts from ALL hosts (regardless of limit or tags) + setup: + delegate_to: "{{ item }}" + delegate_facts: True + when: hostvars[item]['ansible_machine_id'] is not defined + with_items: "{{ groups['all'] }}" - name: Download images to ansible host cache via first kube-master node hosts: kube-master[0] From f66773733eeba46e6885a0f26b2573e8fe4eea68 Mon Sep 17 00:00:00 2001 From: Sergey Bondarev Date: Sat, 11 Apr 2020 02:08:28 +0300 Subject: [PATCH 4/4] change need gather facts detect var to ansible_default_ipv4 --- cluster.yml | 2 +- scale.yml | 2 +- upgrade-cluster.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cluster.yml b/cluster.yml index 61d4edf4284..7412d10d294 100644 --- a/cluster.yml +++ b/cluster.yml @@ -49,7 +49,7 @@ setup: delegate_to: "{{ item }}" delegate_facts: True - when: hostvars[item]['ansible_machine_id'] is not defined + when: hostvars[item]['ansible_default_ipv4'] is not defined with_items: "{{ groups['all'] }}" - hosts: k8s-cluster:etcd diff --git a/scale.yml b/scale.yml index 838ab7e591d..ccb2894ffce 100644 --- a/scale.yml +++ b/scale.yml @@ -50,7 +50,7 @@ setup: delegate_to: "{{ item }}" delegate_facts: True - when: hostvars[item]['ansible_machine_id'] is not defined + when: hostvars[item]['ansible_default_ipv4'] is not defined with_items: "{{ groups['all'] }}" - name: Generate the etcd certificates beforehand diff --git a/upgrade-cluster.yml b/upgrade-cluster.yml index 27a14b1a3a6..bfa5da9237e 100644 --- a/upgrade-cluster.yml +++ b/upgrade-cluster.yml @@ -53,7 +53,7 @@ setup: delegate_to: "{{ item }}" delegate_facts: True - when: hostvars[item]['ansible_machine_id'] is not defined + when: hostvars[item]['ansible_default_ipv4'] is not defined with_items: "{{ groups['all'] }}" - name: Download images to ansible host cache via first kube-master node