|
4 | 4 | # Configure the Podman gateway's user-namespace mode and publish it. |
5 | 5 | # |
6 | 6 | # `podman_userns_mode` is default, auto, keep-id or private. Every mode except |
7 | | -# default writes its `[openshell.drivers.podman]` settings to |
8 | | -# `/etc/openshell-test/gateway-overrides.toml`, which every installer applies to the active |
9 | | -# gateway-overrides.toml (the openshell_gateway role for `binaries`, the |
10 | | -# openshell_packaged_gateway role for the packages); default removes the file. The |
11 | | -# Podman support crate (tests/support/podman) reads the published mode and |
12 | | -# runs Podman's own reference container in it. |
| 7 | +# default adds its `[openshell.drivers.podman]` settings to the gateway |
| 8 | +# overrides (the gateway_overrides role), which every installer applies to the |
| 9 | +# gateway's configuration. Default mode adds nothing, so userns, uidmap and |
| 10 | +# gidmap stay unset. The Podman support crate (tests/support/podman) reads the |
| 11 | +# published mode and runs Podman's own reference container in it. |
13 | 12 | --- |
14 | 13 | - name: Podman user namespaces for tests |
15 | 14 | hosts: all |
16 | 15 | gather_facts: false |
17 | 16 | vars: |
18 | | - podman_userns_driver_config: /etc/openshell-test/gateway-overrides.toml |
19 | 17 | podman_userns_settings: |
20 | 18 | default: "" |
21 | 19 | auto: | |
|
43 | 41 | {{ podman_userns_settings.keys() | join(', ') }}, not |
44 | 42 | {{ podman_userns_mode | default('unset') }} |
45 | 43 |
|
46 | | - - name: Create the test configuration directory |
47 | | - become: true |
48 | | - ansible.builtin.file: |
49 | | - path: "{{ podman_userns_driver_config | dirname }}" |
50 | | - state: directory |
51 | | - owner: root |
52 | | - group: root |
53 | | - mode: "0755" |
54 | | - |
55 | 44 | - name: Write the Podman driver user-namespace settings |
56 | | - become: true |
57 | | - ansible.builtin.copy: |
58 | | - dest: "{{ podman_userns_driver_config }}" |
59 | | - content: "{{ podman_userns_settings[podman_userns_mode] }}" |
60 | | - owner: root |
61 | | - group: root |
62 | | - mode: "0644" |
| 45 | + ansible.builtin.include_role: |
| 46 | + name: gateway_overrides |
| 47 | + vars: |
| 48 | + gateway_overrides_name: podman-userns |
| 49 | + gateway_overrides_content: "{{ podman_userns_settings[podman_userns_mode] }}" |
63 | 50 | when: podman_userns_mode != "default" |
64 | 51 |
|
65 | | - # The fragment is the only source of userns, uidmap and gidmap settings in |
66 | | - # the gateway's configuration, so default mode leaves them unset. |
67 | | - - name: Remove Podman driver user-namespace settings for default mode |
68 | | - become: true |
69 | | - ansible.builtin.file: |
70 | | - path: "{{ podman_userns_driver_config }}" |
71 | | - state: absent |
72 | | - when: podman_userns_mode == "default" |
73 | | - |
74 | 52 | - name: Publish Podman user-namespace test variables |
75 | 53 | ansible.builtin.include_tasks: ../../test-env.yaml |
76 | 54 | vars: |
|
0 commit comments