mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-25 18:38:30 +01:00
51312b8250
As suggested in #63 (Github issue), splitting the playbook's logic into multiple roles will be beneficial for maintainability. This patch realizes this split. Still, some components affect others, so the roles are not really independent of one another. For example: - disabling mxisd (`matrix_mxisd_enabled: false`), causes Synapse and riot-web to reconfigure themselves with other (public) Identity servers. - enabling matrix-corporal (`matrix_corporal_enabled: true`) affects how reverse-proxying (by `matrix-nginx-proxy`) is done, in order to put matrix-corporal's gateway server in front of Synapse We may be able to move away from such dependencies in the future, at the expense of a more complicated manual configuration, but it's probably not worth sacrificing the convenience we have now. As part of this work, the way we do "start components" has been redone now to use a loop, as suggested in #65 (Github issue). This should make restarting faster and more reliable.
88 lines
2.1 KiB
YAML
88 lines
2.1 KiB
YAML
---
|
|
|
|
- name: Ensure Docker repository is enabled (CentOS)
|
|
template:
|
|
src: "{{ role_path }}/files/yum.repos.d/{{ item }}"
|
|
dest: "/etc/yum.repos.d/{{ item }}"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: 0644
|
|
with_items:
|
|
- docker-ce.repo
|
|
when: ansible_distribution == 'CentOS'
|
|
|
|
- name: Ensure Docker's RPM key is trusted
|
|
rpm_key:
|
|
state: present
|
|
key: https://download.docker.com/linux/centos/gpg
|
|
when: ansible_distribution == 'CentOS'
|
|
|
|
- name: Ensure yum packages are installed (CentOS)
|
|
yum:
|
|
name:
|
|
- bash-completion
|
|
- docker-ce
|
|
- docker-python
|
|
- firewalld
|
|
- ntp
|
|
- fuse
|
|
state: latest
|
|
update_cache: yes
|
|
when: ansible_distribution == 'CentOS'
|
|
|
|
- name: Ensure APT usage dependencies are installed (Debian)
|
|
apt:
|
|
name:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
state: present
|
|
update_cache: yes
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
- name: Ensure Docker's APT key is trusted (Debian)
|
|
apt_key:
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
|
state: present
|
|
register: add_repository_key
|
|
ignore_errors: true
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
- name: Ensure Docker repository is enabled (Debian)
|
|
apt_repository:
|
|
repo: "deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
|
|
state: present
|
|
update_cache: yes
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
- name: Ensure APT packages are installed (Debian)
|
|
apt:
|
|
name:
|
|
- bash-completion
|
|
- docker-ce
|
|
- python-docker
|
|
- ntp
|
|
- fuse
|
|
state: latest
|
|
update_cache: yes
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
- name: Ensure firewalld is started and autoruns
|
|
service:
|
|
name: firewalld
|
|
state: started
|
|
enabled: yes
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
- name: Ensure Docker is started and autoruns
|
|
service:
|
|
name: docker
|
|
state: started
|
|
enabled: yes
|
|
|
|
- name: Ensure ntpd is started and autoruns
|
|
service:
|
|
name: "{{ 'ntpd' if ansible_os_family == 'RedHat' else 'ntp' }}"
|
|
state: started
|
|
enabled: yes
|