|
34 | 34 | with_items: "{{ podman_users }}" |
35 | 35 | register: podman_user_info |
36 | 36 | become: yes |
37 | | - |
38 | | -- name: Define tmp directories on tmpfs |
39 | | - blockinfile: |
40 | | - path: /etc/tmpfiles.d/podman.conf |
41 | | - create: yes |
42 | | - block: | |
43 | | - d {{ podman_tmp_dir_root }}/{{ item.name }}/libpod/tmp 0755 {{ item.name }} {{ item.name }} |
44 | | - Z {{ podman_tmp_dir_root }}/{{ item.name }} 0755 {{ item.name }} {{ item.name }} |
45 | | - become: yes |
46 | | - loop: "{{ podman_users }}" |
47 | | - register: podman_tmp_dirs |
48 | | - |
49 | | -- name: Create tmp directories |
50 | | - command: systemd-tmpfiles --create |
51 | | - become: true |
52 | | - when: podman_tmp_dirs.results | selectattr('changed') | list | length > 0 # when: any changed |
53 | | - |
54 | | -- name: Create podman configuration directories |
55 | | - file: |
56 | | - path: "{{ item.home }}/.config/containers/" |
57 | | - state: directory |
58 | | - owner: "{{ item.name }}" |
59 | | - group: "{{ item.name }}" |
60 | | - become: yes |
61 | | - loop: "{{ podman_user_info.results }}" |
62 | | - |
63 | | -- name: Set podman to use temp directories |
64 | | - community.general.ini_file: |
65 | | - path: "{{ item.home }}/.config/containers/containers.conf" |
66 | | - section: engine |
67 | | - option: tmp_dir |
68 | | - value: '"{{ podman_tmp_dir_root }}/{{ item.name }}/libpod/tmp"' |
69 | | - owner: "{{ item.name }}" |
70 | | - group: "{{ item.name }}" |
71 | | - create: yes |
72 | | - loop: "{{ podman_user_info.results }}" |
73 | | - become: yes |
74 | | - register: podman_tmp |
75 | | - |
76 | | -- name: Reset podman database |
77 | | - # otherwise old config overrides! |
78 | | - command: |
79 | | - cmd: podman system reset --force |
80 | | - become: yes |
81 | | - become_user: "{{ item.item.name }}" |
82 | | - when: item.changed |
83 | | - loop: "{{ podman_tmp.results }}" |
84 | | - loop_control: |
85 | | - label: "{{ item.item.name }}" |
0 commit comments