Fix ansible syntax to avoid ansible warnings (one more) (#3536)

* warning on meta flush_handlers

* avoid rm

* avoid "Module remote_tmp /root/.ansible/tmp did not exist and was created with a mode of 0700, this may cause issues when running as another user. To avoid this, create the remote_tmp dir with the correct permissions manually" warning on subsequent tasks using blockinfile

* is match
This commit is contained in:
Erwan Miran 2018-10-17 21:27:11 +02:00 committed by k8s-ci-robot
parent 52b5309385
commit 87193fd270
7 changed files with 23 additions and 8 deletions

View file

@ -41,6 +41,12 @@
- import_tasks: setup-pipelining.yml
- name: Create remote_tmp for it is used by another module
file:
path: "{{ lookup('config', 'DEFAULT_REMOTE_TMP', on_missing='skip', wantlist=True) | first | default('~/.ansible/tmp') }}"
state: directory
mode: 0700
- name: Gather nodes hostnames
setup:
gather_subset: '!all'

View file

@ -1,3 +1,12 @@
---
- name: kubeadm | Retrieve files to purge
find:
paths: "{{kube_cert_dir }}"
patterns: '*.pem'
register: files_to_purge_for_kubeadm
- name: kubeadm | Purge old certs
command: "rm -f {{kube_cert_dir }}/*.pem"
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ files_to_purge_for_kubeadm.files }}"

View file

@ -120,7 +120,7 @@
- name: Stop if bad hostname
assert:
that: inventory_hostname | match("[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
that: inventory_hostname is match("[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
msg: "Hostname must consist of lower case alphanumeric characters, '.' or '-', and must start and end with an alphanumeric character"
ignore_errors: "{{ ignore_assert_errors }}"

View file

@ -37,7 +37,7 @@
with_items: "{{ (etc_hosts_content['content'] | b64decode).split('\n') }}"
when:
- etc_hosts_content.content is defined
- (item|match('^::1 .*') or item|match('^127.0.0.1 .*'))
- (item is match('^::1 .*') or item is match('^127.0.0.1 .*'))
- name: Hosts | Update target hosts file entries dict with required entries
set_fact:

View file

@ -19,7 +19,3 @@
state: absent
when: dhclienthookfile is defined
notify: Preinstall | restart network
# We need to make sure the network is restarted early enough so that docker can later pick up the correct system
# nameservers and search domains
- meta: flush_handlers

View file

@ -59,6 +59,10 @@
- bootstrap-os
- resolvconf
# We need to make sure the network is restarted early enough so that docker can later pick up the correct system
# nameservers and search domains
- meta: flush_handlers
- name: Check if we are running inside a Azure VM
stat:
path: /var/lib/waagent/

View file

@ -3,7 +3,7 @@
assert:
that:
- "calico_pool_name is defined"
- "calico_pool_name | match('^[a-zA-Z0-9-_\\\\.]{2,63}$')"
- "calico_pool_name is match('^[a-zA-Z0-9-_\\\\.]{2,63}$')"
- "ipip_mode is defined"
- "ipip_mode in ['Always', 'CrossSubnet', 'Never']"
msg: "Check variable definitions seems something is wrong"