Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rootless systemd service #56

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
- name: "Ensure volume directories exist for {{ container_name }}"
ansible.builtin.include_tasks: create_container_volume.yml
loop: "{{ container_run_args | regex_findall('-v ([^:]*)') }}"
when:
when:
- container_image_list is defined and container_image_list | length == 1
- container_run_args is defined and container_run_args | length > 0
- container_pod_yaml is undefined
Expand All @@ -199,8 +199,8 @@
template:
src: systemd-service-single.j2
dest: "{{ service_files_dir }}/{{ service_name }}"
owner: root
group: root
owner: "{{ container_run_as_user }}"
group: "{{ container_run_as_group }}"
mode: 0644
become: true
become_user: "{{ container_run_as_user }}"
Expand Down Expand Up @@ -233,6 +233,18 @@
- service_file_before_template.stat.exists
- service_file.changed

- name: Provide auto update to rootless
become: true
become_user: "{{ container_run_as_user }}"
file:
src: "/lib/systemd/system/{{ item }}"
dest: "{{ service_files_dir }}/{{ item }}"
state: link
with_items:
- podman-auto-update.timer
- podman-auto-update.service
when: container_run_as_user != "root"

- name: ensure auto update is running for images
become: true
become_user: "{{ container_run_as_user }}"
Expand Down