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: containers.podman.podman_volume:
state: present state: present
name: "{{ item }}" name: "{{ item }}"
@ -8,7 +8,7 @@
loop: "{{ nextcloud_create_volumes }}" loop: "{{ nextcloud_create_volumes }}"
# https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/docker-compose.yml # 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: containers.podman.podman_container:
debug: no debug: no
image: "{{ nextcloud_image }}:{{ nextcloud_version }}" 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: containers.podman.podman_generate_systemd:
name: nextcloud name: nextcloud
dest: ~/.config/systemd/user/ dest: ~/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
restart_sec: 60 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. - 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
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.
ansible.builtin.systemd: ansible.builtin.systemd:
name: container-nextcloud name: container-nextcloud
scope: user scope: user
state: started state: started
register: systemd_result failed_when: false
until: systemd_result is succeeded #register: systemd_result
retries: 1 #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: ansible.builtin.template:
src: "{{ item }}.j2" src: "{{ item }}.j2"
dest: "~/.config/systemd/user/{{ item }}" dest: "~/.config/systemd/user/{{ item }}"
@ -31,7 +24,7 @@
- nextcloud-cron.service - nextcloud-cron.service
- nextcloud-cron.timer - nextcloud-cron.timer
- name: Nextcloud | Install systemd timer to run cron jobs - name: Install systemd timer to run cron jobs
ansible.builtin.systemd: ansible.builtin.systemd:
name: nextcloud-cron.timer name: nextcloud-cron.timer
scope: user scope: user