I am trying to output what shift an event has happened depending on the 
time of day, but keep running into errors or getting nothing back.


---
- hosts: localhost
  vars:
     shift: "{{ 'First Shift' if ansible_date_time.time > '09:00:00' && 
ansible_date_time.time < '17:00:01' else '' }}"
     shift: "{{ 'Second Shift' if ansible_date_time.time > '17:00:00' && 
ansible_date_time.time < '01:00:01' else '' }}"
     shift: "{{ 'Third Shift' if ansible_date_time.time > '01:00:00' && 
ansible_date_time.time < '09:00:01' else '' }}"
  
  tasks:
    - name: Validate shift
      debug:
          msg: "An event occured on {{ shift }}"

-- 
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/ed49881f-01c4-456d-a148-26eca158eb11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to