refs #8142: - Remove DNS query used to check if main_dns_server failed

This commit is contained in:
Xavi Lleó 2025-01-16 11:57:48 +01:00
parent 40ea739925
commit 541a71c83a
1 changed files with 28 additions and 43 deletions

View File

@ -98,49 +98,34 @@
masked: yes masked: yes
loop: "{{ samba_client_services }}" loop: "{{ samba_client_services }}"
- name: Perform a DNS query to get the IP of google.es - name: Extracting variables
command: "dig @{{ main_dns_server }} google.es +short" #no_log: true
register: dns_exists set_fact:
passwords: "{{ lookup(passbolt, key_name, folder_parent_id=passbolt_folder).password }}"
- name: Show the result of the DNS query - name: Add A record to DNS
debug: nsupdate:
var: dns_exists.stdout key_name: '{{ key_name }}'
key_secret: '{{ passwords }}'
key_algorithm: '{{ key_algorithm }}'
server: "{{ main_dns_server }}"
zone: '{{ resolv_domain }}'
ttl: '{{ ttl }}'
type: 'A'
record: '{{ name_ad }}.{{ realm }}.'
value: '{{ ip_serverad }}'
state: present
- when: dns_exists - name: Add NS record to DNS
block: nsupdate:
key_name: '{{ key_name }}'
- name: Extracting variables key_secret: '{{ passwords }}'
#no_log: true key_algorithm: '{{ key_algorithm }}'
set_fact: server: '{{ main_dns_server }}'
passwords: "{{ lookup(passbolt, key_name, folder_parent_id=passbolt_folder).password }}" zone: '{{ resolv_domain }}'
ttl: '{{ ttl }}'
- name: type: 'NS'
debug: record: '{{ realm }}.'
msg: "Las variables son {{ key_name }} -- {{ passwords }} -- {{ key_algorithm }} -- {{ main_dns_server }} -- {{ resolv_domain }} -- {{ name_ad }}.{{ realm }}. -- {{ ip_serverad }}" value: '{{ name_ad }}.{{ realm }}.'
state: present
- name: Add A record to DNS
nsupdate:
key_name: '{{ key_name }}'
key_secret: '{{ passwords }}'
key_algorithm: '{{ key_algorithm }}'
server: "{{ main_dns_server }}"
zone: '{{ resolv_domain }}'
ttl: '{{ ttl }}'
type: 'A'
record: '{{ name_ad }}.{{ realm }}.'
value: '{{ ip_serverad }}'
state: present
- name: Add NS record to DNS
nsupdate:
key_name: '{{ key_name }}'
key_secret: '{{ passwords }}'
key_algorithm: '{{ key_algorithm }}'
server: '{{ main_dns_server }}'
zone: '{{ resolv_domain }}'
ttl: '{{ ttl }}'
type: 'NS'
record: '{{ realm }}.'
value: '{{ name_ad }}.{{ realm }}.'
state: present