fix 删除etcd节点hosts文件不更新

pull/992/head
gjmzj 2021-01-21 23:48:57 +08:00
parent be6f0034d5
commit f0aaad4b0f
3 changed files with 2 additions and 3 deletions

View File

@ -73,7 +73,7 @@
# lineinfile is inadequate to delete lines between some specific line range # lineinfile is inadequate to delete lines between some specific line range
- name: remove the etcd's node entry in hosts - name: remove the etcd's node entry in hosts
shell: 'sed -i "/^\[etcd/,/^\[kube_master/ {/^{{ ETCD_TO_DEL }}[^0-9]/d}" {{ base_dir }}/clusters/{{ CLUSTER }}/hosts' shell: 'sed -i "/^\[etcd/,/^\[kube_master/ {/^{{ ETCD_TO_DEL }}[^0-9]*$/d}" {{ base_dir }}/clusters/{{ CLUSTER }}/hosts'
args: args:
warn: false warn: false
when: "groups['etcd']|length > 1 and ETCD_TO_DEL in groups['etcd']" when: "groups['etcd']|length > 1 and ETCD_TO_DEL in groups['etcd']"

View File

@ -1,3 +1,4 @@
--- ---
- import_tasks: hardening.yml - import_tasks: hardening.yml
ignore_errors: true
when: os_hardening_enabled | bool when: os_hardening_enabled | bool

View File

@ -30,7 +30,6 @@
name: '{{ os_packages_pam_passwdqc }}' name: '{{ os_packages_pam_passwdqc }}'
state: 'present' state: 'present'
update_cache: 'yes' update_cache: 'yes'
ignore_errors: true
when: when:
- ansible_facts.distribution in ['Debian', 'Ubuntu'] - ansible_facts.distribution in ['Debian', 'Ubuntu']
- os_auth_pam_passwdqc_enable - os_auth_pam_passwdqc_enable
@ -98,7 +97,6 @@
yum: yum:
name: '{{ os_packages_pam_passwdqc }}' name: '{{ os_packages_pam_passwdqc }}'
state: 'present' state: 'present'
ignore_errors: true
when: when:
- ansible_facts.os_family == 'RedHat' - ansible_facts.os_family == 'RedHat'
- ansible_facts.distribution_major_version|int is version('7', '<') - ansible_facts.distribution_major_version|int is version('7', '<')