- name: Set hostname command: "hostnamectl set-hostname {{ inventory_hostname }}" when: - inventory_hostname != 'localhost'