Main target is now Debian 13 instead of Ubuntu 24.04
This commit is contained in:
25
seb4itik/byow/roles/common/tasks/setup_hosts.yml
Normal file
25
seb4itik/byow/roles/common/tasks/setup_hosts.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- name: Check if /etc/cloud/cloud.cfg exists
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/cloud/cloud.cfg"
|
||||
register: common_out_cloud_cfg
|
||||
|
||||
- name: Disable /etc/hosts management by cloud-init
|
||||
when: "common_out_cloud_cfg.stat.exists"
|
||||
block:
|
||||
- name: Disable /etc/hosts management by cloud-init (manage_etc_hosts)
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/cloud/cloud.cfg"
|
||||
search_string: 'manage_etc_hosts:'
|
||||
line: "manage_etc_hosts: false"
|
||||
insertafter: "preserve_hostname:"
|
||||
- name: Disable /etc/hosts management by cloud-init (update_etc_hosts)
|
||||
ansible.builtin.replace:
|
||||
path: "/etc/cloud/cloud.cfg"
|
||||
regexp: '^([^#]*update_etc_hosts.*)$'
|
||||
replace: '# \\1'
|
||||
|
||||
- name: Configure /etc/hosts file
|
||||
ansible.builtin.template:
|
||||
src: "templates/hosts"
|
||||
dest: "/etc/hosts"
|
||||
mode: "0644"
|
||||
Reference in New Issue
Block a user