We have a playbook that will start the chronyd service periodically.  If 
the service is down, it will be started.  This causes the "changed" 
condition to be set to 1.  This all works well.  What I need to figure out 
is how can I use the "when: chrony.changed == 1" in our template file that 
we use to email our admins.

Currently, the template will send the service state for ALL hosts in the 
play.  How can I only include those that were changed?

Service Check

Date generated: {{ ansible_date_time.month }}/{{ ansible_date_time.day 
}}/{{ ansible_date_time.year }} {{ ansible_date_time.time }}

---
{% for i in play_hosts | sort %}
Host: {{ i }}
      chronyd state: {{ hostvars[i]['chrony']['state'] }}
---
{% endfor %}

Thanks,
Harry

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c4379830-e98c-4686-93e3-2f530ac107d0n%40googlegroups.com.

Reply via email to