# Any way to gather localhost information to use in templates for remote hosts?

**URL:** <https://forum.ansible.com/t/any-way-to-gather-localhost-information-to-use-in-templates-for-remote-hosts/21212>\
**Category:** Ansible Project\
**Created:** [April 19, 2016, 11:06pm UTC](https://forum.ansible.com/t/any-way-to-gather-localhost-information-to-use-in-templates-for-remote-hosts/21212 "2016-04-19T23:06:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Huddleston](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@Brian\_Huddleston](https://forum.ansible.com/u/Brian_Huddleston)\
**Post date:** [April 19, 2016, 11:06pm UTC](https://forum.ansible.com/t/any-way-to-gather-localhost-information-to-use-in-templates-for-remote-hosts/21212/1 "2016-04-19T23:06:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brian\_Huddleston](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@Brian\_Huddleston](https://forum.ansible.com/u/Brian_Huddleston)\
**Post date:** [April 20, 2016, 3:01am UTC](https://forum.ansible.com/t/any-way-to-gather-localhost-information-to-use-in-templates-for-remote-hosts/21212/2 "2016-04-20T03:01:43Z")

</div>

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?
