Showing which roles have been run on a machine

13 views
Skip to first unread message

Gabriel Forster

unread,
Jul 6, 2017, 9:10:18 AM7/6/17
to Ansible Project
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?

Maciej Delmanowski

unread,
Jul 6, 2017, 9:16:00 AM7/6/17
to ansible...@googlegroups.com
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

--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/02e44b99-f048-469b-a24b-f92413c44766%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages