forked from ansible-lockdown/RHEL9-CIS
with_items to loop
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
3c33ce5056
commit
466e88613e
8 changed files with 9 additions and 15 deletions
|
|
@ -11,7 +11,7 @@
|
||||||
- name: "PRELIM | 5.5.2 | 6.2.7 | 6.2.8 | 6.2.20 | Split passwd entries"
|
- name: "PRELIM | 5.5.2 | 6.2.7 | 6.2.8 | 6.2.20 | Split passwd entries"
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
rhel9cis_passwd: "{{ rhel9cis_passwd_file_audit.stdout_lines | map('regex_replace', ld_passwd_regex, ld_passwd_yaml) | map('from_yaml') | list }}"
|
rhel9cis_passwd: "{{ rhel9cis_passwd_file_audit.stdout_lines | map('regex_replace', ld_passwd_regex, ld_passwd_yaml) | map('from_yaml') | list }}"
|
||||||
with_items: "{{ rhel9cis_passwd_file_audit.stdout_lines }}"
|
loop: "{{ rhel9cis_passwd_file_audit.stdout_lines }}"
|
||||||
vars:
|
vars:
|
||||||
ld_passwd_regex: >-
|
ld_passwd_regex: >-
|
||||||
^(?P<id>[^:]*):(?P<password>[^:]*):(?P<uid>[^:]*):(?P<gid>[^:]*):(?P<gecos>[^:]*):(?P<dir>[^:]*):(?P<shell>[^:]*)
|
^(?P<id>[^:]*):(?P<password>[^:]*):(?P<uid>[^:]*):(?P<gid>[^:]*):(?P<gecos>[^:]*):(?P<dir>[^:]*):(?P<shell>[^:]*)
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@
|
||||||
state: present
|
state: present
|
||||||
opts: defaults,{% if rhel9cis_rule_1_1_2_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_2_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_2_4 %}nosuid{% endif %}
|
opts: defaults,{% if rhel9cis_rule_1_1_2_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_2_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_2_4 %}nosuid{% endif %}
|
||||||
notify: Remount tmp
|
notify: Remount tmp
|
||||||
with_items:
|
loop: "{{ ansible_mounts }}"
|
||||||
- "{{ ansible_mounts }}"
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.device }}"
|
label: "{{ item.device }}"
|
||||||
when:
|
when:
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@
|
||||||
fstype: "{{ item.fstype }}"
|
fstype: "{{ item.fstype }}"
|
||||||
state: present
|
state: present
|
||||||
opts: defaults,{% if rhel9cis_rule_1_1_3_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_3_3 %}nosuid,{% endif %}
|
opts: defaults,{% if rhel9cis_rule_1_1_3_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_3_3 %}nosuid,{% endif %}
|
||||||
with_items:
|
loop: "{{ ansible_mounts }}"
|
||||||
- "{{ ansible_mounts }}"
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.device }}"
|
label: "{{ item.device }}"
|
||||||
notify: Change_requires_reboot
|
notify: Change_requires_reboot
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@
|
||||||
fstype: "{{ item.fstype }}"
|
fstype: "{{ item.fstype }}"
|
||||||
state: present
|
state: present
|
||||||
opts: defaults,{% if rhel9cis_rule_1_1_4_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_4_3 %}nosuid,{% endif %}{% if rhel9cis_rule_1_1_4_4 %}nodev{% endif %}
|
opts: defaults,{% if rhel9cis_rule_1_1_4_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_4_3 %}nosuid,{% endif %}{% if rhel9cis_rule_1_1_4_4 %}nodev{% endif %}
|
||||||
with_items:
|
loop: "{{ ansible_mounts }}"
|
||||||
- "{{ ansible_mounts }}"
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.device }}"
|
label: "{{ item.device }}"
|
||||||
notify: Change_requires_reboot
|
notify: Change_requires_reboot
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@
|
||||||
fstype: "{{ item.fstype }}"
|
fstype: "{{ item.fstype }}"
|
||||||
state: present
|
state: present
|
||||||
opts: defaults,{% if rhel9cis_rule_1_1_5_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_5_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_5_4 %}nosuid{% endif %}
|
opts: defaults,{% if rhel9cis_rule_1_1_5_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_5_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_5_4 %}nosuid{% endif %}
|
||||||
with_items:
|
loop: "{{ ansible_mounts }}"
|
||||||
- "{{ ansible_mounts }}"
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.device }}"
|
label: "{{ item.device }}"
|
||||||
notify: Change_requires_reboot
|
notify: Change_requires_reboot
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@
|
||||||
fstype: "{{ item.fstype }}"
|
fstype: "{{ item.fstype }}"
|
||||||
state: present
|
state: present
|
||||||
opts: defaults,{% if rhel9cis_rule_1_1_6_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_6_3 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_6_4 %}nosuid{% endif %}
|
opts: defaults,{% if rhel9cis_rule_1_1_6_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_6_3 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_6_4 %}nosuid{% endif %}
|
||||||
with_items:
|
loop: "{{ ansible_mounts }}"
|
||||||
- "{{ ansible_mounts }}"
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.device }}"
|
label: "{{ item.device }}"
|
||||||
notify: Change_requires_reboot
|
notify: Change_requires_reboot
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@
|
||||||
fstype: "{{ item.fstype }}"
|
fstype: "{{ item.fstype }}"
|
||||||
state: present
|
state: present
|
||||||
opts: defaults,{% if rhel9cis_rule_1_1_7_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_7_3 %}nosuid,{% endif %}
|
opts: defaults,{% if rhel9cis_rule_1_1_7_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_7_3 %}nosuid,{% endif %}
|
||||||
with_items:
|
loop: "{{ ansible_mounts }}"
|
||||||
- "{{ ansible_mounts }}"
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.device }}"
|
label: "{{ item.device }}"
|
||||||
notify: Change_requires_reboot
|
notify: Change_requires_reboot
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: Reload dconf
|
notify: Reload dconf
|
||||||
with_items:
|
loop:
|
||||||
- { regexp: 'user-db', line: 'user-db:user' }
|
- { regexp: 'user-db', line: 'user-db:user' }
|
||||||
- { regexp: 'system-db', line: 'system-db:gdm' }
|
- { regexp: 'system-db', line: 'system-db:gdm' }
|
||||||
- { regexp: 'file-db', line: 'file-db:/usr/share/gdm/greeter-dconf-defaults' }
|
- { regexp: 'file-db', line: 'file-db:/usr/share/gdm/greeter-dconf-defaults' }
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: Reload dconf
|
notify: Reload dconf
|
||||||
with_items:
|
loop:
|
||||||
- { file: '/etc/dconf/profile/gdm', regexp: 'user-db', line: 'user-db:user' }
|
- { file: '/etc/dconf/profile/gdm', regexp: 'user-db', line: 'user-db:user' }
|
||||||
- { file: '/etc/dconf/profile/gdm', regexp: 'system-db', line: 'system-db:gdm' }
|
- { file: '/etc/dconf/profile/gdm', regexp: 'system-db', line: 'system-db:gdm' }
|
||||||
- { file: '/etc/dconf/profile/gdm', regexp: 'file-db', line: 'file-db:/usr/share/gdm/greeter-dconf-defaults'}
|
- { file: '/etc/dconf/profile/gdm', regexp: 'file-db', line: 'file-db:/usr/share/gdm/greeter-dconf-defaults'}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue