fix a few tasks falsely reporting "changed" (#6269)

Co-authored-by: Hans Feldt <hafe@users.noreply.github.com>
This commit is contained in:
Hans Feldt 2020-06-16 09:24:03 +02:00 committed by GitHub
parent 06391b6dd9
commit a8740c6e13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -18,6 +18,7 @@
state: present
check_mode: yes
register: os_variant_coreos
changed_when: false
- name: set is_fedora_coreos
set_fact: