ansible/roles/element_web_docker/tasks/main.yml

89 lines
2.2 KiB
YAML
Raw Permalink Normal View History

---
- name: "Install dependencies"
ansible.builtin.apt:
pkg:
- docker-ce
- apparmor
- name: "Create directory for Element Web with Docker"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: '0750'
with_items:
- "{{ docker_volumes_dir }}/element_web"
- name: "Create directories for Element Web with Docker"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: 1000
group: 1000
mode: '0750'
with_items:
- "{{ docker_volumes_dir }}/element_web/config"
- name: "Debug Message"
ansible.builtin.debug:
msg:
- "{{ element_web.terms_and_conditions_links|dict2items }}"
- "{{ element_web.terms_and_conditions_links|dict2items|type_debug }}"
- name: "Template environment file for Element Web with Docker"
ansible.builtin.template:
src: "element_web.env.j2"
dest: "{{ docker_volumes_dir }}/element_web/element_web.env"
force: true
owner: root
group: root
mode: '0644'
notify: restart-element-web-docker
- name: "Template config file for Element Web with Docker"
ansible.builtin.template:
src: "config.json.j2"
dest: "{{ docker_volumes_dir }}/element_web/config/config.json"
force: true
owner: root
group: root
mode: '0644'
notify: restart-element-web-docker
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: "unhb.png"
dest: "{{ docker_volumes_dir }}/element_web/config/unhb.png"
owner: root
group: root
mode: '0644'
notify: restart-element-web-docker
- name: "Template systemd unit for Element with Docker"
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
force: true
owner: root
group: root
mode: '0664'
with_items:
- element-web-docker.service
register: units
notify: restart-element-web-docker
- name: "Reload systemd units"
ansible.builtin.systemd:
daemon_reload: yes
when: units.changed
- name: "Enable systemd units for Element Web with Docker"
ansible.builtin.systemd:
state: started
enabled: true
name: "{{ item }}"
with_items:
- element-web-docker.service