On 06. juni 2016 06:08, John.1209 wrote:
This is what I have:
---
- name: Set DNS variable
shell: dig {{ ansible_fqdn }} +short
register: DNSOUT
tasks:
- name: Verify DNS
# - command: /usr/bin/echo {{ ansible_fqdn }} not in DNS!
command: /usr/bin/echo not in DNS!
when: $ansible_fqdn != DNSOUT
This is not working? Is there a better way to do this? Or please suggest
a fix.
Your tasks: is misplaced and indentation is wrong, but this should work
- name: Set DNS variable
command: dig {{ ansible_fqdn }} +short
register: DNSOUT
- name: Verify DNS
command: echo not in DNS!
when: DNSOUT.stdout == ""
The Verify DNS task won't show you anything on in the console, if that's
what you are after you can do it like this
- debug: msg="{{ ansible_fqdn }} not in DNS!"
when: DNSOUT.stdout == ""
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5755825B.80703%40olstad.com.
For more options, visit https://groups.google.com/d/optout.