Ah, I think I see my problem..... it works, but then gets checked against 
vtx and gets set......   I will have to try something else


On Tuesday, April 17, 2018 at 2:21:35 PM UTC-6, John Harmon wrote:
>
> I have a variable 'ntp_timezone' set to UTC by default.  I am trying to 
> override it in certain situation, but this ALWAYS overrides it.  I think 
> something with my logic is wrong and could use another pair of eyes:
> *NOTE: ansible-rhel7 has a current hostname of ansible-rhel7ebs*
>
> - debug:
>     var: ntp_timezone
>     verbosity: 2
>
> - name: Set timezone variable for non-UTC servers (Overriding UTC as 
> default)
>   set_fact:
>     ntp_timezone: America/Denver
>   when: item not in ansible_hostname | lower
>   with_items:
>     - agl
>     - ascp
>     - dmtr
>     - ebs
>     - vtx
>
> - debug:
>     var: ntp_timezone
>     verbosity: 2
>
>
> *Results:*
> TASK [ntp : debug] 
> ***********************************************************************************************************************************************************************************************************************
> task path: /etc/ansible/roles/ntp/tasks/main.yml:27
> ok: [ansible-rhel7] => {
>     "ansible_hostname": "ansible-rhel7ebs"
> }
>
> TASK [ntp : debug] 
> ***********************************************************************************************************************************************************************************************************************
> task path: /etc/ansible/roles/ntp/tasks/main.yml:27
> ok: [ansible-rhel7] => {
>     "ntp_timezone": "UTC"
> }
>
> TASK [ntp : Set timezone variable for non-UTC servers (Overriding UTC as 
> default)] 
> *******************************************************************************************************************************************************
> task path: /etc/ansible/roles/ntp/tasks/main.yml:31
> ok: [ansible-rhel7] => (item=agl) => {"ansible_facts": {"ntp_timezone": 
> "America/Denver"}, "changed": false, "item": "agl"}
> ok: [ansible-rhel7] => (item=ascp) => {"ansible_facts": {"ntp_timezone": 
> "America/Denver"}, "changed": false, "item": "ascp"}
> ok: [ansible-rhel7] => (item=dmtr) => {"ansible_facts": {"ntp_timezone": 
> "America/Denver"}, "changed": false, "item": "dmtr"}
> skipping: [ansible-rhel7] => (item=ebs)  => {"changed": false, "item": 
> "ebs", "skip_reason": "Conditional result was False"}
> ok: [ansible-rhel7] => (item=vtx) => {"ansible_facts": {"ntp_timezone": 
> "America/Denver"}, "changed": false, "item": "vtx"}
>
> TASK [ntp : debug] 
> ***********************************************************************************************************************************************************************************************************************
> task path: /etc/ansible/roles/ntp/tasks/main.yml:42
> ok: [ansible-rhel7] => {
>     "ntp_timezone": "America/Denver"
> }
> META: ending play
>
>
>
>

-- 
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/9e5a192b-7416-4ba6-a122-32da66d29249%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to