ypsman.hostname
ansible hostname
Change the Hostname and the localhost entry in /etc/hosts.
It will only change if you set a hostname variable - {{ host_name }}.
The best way to set the host_name variable is in your inventory file.
[hosts]
192.0.0.1 host_name=MyServerName
192.0.0.2 host_name=example
Example Playbook
- hosts: all
roles:
- role: ypsman.hostname