Skip to content

Commit

Permalink
Merge pull request oravirt#191 from Rendanic/prnslookup
Browse files Browse the repository at this point in the history
orahost: replace nslookup with host
  • Loading branch information
oravirt authored Oct 23, 2019
2 parents 39dfaa0 + 7a56adb commit c8eec5b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions roles/orahost/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,15 @@
tags: selinux

- name: Check dns for host
command: nslookup {{ ansible_hostname }}
command: host {{ ansible_hostname }}
register: ns
ignore_errors: True
changed_when: False
tags: etchosts

- name: Add host to /etc/hosts if needed
#lineinfile: dest=/etc/hosts regexp='.*{{ ansible_fqdn }}$' line="{{ ansible_default_ipv4.address }} {{ ansible_hostname }} {{ ansible_fqdn }}" state=present
lineinfile: dest=/etc/hosts regexp='.*{{ ansible_fqdn }}$' line="{{ etc_hosts_ip }} {{ ansible_hostname }} {{ ansible_fqdn }}" state=present
#when: "'find {{ ansible_hostname }}: NXDOMAIN' in ns.stdout or 'find {{ ansible_hostname }}: SERVFAIL' in ns.stdout or configure_etc_hosts"
when: "(': NXDOMAIN' in ns.stdout) or (' No answer' in ns.stdout) or configure_etc_hosts"
when: "ns.rc != 0 or configure_etc_hosts"
tags: etchosts

# - name: Add local node's ip & hostname to /etc/hosts
Expand Down

0 comments on commit c8eec5b

Please sign in to comment.