Hi, 

I have a simple playbook that takes an IP address from the input file and 
update this IP including hostname under /etc/hosts.

The problem is that in the input file the IP is written with subnet – 
1.1.1.1/24

While I need only the IP  1.1.1.1

 

 *Playbook :*

- hosts: localhost

  become: true

  any_errors_fatal: true

  gather_facts: False

  vars_files:

    - /opt/ input-file.yml

  tasks:

 

  - name: Update server etc/host with response ip 

    lineinfile:

        path: /etc/hosts

        line: "{{ lb_ext_ip }}    hdfs"

        state: present

        backup: yes

 

*Result in /etc/hosts*

1.1.1.1/24            hdfs

 

*Required results:*

1.1.1.1   hdfs

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/272a5ee9-5200-4390-98d9-1d51f469b051n%40googlegroups.com.

Reply via email to