Learning Ansible 2.7(Third Edition)
上QQ阅读APP看书,第一时间看更新

Changing the hostname

To keep things simple, I find it useful to set the hostname of a machine to something meaningful. To do so, we can use a very simple Ansible module called hostname:

- name: Ensure the hostname is the same of the inventory 
  hostname: 
    name: "{{ inventory_hostname }}" 
  become: True