diff --git a/tasks/main.yml b/tasks/main.yml index af8ed27..45ae60f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,8 @@ --- # tasks file for ensure_hostname +- name: 'Set hostname if localhost' + when: + - ansible_system == 'Linux' + - ansible_fqdn == 'localhost.localdomain' + ansible.builtin.hostname: + name: '{{ inventory_hostname }}'