diff --git a/tasks/prelim.yml b/tasks/prelim.yml index c365f97..4451085 100644 --- a/tasks/prelim.yml +++ b/tasks/prelim.yml @@ -61,18 +61,18 @@ - name: Initialize the mount options variable block: - - name: Initializing the var if there is no /tmp mount - ansible.builtin.set_fact: - tmp_partition_mount_options: [] - when: "'/tmp' not in mount_names" - - - name: Initializing the var if there is a /tmp mount - ansible.builtin.set_fact: - tmp_partition_mount_options: "{{ item.options }}" - loop: "{{ ansible_facts.mounts }}" - when: - - item.mount == "/tmp" - - "'/tmp' in mount_names" + - name: Initializing the var if there is no /tmp mount + ansible.builtin.set_fact: + tmp_partition_mount_options: [] + when: "'/tmp' not in mount_names" + + - name: Initializing the var if there is a /tmp mount + ansible.builtin.set_fact: + tmp_partition_mount_options: "{{ item.options }}" + loop: "{{ ansible_facts.mounts }}" + when: + - item.mount == "/tmp" + - "'/tmp' in mount_names" tags: -always diff --git a/tasks/section_1/cis_1.1.2.x.yml b/tasks/section_1/cis_1.1.2.x.yml index 9ed201f..8b335b6 100644 --- a/tasks/section_1/cis_1.1.2.x.yml +++ b/tasks/section_1/cis_1.1.2.x.yml @@ -25,7 +25,7 @@ - name: "1.1.2.2 | PATCH | Ensure nodev option set on /tmp partition" ansible.builtin.set_fact: - tmp_partition_mount_options: "{{ tmp_partition_mount_options + [ 'nodev' ] }}" + tmp_partition_mount_options: "{{ tmp_partition_mount_options + [ 'nodev' ] }}" notify: Writing and remounting tmp when: ubtu22cis_rule_1_1_2_2 tags: @@ -38,7 +38,7 @@ - name: "1.1.2.3 | PATCH | Ensure noexec option set on /tmp partition" ansible.builtin.set_fact: - tmp_partition_mount_options: "{{ tmp_partition_mount_options + [ 'noexec' ] }}" + tmp_partition_mount_options: "{{ tmp_partition_mount_options + [ 'noexec' ] }}" notify: Writing and remounting tmp when: ubtu22cis_rule_1_1_2_3 tags: @@ -51,7 +51,7 @@ - name: "1.1.2.4 | PATCH | Ensure nosuid option set on /tmp partition" ansible.builtin.set_fact: - tmp_partition_mount_options: "{{ tmp_partition_mount_options + [ 'nosuid' ] }}" + tmp_partition_mount_options: "{{ tmp_partition_mount_options + [ 'nosuid' ] }}" notify: Writing and remounting tmp when: ubtu22cis_rule_1_1_2_4 tags: