From a84508d6b9a17ebf02bb22a8a6c58cc870bd0955 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 30 Oct 2018 20:56:58 +0800 Subject: [PATCH] remove deprecated parameters of blockinfile module (#3581) --- roles/kubernetes/preinstall/tasks/0060-resolvconf.yml | 3 +-- roles/kubernetes/preinstall/tasks/0090-etchosts.yml | 2 +- roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml | 3 +-- .../preinstall/tasks/0110-dhclient-hooks-undo.yml | 3 +-- roles/reset/tasks/main.yml | 6 ++---- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml b/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml index ef5a1f515..099077753 100644 --- a/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml +++ b/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml @@ -5,7 +5,7 @@ - name: Add domain/search/nameservers/options to resolv.conf blockinfile: - dest: "{{resolvconffile}}" + path: "{{resolvconffile}}" block: |- {% for item in [domainentry] + [searchentries] + nameserverentries.split(',') -%} {{ item }} @@ -17,7 +17,6 @@ insertbefore: BOF create: yes backup: yes - follow: yes marker: "# Ansible entries {mark}" notify: Preinstall | restart network diff --git a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml index 69626833f..48eadf552 100644 --- a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml +++ b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml @@ -1,7 +1,7 @@ --- - name: Hosts | populate inventory into hosts file blockinfile: - dest: /etc/hosts + path: /etc/hosts block: |- {% for item in (groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]))|unique -%}{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}{% if (item != hostvars[item]['ansible_hostname']) %} {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }} {{ hostvars[item]['ansible_hostname'] }}{% endif %} {{ item }} {{ item }}.{{ dns_domain }} {% endfor %} diff --git a/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml b/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml index 0ab2c9b07..9165c09f8 100644 --- a/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml +++ b/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml @@ -5,12 +5,11 @@ {% for item in [ supersede_domain, supersede_search, supersede_nameserver ] -%} {{ item }} {% endfor %} - dest: "{{dhclientconffile}}" + path: "{{dhclientconffile}}" create: yes state: present insertbefore: BOF backup: yes - follow: yes marker: "# Ansible entries {mark}" notify: Preinstall | restart network when: dhclientconffile is defined diff --git a/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml b/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml index 652223a94..a184ddabc 100644 --- a/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml +++ b/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml @@ -5,10 +5,9 @@ - name: Remove kubespray specific config from dhclient config blockinfile: - dest: "{{dhclientconffile}}" + path: "{{dhclientconffile}}" state: absent backup: yes - follow: yes marker: "# Ansible entries {mark}" when: dhclientconffile is defined notify: Preinstall | restart network diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index 3f5f5e570..326767df1 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -177,9 +177,8 @@ - name: reset | remove dns settings from dhclient.conf blockinfile: - dest: "{{ item }}" + path: "{{ item }}" state: absent - follow: yes marker: "# Ansible entries {mark}" failed_when: false with_items: @@ -191,9 +190,8 @@ - name: reset | remove host entries from /etc/hosts blockinfile: - dest: "/etc/hosts" + path: "/etc/hosts" state: absent - follow: yes marker: "# Ansible inventory hosts {mark}" tags: - files