This commit is contained in:
Matthew Fernandez
2025-08-11 15:02:13 -06:00
committed by GitHub
parent a0fd566f2a
commit cc1fa209e2
25 changed files with 85 additions and 93 deletions

View File

@@ -8,12 +8,12 @@
check_mode: false
- name: Upgrade packages (yum)
ansible.builtin.yum:
ansible.legacy.dnf:
name: '*'
state: latest # noqa: package-latest - Intended to update packages to latest
exclude: "{{ exclude_packages }}"
when: ansible_pkg_mgr == "yum"
register: patchingresult_yum
register: patch_linux_patchingresult_yum
- name: Upgrade packages (dnf)
ansible.builtin.dnf:
@@ -21,17 +21,17 @@
state: latest # noqa: package-latest - Intended to update packages to latest
exclude: "{{ exclude_packages }}"
when: ansible_pkg_mgr == "dnf"
register: patchingresult_dnf
register: patch_linux_patchingresult_dnf
- name: Check to see if we need a reboot
ansible.builtin.command: needs-restarting -r
register: result
changed_when: result.rc == 1
failed_when: result.rc > 1
register: patch_linux_result
changed_when: patch_linux_result.rc == 1
failed_when: patch_linux_result.rc > 1
check_mode: false
- name: Reboot Server if Necessary
ansible.builtin.reboot:
when:
- result.rc == 1
- patch_linux_result.rc == 1
- allow_reboot

View File

@@ -12,4 +12,4 @@
category_names: "{{ win_update_categories | default(omit) }}"
reboot: "{{ allow_reboot }}"
state: installed
register: patchingresult
register: patch_windows_patchingresult

View File

@@ -35,17 +35,17 @@
<td>{{hostvars[linux_host]['ansible_distribution_version']|default("none")}}</td>
<td>
<ul>
{% if hostvars[linux_host].patchingresult_yum.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patchingresult_yum.changes.updated|sort %}
{% if hostvars[linux_host].patch_linux_patchingresult_yum.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patch_linux_patchingresult_yum.changes.updated|sort %}
<li> {{ packagename[0] }} - {{ packagename[1] }} </li>
{% endfor %}
{% elif hostvars[linux_host].patchingresult_dnf.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patchingresult_dnf.results|sort %}
{% elif hostvars[linux_host].patch_linux_patchingresult_dnf.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patch_linux_patchingresult_dnf.results|sort %}
<li> {{ packagename }} </li>
{% endfor %}
{% elif hostvars[linux_host].patchingresult_dnf.changed is undefined %}
{% elif hostvars[linux_host].patch_linux_patchingresult_dnf.changed is undefined %}
<li> Patching Failed </li>
{% elif hostvars[linux_host].patchingresult_yum.changed is undefined %}
{% elif hostvars[linux_host].patch_linux_patchingresult_yum.changed is undefined %}
<li> Patching Failed </li>
{% else %}
<li> Compliant </li>

View File

@@ -13,10 +13,10 @@
state: present
namespace: patching-report
definition: "{{ lookup('ansible.builtin.template', 'resources.yaml.j2') }}"
register: resources_output
register: report_ocp_patching_resources_output
- name: Display link to patching report
ansible.builtin.debug:
msg:
- "Patching report availbable at:"
- "{{ resources_output.result.results[3].result.spec.port.targetPort }}://{{ resources_output.result.results[3].result.spec.host }}"
- "{{ report_ocp_patching_resources_output.result.results[3].result.spec.port.targetPort }}://{{ report_ocp_patching_resources_output.result.results[3].result.spec.host }}"

View File

@@ -35,17 +35,17 @@
<td>{{hostvars[linux_host]['ansible_distribution_version']|default("none")}}</td>
<td>
<ul>
{% if hostvars[linux_host].patchingresult_yum.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patchingresult_yum.changes.updated|sort %}
{% if hostvars[linux_host].patch_linux_patchingresult_yum.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patch_linux_patchingresult_yum.changes.updated|sort %}
<li> {{ packagename[0] }} - {{ packagename[1] }} </li>
{% endfor %}
{% elif hostvars[linux_host].patchingresult_dnf.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patchingresult_dnf.results|sort %}
{% elif hostvars[linux_host].patch_linux_patchingresult_dnf.changed|default("false",true) == true %}
{% for packagename in hostvars[linux_host].patch_linux_patchingresult_dnf.results|sort %}
<li> {{ packagename }} </li>
{% endfor %}
{% elif hostvars[linux_host].patchingresult_dnf.changed is undefined %}
{% elif hostvars[linux_host].patch_linux_patchingresult_dnf.changed is undefined %}
<li> Patching Failed </li>
{% elif hostvars[linux_host].patchingresult_yum.changed is undefined %}
{% elif hostvars[linux_host].patch_linux_patchingresult_yum.changed is undefined %}
<li> Patching Failed </li>
{% else %}
<li> Compliant </li>

View File

@@ -3,7 +3,7 @@
ansible.builtin.include_vars: "{{ ansible_system }}.yml"
- name: Install httpd package
ansible.builtin.yum:
ansible.builtin.dnf:
name: httpd
state: installed
check_mode: false

View File

@@ -6,7 +6,7 @@
ansible.builtin.find:
paths: "{{ doc_root }}/{{ reports_dir }}"
patterns: '*.html'
register: reports
register: report_server_reports
check_mode: false
- name: Publish landing page

View File

@@ -6,7 +6,7 @@
ansible.windows.win_find:
paths: "{{ doc_root }}/{{ reports_dir }}"
patterns: '*.html'
register: reports
register: report_server_reports
check_mode: false
- name: Publish landing page

View File

@@ -20,7 +20,7 @@
</center>
<table class="table table-striped mt32 main_net_table">
<tbody>
{% for report in reports.files %}
{% for report in report_server_reports.files %}
{% set page = report.path.split('/')[-1] %}
<tr>
<td class="summary_info">

View File

@@ -20,7 +20,7 @@
</center>
<table class="table table-striped mt32 main_net_table">
<tbody>
{% for report in reports.files %}
{% for report in report_server_reports.files %}
{% set page = report.path.split('\\')[-1] %}
<tr>
<td class="summary_info">