Skip to content

Commit

Permalink
ansible: Properly set podman.socket group
Browse files Browse the repository at this point in the history
The `ExecStartPre=` was a quick hack, but it goes against the declared
system state and e.g. doesn't survive restarts of `podman.socket`.
Declare that properly with a unit drop-in.
  • Loading branch information
martinpitt committed Mar 13, 2024
1 parent 035107a commit 956ff20
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 14 additions & 0 deletions ansible/roles/tasks-systemd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@
maxsockets=3
cafile=/run/secrets/tasks/npm-registry.crt
- name: Create podman.socket drop-in directory
file:
path: /etc/systemd/system/podman.socket.d
state: directory

# idmapped mount would be better, but did not figure out how
- name: Allow access to podman.socket to unprivileged container user
copy:
dest: /etc/systemd/system/podman.socket.d/container-access.conf
mode: 0644
content: |
[Socket]
SocketGroup=cockpituous
- name: Create job-runner configuration
copy:
dest: /etc/job-runner.toml
Expand Down
2 changes: 0 additions & 2 deletions tasks/install-service
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ ExecStartPre=-/usr/bin/podman network rm cockpit-tasks-%i
ExecStartPre=/usr/bin/chcon -R -l s0 \${TEST_CACHE}/images/
ExecStartPre=/usr/bin/flock /tmp/cockpit-image-pull podman pull quay.io/cockpit/tasks
ExecStartPre=/usr/bin/podman network create cockpit-tasks-%i
# idmapped mount would be better, but did not figure out how
ExecStartPre=/usr/bin/chgrp cockpituous %t/podman/podman.sock
ExecStart=/usr/bin/podman run --name=cockpit-tasks-%i --hostname=${CONTAINER_HOSTNAME} \
--device=/dev/kvm --network=cockpit-tasks-%i \
--memory=24g --pids-limit=16384 --shm-size=1024m ${TMPVOL:-} \
Expand Down

0 comments on commit 956ff20

Please sign in to comment.