Skip to content

Commit 5a56cf6

Browse files
authored
Merge pull request #794 from konstruktoid/tmp
let `manage_mounts` handle /tmp
2 parents 6b8984f + 8957d78 commit 5a56cf6

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ process_group: root
621621
If `manage_mounts: true`, `/proc` will be mounted with the
622622
`nosuid,nodev,noexec,hidepid` options,
623623
`/dev/shm` will be mounted with the `nosuid,nodev,noexec` options and `/tmp`
624-
will be mounted with the `nosuid,nodev,noexec` options using the available
625-
template.
624+
will be mounted as `tmpfs` with the `nosuid,nodev,noexec` options using the
625+
available template.
626626

627627
`hide_pid` sets `/proc/<pid>/` access mode.
628628

tasks/fstab.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
---
2-
- name: Remove /tmp from fstab
3-
become: true
4-
ansible.posix.mount:
5-
path: /tmp
6-
state: absent
7-
82
- name: Remove floppy from fstab
93
become: true
104
ansible.builtin.lineinfile:

tasks/mount.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,40 @@
2424
when:
2525
- dev_shm.stat.exists
2626

27-
- name: Add systemd tmp.mount
27+
- name: Configure /tmp mount
2828
become: true
29-
ansible.builtin.template:
30-
src: "{{ tmp_mount_template }}"
31-
dest: /etc/systemd/system/tmp.mount
32-
backup: true
33-
mode: "0644"
34-
owner: root
35-
group: root
29+
block:
30+
- name: Add systemd tmp.mount
31+
ansible.builtin.template:
32+
src: "{{ tmp_mount_template }}"
33+
dest: /etc/systemd/system/tmp.mount
34+
backup: true
35+
mode: "0644"
36+
owner: root
37+
group: root
3638

37-
- name: Stat tmp.mount
38-
ansible.builtin.stat:
39-
path: /etc/systemd/system/tmp.mount
40-
register: tmp_mount
39+
- name: Stat tmp.mount
40+
ansible.builtin.stat:
41+
path: /etc/systemd/system/tmp.mount
42+
register: tmp_mount
4143

4244
- name: Unmask and start tmp.mount
4345
become: true
4446
when:
4547
- tmp_mount.stat.exists
4648
- ansible_virtualization_type not in ["container", "docker", "podman"]
4749
block:
50+
- name: Remove /tmp from fstab
51+
ansible.posix.mount:
52+
path: /tmp
53+
state: absent
54+
4855
- name: Unmask tmp.mount
49-
become: true
5056
ansible.builtin.systemd:
5157
name: tmp.mount
5258
masked: false
5359

5460
- name: Start tmp.mount
55-
become: true
5661
ansible.builtin.systemd:
5762
name: tmp.mount
5863
daemon_reload: true

0 commit comments

Comments
 (0)