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.

This commit is contained in:
Brian Lee 2023-08-20 05:56:08 +00:00
parent 6789368831
commit 74005e7cf6
2 changed files with 10 additions and 17 deletions

View File

@ -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 }}"

View File

@ -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