chef-recipes/containers/collabora/tasks.yml

93 lines
2.7 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
# - 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
time: 3600
names: true
new: true
- 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