[PATCH v3 24/36] update_etc_hosts: ipaddr

Chuck Lever <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Chuck Lever <[email protected]>

ansible.netcommon.ipaddr is deprecated. See:

 https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/ipaddr_filter.html

Ensure the update_etc_hosts playbook uses the ansible.utils.ipaddr
plugin instead.

Reviewed-by: Luis Chamberlain <[email protected]>
Reviewed-by: Daniel Gomez <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
---
 playbooks/roles/update_etc_hosts/tasks/main.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/playbooks/roles/update_etc_hosts/tasks/main.yml b/playbooks/roles/update_etc_hosts/tasks/main.yml
index dc40ededd539..17c85dc539b5 100644
--- a/playbooks/roles/update_etc_hosts/tasks/main.yml
+++ b/playbooks/roles/update_etc_hosts/tasks/main.yml
@@ -51,8 +51,8 @@
   become_method: sudo
   ansible.builtin.lineinfile:
     dest: /etc/hosts
-    regexp: ".*{{ item }}$"
-    line: "{{ hostvars[item].ansible_all_ipv4_addresses | ipaddr(private_network) | first }} {{ item }}"
+    regexp: '.*{{ item }}$'
+    line: "{{ hostvars[item].ansible_all_ipv4_addresses | ansible.utils.ipaddr(private_network) | first }} {{ item }}"
     state: present
   with_items: "{{ ueh_hosts }}"
   when:
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.