diff --git a/dnaclab_linux/prestage_update_dns.yaml b/dnaclab_linux/prestage_update_dns.yaml new file mode 100644 index 0000000..63669bb --- /dev/null +++ b/dnaclab_linux/prestage_update_dns.yaml @@ -0,0 +1,31 @@ +--- +- name: Change the netplan configuration to only allow the internal DNS server + hosts: all + become: yes + vars_files: + - global_vars/main.yml + + tasks: + + - name: Check if the netplan configuration is present + ansible.builtin.stat: + path: /etc/netplan/00-installer-config.yaml + + - name: Set the new netplan to use only the internal DNS + ansible.builtin.command: netplan set ethernets.ens160.nameservers.addresses=[10.221.0.100] + + - name: Apply the new netplan + ansible.builtin.command: netplan apply + + - name: Restart the resolved service + ansible.builtin.command: systemctl restart systemd-resolved.service + + - name: Get currently configured DNS servers + ansible.builtin.command: netplan get ethernets.ens160.nameservers.addresses + register: dns_check + + - name: Validate that only the internal DNS is configured + ansible.builtin.debug: + msg: Change successfull! + when: dns_check.stdout == "- 10.221.0.100" + diff --git a/dnaclab_linux/reboot.yml b/dnaclab_linux/reboot.yml index d29a135..cef1974 100644 --- a/dnaclab_linux/reboot.yml +++ b/dnaclab_linux/reboot.yml @@ -1,6 +1,6 @@ --- - name: Reboots linux host and checks status - hosts: kubernetes_dev + hosts: kubernetes become: yes vars_files: - global_vars/main.yml