From 08cf93276d55c37a3441a70e31094e75183d48d9 Mon Sep 17 00:00:00 2001 From: Thomas Kleinendorst Date: Wed, 5 Jun 2024 17:00:11 +0200 Subject: [PATCH] Move "podman-restart" to the podman-container role --- roles/actual/tasks/main.yml | 1 - roles/changedetection/tasks/main.yml | 1 - roles/pi-hole/tasks/main.yml | 1 - roles/podman-container/tasks/main.yml | 7 +++++++ roles/user/tasks/main.yml | 9 --------- roles/user/vars/main/defaults.yml | 2 -- 6 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 roles/user/vars/main/defaults.yml diff --git a/roles/actual/tasks/main.yml b/roles/actual/tasks/main.yml index dee4de3..a962fb9 100644 --- a/roles/actual/tasks/main.yml +++ b/roles/actual/tasks/main.yml @@ -5,7 +5,6 @@ vars: user_username: "{{ actual_username }}" user_password: "{{ actual_password }}" - user_start_podman_restart: true # TODO: Remove this and move it to the podman-container role - name: Create the actual container ansible.builtin.include_role: name: podman-container diff --git a/roles/changedetection/tasks/main.yml b/roles/changedetection/tasks/main.yml index da69caa..9b507a7 100644 --- a/roles/changedetection/tasks/main.yml +++ b/roles/changedetection/tasks/main.yml @@ -5,7 +5,6 @@ vars: user_username: "{{ changedetection_username }}" user_password: "{{ changedetection_password }}" - user_start_podman_restart: true # TODO: Remove this and move it to the podman-container role - name: Create the changedetection container ansible.builtin.include_role: name: podman-container diff --git a/roles/pi-hole/tasks/main.yml b/roles/pi-hole/tasks/main.yml index 594b9bd..1fc8b60 100644 --- a/roles/pi-hole/tasks/main.yml +++ b/roles/pi-hole/tasks/main.yml @@ -5,7 +5,6 @@ vars: user_username: "{{ pi_hole_username }}" user_password: "{{ pi_hole_password }}" - user_start_podman_restart: true # TODO: Remove this and move it to the podman-container role - name: Create the pi-hole container ansible.builtin.include_role: name: podman-container diff --git a/roles/podman-container/tasks/main.yml b/roles/podman-container/tasks/main.yml index a06a6eb..b4983f5 100644 --- a/roles/podman-container/tasks/main.yml +++ b/roles/podman-container/tasks/main.yml @@ -1,4 +1,11 @@ --- +# This role assumes currently that the target container must be restarted on a system reboot. +- name: Ensure the podman-restart.service is running + ansible.builtin.systemd: + name: podman-restart.service + state: started + enabled: true + scope: user - name: Run whoami ansible.builtin.command: whoami changed_when: false diff --git a/roles/user/tasks/main.yml b/roles/user/tasks/main.yml index 60dcd53..ffcbb70 100644 --- a/roles/user/tasks/main.yml +++ b/roles/user/tasks/main.yml @@ -115,12 +115,3 @@ ansible.builtin.user: name: "{{ target_user }}" 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_start_podman_restart diff --git a/roles/user/vars/main/defaults.yml b/roles/user/vars/main/defaults.yml deleted file mode 100644 index 50012e0..0000000 --- a/roles/user/vars/main/defaults.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -user_start_podman_restart: false