Start podman restart service in user role

This commit is contained in:
Thomas Kleinendorst 2024-04-23 17:12:06 +02:00
parent 16c78c0d00
commit b1ff2515e1
4 changed files with 13 additions and 16 deletions

View file

@ -5,6 +5,7 @@
vars: vars:
user_username: "{{ actual_username }}" user_username: "{{ actual_username }}"
user_password: "{{ actual_password }}" user_password: "{{ actual_password }}"
user_use_podman_restart: true
- name: Create a directory for holding actual's (volume) data - name: Create a directory for holding actual's (volume) data
become: true become: true
become_user: "{{ actual_username }}" become_user: "{{ actual_username }}"
@ -12,14 +13,6 @@
path: "/home/{{ actual_username }}/actual_data" path: "/home/{{ actual_username }}/actual_data"
state: directory state: directory
mode: '0700' mode: '0700'
- name: Start the podman-restart.service
become: true
become_user: "{{ actual_username }}"
ansible.builtin.systemd:
name: podman-restart.service
state: started
enabled: true
scope: user
- name: Gather facts on the actual container - name: Gather facts on the actual container
become: true become: true
become_user: "{{ actual_username }}" become_user: "{{ actual_username }}"

View file

@ -5,6 +5,7 @@
vars: vars:
user_username: "{{ pi_hole_username }}" user_username: "{{ pi_hole_username }}"
user_password: "{{ pi_hole_password }}" user_password: "{{ pi_hole_password }}"
user_use_podman_restart: true
- name: Create the /etc-pihole directory in the home directory (will be mounted to the container) - name: Create the /etc-pihole directory in the home directory (will be mounted to the container)
become: true become: true
become_user: "{{ pi_hole_username }}" become_user: "{{ pi_hole_username }}"
@ -34,14 +35,6 @@
# changes the user of the folder to a UID only known within the container. This command basically doesn't need to # changes the user of the folder to a UID only known within the container. This command basically doesn't need to
# change anything at this point so we'll ignore the error for now. # change anything at this point so we'll ignore the error for now.
- "'set_mode_if_different' not in command_result.module_stdout" - "'set_mode_if_different' not in command_result.module_stdout"
- name: Start the podman-restart.service
become: true
become_user: "{{ pi_hole_username }}"
ansible.builtin.systemd:
name: podman-restart.service
state: started
enabled: true
scope: user
- name: Gather facts on the pi-hole container - name: Gather facts on the pi-hole container
become: true become: true
become_user: "{{ pi_hole_username }}" become_user: "{{ pi_hole_username }}"

View file

@ -115,3 +115,12 @@
ansible.builtin.user: ansible.builtin.user:
name: "{{ target_user }}" name: "{{ target_user }}"
shell: /usr/bin/zsh shell: /usr/bin/zsh
- name: Start the podman-restart.service
become: true
become_user: "{{ target_user }}"
ansible.builtin.systemd:
name: podman-restart.service
state: started
enabled: true
scope: user
when: user_use_podman_restart

View file

@ -0,0 +1,2 @@
---
user_use_podman_restart: false