chef-recipes/containers/collabora/tasks.yml

109 lines
3.2 KiB
YAML

# code: language=ansible
---
- 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
failed_when: false
# - name: Create podman volumes
# containers.podman.podman_volume:
# state: present
# name: "{{ item }}"
# become_user: containers
# become: true
# loop:
# - collabora-config
- name: Create podman networks
containers.podman.podman_network:
name: "{{ item }}"
recreate: false
state: "present"
become_user: containers
become: true
loop:
- traefik-collabora
- nextcloud-collabora
- name: Pull container images
become_user: containers
become: true
containers.podman.podman_image:
name: docker.io/{{ item }}
loop:
- collabora/code:latest
- name: Add a collabora container
become_user: containers
become: true
containers.podman.podman_container:
name: collabora
image: docker.io/collabora/code:latest
state: present
cap_add:
- MKNOD
network:
- traefik-collabora
- nextcloud-collabora
# volume:
# - collabora-config:/etc/coolwsd:Z
label:
io.containers.autoupdate: "registry"
traefik.enable: "true"
traefik.http.routers.collabora.entrypoints: "https"
traefik.http.routers.collabora.rule: "Host(`{{ vault_domain }}`) && PathPrefix(`/collabora`,`/browser`)"
traefik.http.routers.collabora.tls: "true"
traefik.http.routers.collabora.tls.certresolver: "wildcard"
traefik.http.routers.collabora.service: "collabora"
traefik.http.services.collabora.loadbalancer.server.port: "9980"
traefik.docker.network: "traefik-collabora"
env:
domain: "chef\\.heaplab\\.deib\\.polimi\\.it"
aliasgroup1: "chef\\.heaplab\\.deib\\.polimi\\.it"
username: "{{ vault_collabora_user }}"
password: "{{ vault_collabora_password }}"
extra_params: "--o:ssl.enable=false --o:ssl.termination=true --o:net.service_root=/collabora"
generate_systemd:
path: /home/containers/.config/systemd/user/
restart_policy: on-failure
requires: [container-nextcloud.service, container-traefik.service]
names: true
new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-collabora.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot
become_user: containers
become: true
ansible.builtin.systemd:
scope: user
name: container-{{ item }}.service
enabled: true
state: started
daemon_reload: true
loop:
- collabora