--- - name: "1.1.2.1 | PATCH | Ensure /tmp is a separate partition" block: - name: "1.1.2.1 | PATCH | Ensure /tmp is a separate partition | Absent" ansible.builtin.debug: msg: "Warning!! {{ required_mount }} doesn't exist. This is a manual task" - name: "1.1.2.1 | PATCH | Ensure /tmp is a separate partition | warning" ansible.builtin.import_tasks: warning_facts.yml vars: warn_control_id: '1.1.2.1' required_mount: '/tmp' when: - required_mount not in mount_names - rhel9cis_rule_1_1_2_1 tags: - level1-server - level1-workstation - audit - mounts - rule_1.1.2.1 # via fstab - name: | "1.1.2.2 | PATCH | Ensure nodev option set on /tmp partition" "1.1.2.3 | PATCH | Ensure noexec option set on /tmp partition" "1.1.2.4 | PATCH | Ensure nosuid option set on /tmp partition" ansible.builtin.mount: name: /tmp src: "{{ item.device }}" fstype: "{{ item.fstype }}" 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 %} notify: Remount tmp with_items: - "{{ ansible_mounts }}" loop_control: label: "{{ item.device }}" when: - item.mount == "/tmp" - not rhel9cis_tmp_svc - rhel9cis_rule_1_1_2_2 or rhel9cis_rule_1_1_2_3 or rhel9cis_rule_1_1_2_4 tags: - level1-server - level1-workstation - patch - mounts - rule_1.1.2.2 - rule_1.1.2.3 - rule_1.1.2.4 # via systemd - name: | "1.1.2.1 | PATCH | Ensure /tmp is configured" "1.1.2.2 | PATCH | Ensure nodev option set on /tmp partition" "1.1.2.3 | PATCH | Ensure noexec option set on /tmp partition" "1.1.2.4 | PATCH | Ensure nosuid option set on /tmp partition" ansible.builtin.template: src: etc/systemd/system/tmp.mount.j2 dest: /etc/systemd/system/tmp.mount owner: root group: root mode: 0644 notify: Systemd restart tmp.mount when: - rhel9cis_tmp_svc - rhel9cis_rule_1_1_2_1 or rhel9cis_rule_1_1_2_2 or rhel9cis_rule_1_1_2_3 or rhel9cis_rule_1_1_2_4 tags: - level1-server - level1-workstation - patch - mounts - rule_1.1.2.1 - rule_1.1.2.2 - rule_1.1.2.3 - rule_1.1.2.4