Stop containers before updating the configuration

This commit is contained in:
Francesco Antognazza 2023-02-15 14:02:20 +01:00
parent e5a2075849
commit 7bc4235fd3
7 changed files with 73 additions and 0 deletions

View File

@ -4,6 +4,16 @@
- hosts: all - hosts: all
name: Collabora CODE container name: Collabora CODE container
tasks: 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 # - name: Create podman volumes
# containers.podman.podman_volume: # containers.podman.podman_volume:
# state: present # state: present

View File

@ -4,6 +4,16 @@
- hosts: all - hosts: all
name: Drone CI runner agent name: Drone CI runner agent
tasks: 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 - name: Get containers UID
ansible.builtin.command: "id -u containers" ansible.builtin.command: "id -u containers"
register: uid_containers register: uid_containers

View File

@ -4,6 +4,16 @@
- hosts: all - hosts: all
name: Drone CI server coordinator name: Drone CI server coordinator
tasks: 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 - name: Create podman volumes
containers.podman.podman_volume: containers.podman.podman_volume:
state: present state: present

View File

@ -4,6 +4,17 @@
- hosts: all - hosts: all
name: Gitea web server name: Gitea web server
tasks: 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 - name: Permit traffic from any IP to ssh port
become: true become: true
community.general.ufw: community.general.ufw:

View File

@ -4,6 +4,18 @@
- hosts: all - hosts: all
name: Nextcloud file sharing web service name: Nextcloud file sharing web service
tasks: 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 - name: Pull container images
become_user: containers become_user: containers
become: true become: true

View File

@ -9,6 +9,16 @@
register: uid_containers register: uid_containers
changed_when: uid_containers.rc != 0 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 - name: Pull portainer image
become_user: containers become_user: containers
become: true become: true

View File

@ -9,6 +9,16 @@
register: uid_containers register: uid_containers
changed_when: uid_containers.rc != 0 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 - name: Permit traffic from any IP to http port
become: true become: true
community.general.ufw: community.general.ufw: