On Mon, 10 Feb 2020 11:45:39 -0800 (PST)
Elb Isna <[email protected]> wrote:

> How can I use ansible to check out the software differences (installed 
> packages and configuration files)
> between two debian hosts?

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

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200210211552.4c99413b%40gmail.com.

Attachment: pgp7v1bzV0I0I.pgp
Description: OpenPGP digital signature

Reply via email to