From a8740c6e13f52b500ec5f7f27cc49ecee57eac1c Mon Sep 17 00:00:00 2001 From: Hans Feldt <2808287+hafe@users.noreply.github.com> Date: Tue, 16 Jun 2020 09:24:03 +0200 Subject: [PATCH] fix a few tasks falsely reporting "changed" (#6269) Co-authored-by: Hans Feldt --- roles/kubernetes/kubeadm/tasks/main.yml | 7 +++++-- roles/kubernetes/master/tasks/kubeadm-setup.yml | 2 ++ roles/kubernetes/master/tasks/kubeadm-version.yml | 5 +++-- roles/kubernetes/node/tasks/kubelet.yml | 5 +++-- roles/kubernetes/preinstall/tasks/0040-set_facts.yml | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/roles/kubernetes/kubeadm/tasks/main.yml b/roles/kubernetes/kubeadm/tasks/main.yml index 6923ac6f4..3b6fe8974 100644 --- a/roles/kubernetes/kubeadm/tasks/main.yml +++ b/roles/kubernetes/kubeadm/tasks/main.yml @@ -30,23 +30,26 @@ - kubeadm_ca_stat.stat.exists delegate_to: "{{ groups['kube-master'][0] }}" run_once: true + changed_when: false - name: Create kubeadm token for joining nodes with 24h expiration (default) command: "{{ bin_dir }}/kubeadm token create" register: temp_token delegate_to: "{{ groups['kube-master'][0] }}" when: kubeadm_token is not defined + changed_when: false - name: Set kubeadm_token to generated token set_fact: kubeadm_token: "{{ temp_token.stdout }}" when: kubeadm_token is not defined -- name: gets the kubeadm version +- name: Get the kubeadm version command: "{{ bin_dir }}/kubeadm version -o short" register: kubeadm_output + changed_when: false -- name: sets kubeadm api version to v1beta2 +- name: Set kubeadm api version to v1beta2 set_fact: kubeadmConfig_api_version: v1beta2 diff --git a/roles/kubernetes/master/tasks/kubeadm-setup.yml b/roles/kubernetes/master/tasks/kubeadm-setup.yml index d34128553..920286eab 100644 --- a/roles/kubernetes/master/tasks/kubeadm-setup.yml +++ b/roles/kubernetes/master/tasks/kubeadm-setup.yml @@ -164,6 +164,7 @@ shell: >- {{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token delete {{ kubeadm_token }} || :; {{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token create {{ kubeadm_token }} + changed_when: false when: - inventory_hostname == groups['kube-master']|first - kubeadm_token is defined @@ -173,6 +174,7 @@ - name: Create kubeadm token for joining nodes with 24h expiration (default) command: "{{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token create" + changed_when: false register: temp_token retries: 5 delay: 5 diff --git a/roles/kubernetes/master/tasks/kubeadm-version.yml b/roles/kubernetes/master/tasks/kubeadm-version.yml index 1ad14db68..8c7feea35 100644 --- a/roles/kubernetes/master/tasks/kubeadm-version.yml +++ b/roles/kubernetes/master/tasks/kubeadm-version.yml @@ -1,9 +1,10 @@ --- -- name: gets the kubeadm version +- name: Get the kubeadm version command: "{{ bin_dir }}/kubeadm version -o short" register: kubeadm_output + changed_when: false -- name: sets kubeadm api version to v1beta2 +- name: Set kubeadm api version to v1beta2 set_fact: kubeadmConfig_api_version: v1beta2 diff --git a/roles/kubernetes/node/tasks/kubelet.yml b/roles/kubernetes/node/tasks/kubelet.yml index e72e5e083..cb95cc174 100644 --- a/roles/kubernetes/node/tasks/kubelet.yml +++ b/roles/kubernetes/node/tasks/kubelet.yml @@ -6,11 +6,12 @@ state: directory when: dynamic_kubelet_configuration -- name: gets the kubeadm version +- name: Get the kubeadm version command: "{{ bin_dir }}/kubeadm version -o short" register: kubeadm_output + changed_when: false -- name: sets kubelet api version to v1beta1 +- name: Set kubelet api version to v1beta1 set_fact: kubeletConfig_api_version: v1beta1 tags: diff --git a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml index 25e36b09f..0a4cd9ef3 100644 --- a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml +++ b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml @@ -18,6 +18,7 @@ state: present check_mode: yes register: os_variant_coreos + changed_when: false - name: set is_fedora_coreos set_fact: