4
0
Fork 0
RHEL9-CIS/tasks/section_1/cis_1.2.x.yml
Mark Bolwell 39780562c1
section 1 updates
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
2022-04-04 12:07:07 +01:00

86 lines
2.5 KiB
YAML

---
- name: "1.2.1 | PATCH | Ensure Red Hat Subscription Manager connection is configured"
redhat_subscription:
state: present
username: "{{ rhel9cis_rh_sub_user }}"
password: "{{ rhel9cis_rh_sub_password }}"
auto_attach: true
no_log: true
when:
- ansible_distribution == "RedHat"
- rhel9cis_rhnsd_required
- rhel9cis_rule_1_2_1
tags:
- level1-server
- level1-workstation
- manual
- patch
- rule_1.2.1
- skip_ansible_lint # Added as no_log still errors on ansuible-lint
- name: "1.2.2 | AUDIT | Ensure GPG keys are configured"
command: gpg --quiet --with-fingerprint "{{ rpm_gpg_key }}"
when:
- rhel9cis_rule_1_2_2
- ansible_distribution == "RedHat" or
ansible_distribution == "Rocky"
tags:
- level1-server
- level1-workstation
- manual
- patch
- rule_1.2.2
- name: "1.2.3| PATCH | Ensure gpgcheck is globally activated"
block:
- name: "1.2.3 | AUDIT | Ensure gpgcheck is globally activated | Find repos"
find:
paths: /etc/yum.repos.d
patterns: "*.repo"
register: yum_repos
changed_when: false
- name: "1.2.3 | PATCH | Ensure gpgcheck is globally activated | Update yum.repos"
replace:
name: "{{ item.path }}"
regexp: "^gpgcheck\s*=\s*0"
replace: "gpgcheck=1"
with_items:
- "{{ yum_repos.files }}"
loop_control:
label: "{{ item.path }}"
when:
- rhel9cis_rule_1_2_3
tags:
- level1-server
- level1-workstation
- automated
- patch
- rule_1.2.3
- name: "1.2.4 | AUDIT | Ensure package manager repositories are configured"
block:
- name: "1.2.4 | AUDIT | Ensure package manager repositories are configured | Get repo list"
command: dnf repolist
changed_when: false
failed_when: false
register: dnf_configured
check_mode: no
args:
warn: false
- name: "1.2.4 | AUDIT | Ensure package manager repositories are configured | Display repo list"
debug:
msg:
- "Alert! Below are the configured repos. Please review and make sure all align with site policy"
- "{{ dnf_configured.stdout_lines }}"
when:
- rhel9cis_rule_1_2_4
tags:
- level1-server
- level1-workstation
- manual
- audit
- rule_1.2.4
- skip_ansible_lint