Skip to content

Commit

Permalink
added notification as well
Browse files Browse the repository at this point in the history
  • Loading branch information
adworjan committed Aug 30, 2023
1 parent a55e1f7 commit 4885861
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .ansible-sign/sha256sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ a8a29037770b73ab1e0ad0f05ae721e6430d7cc732dabbe22320840483fa8080 alertmanager.y
b30ff084240d998e18bedf88c056f3b438205fef6bfe22d7e1cd663d83ad191b nodeexporter_stop.yml
8f9129583653af0ef47a35e953bd3a2f8ac996c734f0a84f7418cfebae933bd9 passwd_restore.yml
6a584e1238c230b215f1231a8875aadcac9465af36b54d3bd23e4eb2677acb59 roles/insights_cve/defaults/main.yml
4bf8aa42aa83349b4e61d76fdf6cc47a8580157e320b46d22ad910587b9e0f04 roles/insights_cve/tasks/main.yml
102c3cf87fa224ae59988d1b5bef6d3b5b8f074bf8cc809f0f7df872b970ef58 roles/insights_cve/tasks/remediation.yml
9eb104724608c9825164d4d76944a04803d65dd5649b1ab54b5673fc7443c4c5 roles/insights_cve/tasks/main.yml
ff97aef329270a2f19e0683fd83259fc483c469e7e75812cf2a57251faaa9f62 roles/insights_cve/tasks/remediation.yml
0bf80df4832bf561f376710842e657ac6224d2f84d60b8f1d6abd888f6df3479 roles/insights_cve/templates/pb_generator_body.j2
10831b191942119573948bc7eb9779879207c25a8deb6bc7d1e1153bfdfec3f6 roles/servicenow_ticket/defaults/main.yml
53bf49b79f8124b6e21231b5c110679de1fb9a2ad0d3d60322af29c2f588eef5 roles/servicenow_ticket/tasks/main.yml
Expand Down
22 changes: 11 additions & 11 deletions .ansible-sign/sha256sum.txt.sig
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-----BEGIN PGP SIGNATURE-----

iQGzBAABCAAdFiEE/bJvyFHKKJdaZDOLTiIiIXrUDNEFAmTva/4ACgkQTiIiIXrU
DNHRBAv+IfnRH66+JLN98q/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GplrCUtwvHH6x0Ju3JjWIlqD
isI/m+nS
=WykH
-----END PGP SIGNATURE-----
65 changes: 1 addition & 64 deletions roles/insights_cve/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,75 +105,12 @@
project: "Red Hat Insights"
timeout: 60

- name: Include remediation tasks
- name: Perform remediation tasks using AAP
ansible.builtin.include_tasks: remediation.yml
loop: "{{ cve_list | first | split }}"
loop_control:
index_var: my_idx

# - name: Insights | Create playbooks locally
# ansible.builtin.copy:
# dest: "{{ playbook_dir }}/{{ item.item }}-remediation-{{ insights_adv_target_host }}.yml"
# content: "{{ item.content }}"
# mode: "0755"
# loop: "{{ pbs_per_host.results }}"
# delegate_to: localhost

# - name: Run CVE remediation playbook on "{{ insights_adv_target_host }}"
# ansible.builtin.shell:
# cmd: ansible-playbook -i azure_rm.yml -e ansible_user="{{ ansible_user }}" -e ansible_password="{{ ansible_password }}" "{{ playbook_dir }}/{{ item.item }}-remediation-{{ insights_adv_host_data.display_name }}.yml"
# loop: "{{ pbs_per_host.results.id }}"
# when:
# - hostvars[inventory_hostname].insights_provider_type == 'azure'
# - ansible_os_family == 'RedHat'
# - ansible_facts['distribution'] == "RedHat"
# delegate_to: localhost

# - name: Run CVE remediation playbook on "{{ insights_adv_target_host }}"
# ansible.builtin.shell:
# cmd: ansible-playbook -i aws_ec2.yml -e ansible_user="{{ ansible_user }}" -e ansible_ssh_private_key_file="/runner/artifacts/{{ tower_job_id }}/ssh_key_data" "{{ playbook_dir }}/{{ item.item }}-remediation-{{ insights_adv_host_data.display_name }}.yml"
# loop: "{{ pbs_per_host.results }}"
# when:
# - hostvars[inventory_hostname].insights_provider_type == 'aws'
# - ansible_os_family == 'RedHat'
# - ansible_facts['distribution'] == "RedHat"
# - ansible_password is not defined
# delegate_to: localhost

# - name: Run CVE remediation playbook on "{{ insights_adv_target_host }}"
# ansible.builtin.shell:
# cmd: ansible-playbook -i aws_ec2.yml -e ansible_user="{{ ansible_user }}" -e ansible_password="{{ ansible_password }}" "{{ playbook_dir }}/{{ item.item }}-remediation-{{ insights_adv_host_data.display_name }}.yml"
# loop: "{{ pbs_per_host.results }}"
# when:
# - hostvars[inventory_hostname].insights_provider_type == 'aws'
# - ansible_os_family == 'RedHat'
# - ansible_facts['distribution'] == "RedHat"
# - ansible_password is defined
# delegate_to: localhost

# - name: Send notification message via Mattermost of CVE resolved
# community.general.mattermost:
# url: "{{ mattermost_url }}"
# api_key: "{{ mattermost_api_key }}"
# attachments:
# - text: "! ALERT !"
# color: '#ff00dd'
# title: "CVE Issue"
# fields:
# - title: Issue
# value: "CVE Issue Resolved"
# short: true
# - title: Details
# value: "CVE {{ item.item }} resolved on host {{ insights_adv_target_host }}."
# short: true
# loop: "{{ pbs_per_host.results }}"
# when:
# - hostvars[inventory_hostname].insights_provider_type == 'aws'
# - ansible_os_family == 'RedHat'
# - ansible_facts['distribution'] == "RedHat"
# - ansible_password is defined
# delegate_to: localhost

- name: If no CVE_list
when: cve_list is not defined
block:
Expand Down
17 changes: 17 additions & 0 deletions roles/insights_cve/tasks/remediation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,20 @@
name: "Insights Remediation"
wait: true
delegate_to: localhost

- name: Send notification message via Mattermost of CVE resolved
community.general.mattermost:
url: "{{ mattermost_url }}"
api_key: "{{ mattermost_api_key }}"
attachments:
- text: "! ALERT !"
color: '#ff00dd'
title: "CVE Issue"
fields:
- title: Issue
value: "CVE Issue Resolved"
short: true
- title: Details
value: "CVE {{ item }} resolved on host {{ insights_adv_target_host }}."
short: true
delegate_to: localhost

0 comments on commit 4885861

Please sign in to comment.