--- # Sistemiamo un po' di impostazioni legate al dominio - name: Impostazione del dominio ansible.builtin.file: path: /etc/domainname content: | {{ domain }} owner: root group: root mode: '0644' - name: Sistemiamo il file hosts ansible.builtin.lineinfile: line: "127.0.1.1\t{{ ansible_hostname }}.{{ domain }}\t{{ ansible_hostname }}" regexp: "^127.0.1.1" path: /etc/hosts - name: Verifichiamo che tutto sia in ordine ansible.builtin.command: hostname -f register: returned_fqdn failed_when: returned_fqdn.stdout != "{{ ansible_hostname }}.{{ domain }}"