Skip to content

Commit

Permalink
Merge pull request #11 from ajanis/hostfile-fix
Browse files Browse the repository at this point in the history
use dig lookup to build hostfile for reliability
  • Loading branch information
ajanis authored Jul 19, 2024
2 parents dc2cea6 + 1bb3442 commit a90f0f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
ansible.builtin.lineinfile:
dest: /etc/hosts
state: present
line: "{{ hostvars[item]['ansible_host'] }} {{ openldap_server_domain_name }} {{ openldap_server_domain_name.split('.')[0] }}"
loop: "{{ groups['ldap'] | default([]) | unique }}"
line: "{{ lookup('dig', item ~ '.' ~ www_domain) }} {{ item }}.{{ www_domain }} {{ item }}"
when:
- groups['ldap'] is defined
- groups['ldap'] | length > 0
loop: "{{ groups['ldapservers'] | flatten }}"
tags:
- always

Expand Down

0 comments on commit a90f0f4

Please sign in to comment.