- name: system setup | /etc/hosts | populate lineinfile: path: "/etc/hosts" line: "{{ item.ip }} {{ item.fqdn }}" mode: '0644' owner: 'root' group: 'root' loop: - { ip: '192.168.1.240', fqdn: 'coruscant.universe.local'} - { ip: '192.168.1.238', fqdn: 'gitea.mewissen.site'} when: - set_hosts is defined - set_hosts == true