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

19 lines
1.1 KiB
YAML

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Configure HOSTNAME and HOSTS with new HOSTNAME
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- name: "[CONFIG HOSTNAME] Comprobando si es necesario configurar hostname "
meta: end_host
when: hostname_enabled is not defined or not hostname_enabled
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Configure HOSTNAME /etc/hostname
- name: Set a hostname specifying strategy in /etc/hostname
ansible.builtin.hostname:
name: "{{ hostname }}"
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