Get diff hosts
Exmaple reports from playbook/audit_pckg/.report
:
How to run
ansible-playbook -D playbook/audit_pckg/audit_pckg.yml -l my_host_group
Report
Reports generating in block
- name: generate html
template:
src: html.j2
dest: "{{ audit_pckg_folder_html_report }}/{{ item.key }}.html"
delegate_to: localhost
loop: "{{ compared_result['meta'] | dict2items }}"
run_once: True
Options for module
Output of module is dict
- name: compare facts
compare_facts:
services: "{{ my_services }}"
packages: "{{ my_packages }}"
mounts: "{{ my_mounts }}"
mounts_filter:
- /
- /boot
system: "{{ my_system }}"
dest_raw: "{{ audit_pckg_folder_json_raw }}"
dest_result: "{{ audit_pckg_folder_json_result }}"
register: compared_result
delegate_to: localhost
run_once: True
data
- required atleast one
services
Systemd list
- name: set global var
set_fact:
my_services: "{{ my_services | default ({}) | combine( { item: hostvars[item].ansible_facts.services} ) }}"
delegate_to: localhost
run_once: True
loop: "{{ ansible_play_hosts }}"
packages
Yum packages
- name: set global var
set_fact:
my_packages: "{{ my_packages | default ({}) | combine( { item: hostvars[item].ansible_facts.packages} ) }}"
delegate_to: localhost
run_once: True
loop: "{{ ansible_play_hosts }}"
mounts
Mount points
- name: set global var
set_fact:
my_mounts: "{{ my_mounts | default ({}) | combine( { item: hostvars[item].ansible_mounts} ) }}"
delegate_to: localhost
run_once: True
loop: "{{ ansible_play_hosts }}"
system
System release
- name: set global var
set_fact:
my_system: "{{ my_system | default ({}) | combine( { item: {hostvars[item].ansible_distribution: hostvars[item].ansible_distribution_version} }) }}"
delegate_to: localhost
run_once: True
loop: "{{ ansible_play_hosts }}"
dest_raw
- Optional Output raw json to path
- example raw packages
- example raw services
- example raw mounts
- example raw system
dest_result
-
Optional Output result json to path
mounts_filter
- Optional Filter for mount points