--- # tasks file for ensure_hostname - name: 'Set hostname if localhost' when: - ansible_system == 'Linux' - ansible_fqdn == 'localhost.localdomain' ansible.builtin.hostname: name: '{{ inventory_hostname }}'