-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes a problem with the podman socket not being readable by the podman user ("gitlab-runner").
- Loading branch information
Showing
5 changed files
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,23 @@ | ||
--- | ||
- name: collect facts about system services | ||
service_facts: | ||
register: services_state | ||
- name: "Define some facts" | ||
include_tasks: | ||
file: "../../../tasks/facts.yml" | ||
|
||
- name: "Check the status of systemd service Podman" | ||
assert: | ||
that: | ||
- services_state.ansible_facts.services['podman.service'].status == "enabled" | ||
|
||
- name: "Check the Podman socket" | ||
become: true | ||
stat: | ||
path: "/var/run/podman/podman.sock" | ||
register: podman_sock | ||
|
||
- name: "Check that the Podman socket file exists" | ||
assert: | ||
that: | ||
- podman_sock.stat.exists is true | ||
|
||
- name: "Read the file ACL for the Podman socket" | ||
- name: > | ||
Run a command that checks the state of the podman.socket service | ||
for {{ podman_user }} | ||
become: true | ||
acl: | ||
path: "/var/run/podman/podman.sock" | ||
register: acl_info | ||
become_user: "{{ podman_user }}" | ||
command: | ||
cmd: "systemctl --user status podman.socket" | ||
register: systemd_status_out | ||
environment: | ||
# Required for user execution - here we use the UID of the `podman_user` | ||
XDG_RUNTIME_DIR: "/run/user/{{ podman_user_uid }}" | ||
|
||
- name: "Check that the ACL contains a RW permission for the gitlab-runner user" | ||
- name: > | ||
Check that the user podman.socket systemd service is running and listening | ||
for {{ podman_user}} | ||
assert: | ||
that: | ||
- "{{ 'user:gitlab-runner:rw-' in acl_info.acl }}" | ||
- "'Active: active (listening)' in systemd_status_out.stdout" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: "Examine the database of users so we can extract the UID later" | ||
getent: | ||
database: "passwd" | ||
register: getent_out | ||
|
||
- name: "Set the user UID fact" | ||
set_fact: | ||
podman_user_uid: "{{ getent_out['ansible_facts']['getent_passwd'][podman_user].1 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters