ansible / ansible.builtin / v2.9.27 / module / hostname Manage hostname | "added in version" 1.4 of ansible.builtin" Authors: Adrian Likins (@alikins), Hideki Saito (@saito-hideki) preview | supported by communityansible.builtin.hostname (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
Set system's hostname, supports most OSs/Distributions, including those using systemd.
Note, this module does *NOT* modify C(/etc/hosts). You need to modify it yourself using other modules like template or replace.
Windows, HP-UX and AIX are not currently supported.
- hostname: name: web01
use: choices: - generic - debian - sles - redhat - alpine - systemd - openrc - openbsd - solaris - freebsd description: - Which strategy to use to update the hostname. - If not set we try to autodetect, but this can be problematic, specially with containers as they can present misleading information. version_added: '2.9' version_added_collection: ansible.builtin name: description: - Name of the host required: true