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