Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
Comparing two hosts with ansible (installed packages and configuration files)
558 views
Skip to first unread message
Elb Isna
unread,
Feb 10, 2020, 2:45:39 PM
2/10/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
How can I use ansible to check out the software differences (installed packages and configuration files) between two debian hosts?
Vladimir Botka
unread,
Feb 10, 2020, 3:16:12 PM
2/10/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Elb Isna, ansible...@googlegroups.com
Collect the list of installed packages with "package_facts"
https://docs.ansible.com/ansible/latest/modules/package_facts_module.html#package-facts-package-information-as-facts
and use "Set theory filters" to find the differences
https://docs.ansible.com/ansible/devel/user_guide/playbooks_filters.html#set-theory-filters
For example the playbook below shall list the packages installed in
host1 but missing in host2
- hosts: host1:host2
tasks:
- package_facts:
- debug:
msg: "{{ hostvars.host1.ansible_facts.packages|
difference(hostvars.host2.ansible_facts.packages) }}"
run_once: true
HTH,
-vlado
Elb Isna
unread,
Feb 13, 2020, 11:15:41 AM
2/13/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Thank you very much for your answer.
Reply all
Reply to author
Forward
0 new messages