Files
private-ai-platform/ansible/roles/node/change_hostname/main.yml
Hrankin, Aleksandr (contracted) f243f440c3 init
2026-02-19 11:34:13 +00:00

21 lines
495 B
YAML

---
- name: Set hostname
ansible.builtin.hostname:
name: "{{ hostname }}"
- name: Ensure /etc/hosts has proper hostname entry
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: "^127\\.0\\.1\\.1"
line: "127.0.1.1 {{ hostname }}"
create: yes
backup: yes
- name: Reboot system
ansible.builtin.reboot:
msg: "Rebooting after hostname change"
connect_timeout: 5
reboot_timeout: 300
pre_reboot_delay: 0
post_reboot_delay: 10