I’m trying to write a task that updates the MODT (Message of the Day) for the target host the playbook is touching.
I’m trying to capture localhost information and the and add those to the MOTD for each target host the playbook touches, here is an example:
----------------------------------------------------------------
THIS BOX IS BEING MANAGED BY ANSIBLE:
----------------------------------------------------------------
Last updated : Saturday, Apr. 16, 2016
Last playbook : testbox.yml
Last run by : johndoe
I think I’ve figured out (2) of them:
Last updated : {{ ansible_date_time.iso8601 }}{{ ansible_date_time.tz }}"
Last run by : {{ lookup(‘env’,‘USER’) }}"
But I have no idea how to lookup the Playbook that is calling the roles and such:
Playbook : testbox.yml"
Any pointers?