diff --git a/containers/collabora/tasks.yml b/containers/collabora/tasks.yml index 7a8c015..9eef8e5 100644 --- a/containers/collabora/tasks.yml +++ b/containers/collabora/tasks.yml @@ -4,6 +4,16 @@ - hosts: all name: Collabora CODE container tasks: + - name: Stop running containers + become_user: containers + become: true + ansible.builtin.systemd: + scope: user + name: container-{{ item }}.service + state: stopped + loop: + - collabora + # - name: Create podman volumes # containers.podman.podman_volume: # state: present diff --git a/containers/drone-runner/tasks.yml b/containers/drone-runner/tasks.yml index ac77887..697153f 100644 --- a/containers/drone-runner/tasks.yml +++ b/containers/drone-runner/tasks.yml @@ -4,6 +4,16 @@ - hosts: all name: Drone CI runner agent tasks: + - name: Stop running containers + become_user: containers + become: true + ansible.builtin.systemd: + scope: user + name: container-{{ item }}.service + state: stopped + loop: + - drone-runner + - name: Get containers UID ansible.builtin.command: "id -u containers" register: uid_containers diff --git a/containers/drone-server/tasks.yml b/containers/drone-server/tasks.yml index 88dd2c9..2886b00 100644 --- a/containers/drone-server/tasks.yml +++ b/containers/drone-server/tasks.yml @@ -4,6 +4,16 @@ - hosts: all name: Drone CI server coordinator tasks: + - name: Stop running containers + become_user: containers + become: true + ansible.builtin.systemd: + scope: user + name: container-{{ item }}.service + state: stopped + loop: + - drone-server + - name: Create podman volumes containers.podman.podman_volume: state: present diff --git a/containers/gitea/tasks.yml b/containers/gitea/tasks.yml index 8753f46..2399f5e 100644 --- a/containers/gitea/tasks.yml +++ b/containers/gitea/tasks.yml @@ -4,6 +4,17 @@ - hosts: all name: Gitea web server tasks: + - name: Stop running containers + become_user: containers + become: true + ansible.builtin.systemd: + scope: user + name: container-{{ item }}.service + state: stopped + loop: + - gitea + - db_gitea + - name: Permit traffic from any IP to ssh port become: true community.general.ufw: diff --git a/containers/nextcloud/tasks.yml b/containers/nextcloud/tasks.yml index 1fa04f3..ed618b6 100644 --- a/containers/nextcloud/tasks.yml +++ b/containers/nextcloud/tasks.yml @@ -4,6 +4,18 @@ - hosts: all name: Nextcloud file sharing web service tasks: + - name: Stop running containers + become_user: containers + become: true + ansible.builtin.systemd: + scope: user + name: container-{{ item }}.service + state: stopped + loop: + - nextcloud + - redis_nextcloud + - db_nextcloud + - name: Pull container images become_user: containers become: true diff --git a/containers/portainer/tasks.yml b/containers/portainer/tasks.yml index c12e79f..206b9e7 100644 --- a/containers/portainer/tasks.yml +++ b/containers/portainer/tasks.yml @@ -9,6 +9,16 @@ register: uid_containers changed_when: uid_containers.rc != 0 + - name: Stop running containers + become_user: containers + become: true + ansible.builtin.systemd: + scope: user + name: container-{{ item }}.service + state: stopped + loop: + - portainer + - name: Pull portainer image become_user: containers become: true diff --git a/containers/traefik/tasks.yml b/containers/traefik/tasks.yml index 71c78db..3c3c0a5 100644 --- a/containers/traefik/tasks.yml +++ b/containers/traefik/tasks.yml @@ -9,6 +9,16 @@ register: uid_containers changed_when: uid_containers.rc != 0 + - name: Stop running containers + become_user: containers + become: true + ansible.builtin.systemd: + scope: user + name: container-{{ item }}.service + state: stopped + loop: + - traefik + - name: Permit traffic from any IP to http port become: true community.general.ufw: