vn-ansible/roles/config-hostname/tasks/main.yaml

19 lines
1.1 KiB
YAML
Raw Normal View History

2024-02-12 12:03:22 +00:00
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Configure HOSTNAME and HOSTS with new HOSTNAME
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2024-02-15 10:38:05 +00:00
- name: "[CONFIG HOSTNAME] Comprobando si es necesario configurar hostname "
meta: end_host
when: hostname_enabled is not defined or not hostname_enabled
2024-02-12 12:03:22 +00:00
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Configure HOSTNAME /etc/hostname
- name: Set a hostname specifying strategy in /etc/hostname
ansible.builtin.hostname:
2024-02-14 14:33:55 +00:00
name: "{{ hostname }}"
2024-02-12 12:03:22 +00:00
use: debian
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/hostname_module.html#ansible-collections-ansible-builtin-hostname-module
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html#ansible-collections-ansible-builtin-replace-module
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html#ansible-collections-ansible-builtin-lineinfile-module