--- - name: disable managed /etc/hosts from cloud-init lineinfile: dest: /etc/cloud/cloud.cfg regexp: "^manage_etc_hosts" line: " manage_etc_hosts:false" ignore_errors: yes - name: write hosts configuration file template: src: etc/hosts.j2 dest: /etc/hosts mode: 0644 - name: write resolver configuration files template: src: "{{ item }}.j2" dest: "/{{ item }}" mode: 0644 loop: - etc/dhcp/dhclient-enter-hooks.d/noresolv - etc/resolv.conf ignore_errors: yes - name: write firewall rules configuration file template: src: etc/nftables.conf.j2 dest: /etc/nftables.conf when: nftables_rules is defined and nftables_rules notify: - restart nftables - meta: flush_handlers