# Showing which roles have been run on a machine

**URL:** <https://forum.ansible.com/t/showing-which-roles-have-been-run-on-a-machine/24912>\
**Category:** Ansible Project\
**Created:** [July 6, 2017, 1:10pm UTC](https://forum.ansible.com/t/showing-which-roles-have-been-run-on-a-machine/24912 "2017-07-06T13:10:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gforster](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/gforster/32/535_2.png) [@gforster](https://forum.ansible.com/u/gforster)\
**Post date:** [July 6, 2017, 1:10pm UTC](https://forum.ansible.com/t/showing-which-roles-have-been-run-on-a-machine/24912/1 "2017-07-06T13:10:18Z")

</div>

Is there a standard way to show which roles have been installed on a target machine from that machine?

e.g. Ansible control machine installs Apache & MySQL on Remote1 and Nginx & MySQL on Remote2. If I SSH into Remote2, can it tell me that Ansible successfully installed Nginx & MySQL?

Alternatively, is there a good/accepted way to drop a file on a target machine that lists what roles were installed on it?

---

<div class="post-metadata">

**Author:** ![drybjed](https://avatars.discourse-cdn.com/v4/letter/d/48db29/32.png) [@drybjed](https://forum.ansible.com/u/drybjed)\
**Post date:** [July 6, 2017, 1:15pm UTC](https://forum.ansible.com/t/showing-which-roles-have-been-run-on-a-machine/24912/2 "2017-07-06T13:15:49Z")

</div>

Most of my Ansible roles create local Ansible facts, usually to create some internal variables used by the role, or to mark a particular service as installed for conditional checks. Since the Ansible facts are consitently named after the roles that created them, when I check a host to see what facts are installed, I can see at a glance what roles were executed on a host:

root@host:~# ls -l /etc/ansible/facts.d/

total 104  
-rwxr-xr-x 1 root root 2977 Jul 6 08:27 apt.fact\*  
-rw-r–r-- 1 root root 25 Jul 6 08:29 apt\_install.fact  
-rwxr-xr-x 1 root root 937 Jul 6 08:27 apt\_listchanges.fact\*  
-rw-r–r-- 1 root root 69 Jul 6 08:25 atd.fact  
-rwxr-xr-x 1 root root 983 Jul 6 08:24 cap12s.fact\*  
-rwxr-xr-x 1 root root 1889 Jul 6 08:24 core.fact\*  
-rwxr-xr-x 1 root root 1375 Jul 6 08:24 debops\_fact.fact\*  
-rw-r–r-- 1 root root 305 Jul 6 08:25 dhparam.fact  
-rw-r–r-- 1 root root 39 Jul 6 08:24 environment.fact  
-rw-r–r-- 1 root root 89 Jul 6 08:32 ferm.fact  
-rwxr-xr-x 1 root root 434 Jul 6 08:24 init.fact\*  
-rwxr-xr-x 1 root root 565 Jul 6 12:06 nginx.fact\*  
-rwxr-xr-x 1 root root 1612 Jul 6 08:30 nsswitch.fact\*  
-rw-r–r-- 1 root root 39 Jul 6 08:33 ntp.fact  
-rwxr-xr-x 1 root root 1319 Jul 6 08:26 pki.fact\*  
-rwxr-xr-x 1 root root 1013 Jul 6 08:33 proc.fact\*  
-rwxr-xr-x 1 root root 1508 Jul 6 09:24 rabbitmq\_server.fact\*  
-rwxr-xr-x 1 root root 757 Jul 6 08:24 resolver.fact\*  
-rw-r–r-- 1 root root 452 Jul 6 08:24 root.fact  
-rwxr-xr-x 1 root root 665 Jul 6 08:33 root\_account.fact\*  
-rwxr-xr-x 1 root root 1197 Jul 6 08:35 sshd.fact\*  
-rw-r–r-- 1 root root 16 Jul 6 08:24 tags.fact  
-rw-r–r-- 1 root root 49 Jul 6 08:32 tcpwrappers.fact  
-rwxr-xr-x 1 root root 131 Jul 6 08:24 timezone.fact\*  
-rw-r–r-- 1 root root 93 Jul 6 08:35 unattended\_upgrades.fact  
-rw-r–r-- 1 root root 39 Jul 6 08:24 uuid.fact

Cheers,

Maciej Delmanowski
