Re: [PATCH v2 25/37] update_etc_hosts: ipaddr

Daniel Gomez <[email protected]>
Newsgroups dev.linux.lists.kdevops
Organization kernel.org
Message-ID <[email protected]>
On 02/09/2025 15.54, Chuck Lever wrote:
> 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]>
> Signed-off-by: Chuck Lever <[email protected]>

Reviewed-by: Daniel Gomez <[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:
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.