ansible-collection-famedly-.../roles/element/tasks/main.yml
2021-11-23 01:28:15 +01:00

57 lines
1.8 KiB
YAML

---
- name: Create element directory
file:
dest: "{{ element_webapp_dir }}"
state: directory
- name: Download and install element web app
import_tasks: download.yml
when: element_deployment_method == "webroot"
- name: Write main configuration
copy:
content: "{{ element_config | to_nice_json }}"
dest: "{{ element_webapp_dir }}/config.json"
- name: Write domain specific configurations
copy:
content: "{{ item.config | to_nice_json }}"
dest: "{{ element_webapp_dir }}/config.{{ item.domain }}.json"
loop: "{{ element_domain_configs }}"
- name: Link main configuration
file:
src: "{{ element_webapp_dir }}/config.json"
dest: "{{ element_webapp_dir }}/element-v{{ element_version }}/config.json"
state: link
when: element_deployment_method == "webroot"
- name: Link domain specific configurations
file:
src: "{{ element_webapp_dir }}/config.{{ item.domain }}.json"
dest: "{{ element_webapp_dir }}/element-v{{ element_version }}/config.{{ item.domain }}.json"
state: link
loop: "{{ element_domain_configs }}"
when: element_deployment_method == "webroot"
- name: Ensure container image is present
docker_image:
name: "docker.io/vectorim/element-web:v{{ element_version }}"
force_source: "{{ element_container_image_force_pull | default(False) }}"
source: pull
state: present
when: element_deployment_method == "docker"
register: element_container_image_pulled
until: element_container_image_pulled is success
retries: 10
delay: 5
- name: Deploy docker container
docker_container:
name: "element-web"
image: "docker.io/vectorim/element-web:v{{ element_version }}"
ports: "{{ element_docker_ports }}"
labels: "{{ element_docker_labels_complete }}"
restart_policy: unless-stopped
volumes: "{{ element_docker_volumes }}"
when: element_deployment_method == "docker"