From 74005e7cf655fa4df56f4dc7b86b859542453702 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Sun, 20 Aug 2023 05:56:08 +0000 Subject: [PATCH] Removed extra service unit step. Systemd seems to not need the extra help to correct track the status of the container, and it was often preventing the container started. --- tasks/podman.yml | 4 ++-- tasks/systemd.yml | 23 ++++++++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/tasks/podman.yml b/tasks/podman.yml index 9143898..4dfb224 100644 --- a/tasks/podman.yml +++ b/tasks/podman.yml @@ -1,5 +1,5 @@ --- -- name: Nextcloud | Create volumes +- name: Create volumes containers.podman.podman_volume: state: present name: "{{ item }}" @@ -8,7 +8,7 @@ loop: "{{ nextcloud_create_volumes }}" # https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/docker-compose.yml -- name: Nextcloud | Create container +- name: Create container containers.podman.podman_container: debug: no image: "{{ nextcloud_image }}:{{ nextcloud_version }}" diff --git a/tasks/systemd.yml b/tasks/systemd.yml index b371117..36b7391 100644 --- a/tasks/systemd.yml +++ b/tasks/systemd.yml @@ -1,29 +1,22 @@ --- -- name: Nextcloud | Generate systemd unit file for the container(s) +- name: Generate systemd unit file for the container(s) containers.podman.podman_generate_systemd: name: nextcloud dest: ~/.config/systemd/user/ restart_policy: on-failure restart_sec: 60 -- name: Nextcloud | Ensure container(s) are enabled in systemd, but stop it now because we wanted to use "recreate" in the podman_container task before this. - ansible.builtin.systemd: - name: container-nextcloud - scope: user - daemon_reload: true - state: stopped - enabled: true - -- name: Nextcloud | Start the container(s) with systemd, so systemd will know the state of the container(s) moving forward. +- name: Start the container(s) with systemd, so systemd will know the state of the container(s) moving forward. ansible.builtin.systemd: name: container-nextcloud scope: user state: started - register: systemd_result - until: systemd_result is succeeded - retries: 1 + failed_when: false + #register: systemd_result + #until: systemd_result is succeeded + #retries: 1 -- name: Nextcloud | Install systemd timer to run cron jobs +- name: Install systemd timer to run cron jobs ansible.builtin.template: src: "{{ item }}.j2" dest: "~/.config/systemd/user/{{ item }}" @@ -31,7 +24,7 @@ - nextcloud-cron.service - nextcloud-cron.timer -- name: Nextcloud | Install systemd timer to run cron jobs +- name: Install systemd timer to run cron jobs ansible.builtin.systemd: name: nextcloud-cron.timer scope: user