Hello everyone!
Conditionals seem to be very difficult to get right for some reason so I am
hoping someone can explain why the following doesn't seem to work. Or show
me the way. :)
I am simply trying to check the current timezone of the server and if it
doesn't match CST then run a handler to update it. Here's the code:
- name: Get timezone info
shell: date
register: zoneinfo
Then just to make sure I have the right data I use debug to print the
zoneinfo var I just registered:
- name: Print zoneinfo for debug
debug: var="zoneinfo.stdout"
This outputs:
TASK: [common | Print zoneinfo for debug]
*************************************
ok: [10.10.10.10] => {
"zoneinfo.stdout": "Tue Dec 30 14:11:03 CST 2014"
}
Referring to the Ansible docs I can use something like when:
zoneinfo.stdout.find('CST') != 1 but no matter what I try I can't get it to
work.
I have tried the following:
- name: If timezone is not CST then remove /etc/localtime and call set
timezone handler
file: path=/etc/localtime state=absent
when: zoneinfo.stdout.find('CST') != 1
notify:
- set timezone
I have tried not true. Is not. == 1 == 0 and several other options but its
not working.
Any suggestions?
Thanks!
--
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/1c7a5e23-6375-4136-9b75-38777dbf1e41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.