Added playbook that sets the netplan of the servers to only use the internal DNS
This commit is contained in:
parent
06f932ca8b
commit
4feaad11f9
31
dnaclab_linux/prestage_update_dns.yaml
Normal file
31
dnaclab_linux/prestage_update_dns.yaml
Normal file
@ -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"
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Reboots linux host and checks status
|
- name: Reboots linux host and checks status
|
||||||
hosts: kubernetes_dev
|
hosts: kubernetes
|
||||||
become: yes
|
become: yes
|
||||||
vars_files:
|
vars_files:
|
||||||
- global_vars/main.yml
|
- global_vars/main.yml
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user