Loading run.yml +11 −11 Original line number Diff line number Diff line Loading @@ -5,14 +5,14 @@ become: yes roles: - hostname - hosts: ipaserver:ipareplicas tasks: - name: Populate /etc/hosts lineinfile: dest: /etc/hosts regexp: '.*{{ item }}$' line: "{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state: present when: hostvars[item].ansible_default_ipv4.address is defined with_items: groups['ipaserver','ipareplicas'] # #- hosts: ipaserver:ipareplicas # tasks: # - name: Populate /etc/hosts # lineinfile: # dest: /etc/hosts # regexp: '.*{{ item }}$' # line: "{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" # state: present # when: hostvars[item].ansible_default_ipv4.address is defined # with_items: groups['ipaserver','ipareplicas'] Loading
run.yml +11 −11 Original line number Diff line number Diff line Loading @@ -5,14 +5,14 @@ become: yes roles: - hostname - hosts: ipaserver:ipareplicas tasks: - name: Populate /etc/hosts lineinfile: dest: /etc/hosts regexp: '.*{{ item }}$' line: "{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state: present when: hostvars[item].ansible_default_ipv4.address is defined with_items: groups['ipaserver','ipareplicas'] # #- hosts: ipaserver:ipareplicas # tasks: # - name: Populate /etc/hosts # lineinfile: # dest: /etc/hosts # regexp: '.*{{ item }}$' # line: "{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" # state: present # when: hostvars[item].ansible_default_ipv4.address is defined # with_items: groups['ipaserver','ipareplicas']