From fcd8d850dc0d77c48d0c7c754a37c00c4b7b133f Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Tue, 16 Oct 2018 08:47:04 +0200 Subject: [PATCH] Fix ansible syntax to avoid ansible warnings (again) (#3509) * Fix ansible syntax to avoid ansible warnings (again) * warn: false on tar -cfz * wrong placement of warn:false --- roles/etcd/tasks/check_certs.yml | 14 +++++--------- roles/kubernetes/secrets/tasks/check-tokens.yml | 3 +-- roles/kubernetes/secrets/tasks/gen_tokens.yml | 2 ++ roles/reset/tasks/main.yml | 3 ++- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/roles/etcd/tasks/check_certs.yml b/roles/etcd/tasks/check_certs.yml index 337220397..76d46c93a 100644 --- a/roles/etcd/tasks/check_certs.yml +++ b/roles/etcd/tasks/check_certs.yml @@ -57,12 +57,8 @@ - name: "Check_certs | Set 'sync_certs' to true" set_fact: sync_certs: true - when: |- - {%- set certs = {'sync': False} -%} - {% if gen_node_certs[inventory_hostname] or - (not etcdcert_node.results[0].stat.exists|default(False)) or - (not etcdcert_node.results[1].stat.exists|default(False)) or - (etcdcert_node.results[1].stat.checksum|default('') != etcdcert_master.files|selectattr("path", "equalto", etcdcert_node.results[1].stat.path)|map(attribute="checksum")|first|default('')) -%} - {%- set _ = certs.update({'sync': True}) -%} - {% endif %} - {{ certs.sync }} + when: + - gen_node_certs[inventory_hostname] or + (not etcdcert_node.results[0].stat.exists|default(false)) or + (not etcdcert_node.results[1].stat.exists|default(false)) or + (etcdcert_node.results[1].stat.checksum|default('') != etcdcert_master.files|selectattr("path", "equalto", etcdcert_node.results[1].stat.path)|map(attribute="checksum")|first|default('')) diff --git a/roles/kubernetes/secrets/tasks/check-tokens.yml b/roles/kubernetes/secrets/tasks/check-tokens.yml index 616664b93..0f0c95b48 100644 --- a/roles/kubernetes/secrets/tasks/check-tokens.yml +++ b/roles/kubernetes/secrets/tasks/check-tokens.yml @@ -24,8 +24,7 @@ - name: "Check_tokens | Set 'sync_tokens' to true" set_fact: - sync_tokens: true - when: >- + sync_tokens: >- {%- set tokens = {'sync': False} -%} {%- for server in groups['kube-master'] | intersect(ansible_play_batch) if (not hostvars[server].known_tokens.stat.exists) or diff --git a/roles/kubernetes/secrets/tasks/gen_tokens.yml b/roles/kubernetes/secrets/tasks/gen_tokens.yml index df47d157d..c24ba50fd 100644 --- a/roles/kubernetes/secrets/tasks/gen_tokens.yml +++ b/roles/kubernetes/secrets/tasks/gen_tokens.yml @@ -46,6 +46,8 @@ - name: Gen_tokens | Gather tokens shell: "tar cfz - {{ tokens_list.stdout_lines | join(' ') }} | base64 --wrap=0" + args: + warn: false register: tokens_data check_mode: no delegate_to: "{{groups['kube-master'][0]}}" diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index 0f3e6eaea..8122ada08 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -79,9 +79,10 @@ - name: reset | gather mounted kubelet dirs shell: mount | grep /var/lib/kubelet/ | awk '{print $3}' | tac + args: + warn: false check_mode: no register: mounted_dirs - warn: false tags: - mounts