diff --git a/collections/ansible_collections/demo/patching/roles/build_report_linux/templates/report.j2 b/collections/ansible_collections/demo/patching/roles/build_report_linux/templates/report.j2 index dbd7b4f..779740b 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_linux/templates/report.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_linux/templates/report.j2 @@ -77,7 +77,7 @@ collapsible: true -{% for linux_host in groups['tag_Insights']|sort %} +{% for linux_host in ansible_play_hosts |sort %}
diff --git a/collections/ansible_collections/demo/patching/roles/build_report_linux_patch/templates/report.j2 b/collections/ansible_collections/demo/patching/roles/build_report_linux_patch/templates/report.j2 index d2886c2..d6ff33c 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_linux_patch/templates/report.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_linux_patch/templates/report.j2 @@ -28,7 +28,7 @@ -{% for linux_host in groups['tag_RHEL']|sort %} +{% for linux_host in ansible_play_hosts |sort %} {{hostvars[linux_host]['inventory_hostname']}} {{hostvars[linux_host]['ansible_os_family']|default("none")}} diff --git a/linux/patching_report.yml b/linux/patching_report.yml index a85d6c8..c7c1a3c 100644 --- a/linux/patching_report.yml +++ b/linux/patching_report.yml @@ -1,13 +1,31 @@ --- -- hosts: "{{ 'reports' | default(node1) }}" +- hosts: "{{ HOSTS }}" tasks: + - name: Ensure Unix/Linux platforms only + assert: + that: ansible_os_family != "Windows" + + - name: Scan packages (Unix/Linux) + demo.patching.scan_packages: + os_family: '{{ ansible_os_family }}' + + - name: Scan services (Unix/Linux) + demo.patching.scan_services: + + block: - yum: name: httpd + state: latest - service: name: httpd state: started - include_role: - name: demo.patching.build_report_linux \ No newline at end of file + name: demo.patching.build_report_linux + + - include_role: + name: demo.patching.build_report_linux_patch + delegate_to: report_servers + run_once: yes \ No newline at end of file