You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.8 KiB
117 lines
3.8 KiB
6 years ago
|
---
|
||
|
|
||
|
#
|
||
|
# Tasks related to setting up mxisd
|
||
|
#
|
||
|
|
||
6 years ago
|
- name: (Deprecation) Warn about mxisd variables that are not used anymore
|
||
6 years ago
|
fail:
|
||
6 years ago
|
msg: >
|
||
|
The `{{ item }}` variable defined in your configuration is not used by this playbook anymore!
|
||
|
You'll need to adapt to the new way of extending mxisd configuration.
|
||
|
See the CHANGELOG and the `matrix_mxisd_configuration_extension_yaml` variable for more information and examples.
|
||
|
when: "matrix_mxisd_enabled and item in vars"
|
||
|
with_items:
|
||
|
- 'matrix_mxisd_ldap_enabled'
|
||
|
- 'matrix_mxisd_ldap_connection_host'
|
||
|
- 'matrix_mxisd_ldap_connection_tls'
|
||
|
- 'matrix_mxisd_ldap_connection_port'
|
||
|
- 'matrix_mxisd_ldap_connection_baseDn'
|
||
|
- 'matrix_mxisd_ldap_connection_baseDns'
|
||
|
- 'matrix_mxisd_ldap_connection_bindDn'
|
||
|
- 'matrix_mxisd_ldap_connection_bindPassword'
|
||
|
- 'matrix_mxisd_ldap_filter'
|
||
|
- 'matrix_mxisd_ldap_attribute_uid_type'
|
||
|
- 'matrix_mxisd_ldap_attribute_uid_value'
|
||
|
- 'matrix_mxisd_ldap_connection_bindPassword'
|
||
|
- 'matrix_mxisd_ldap_attribute_name'
|
||
|
- 'matrix_mxisd_ldap_attribute_threepid_email'
|
||
|
- 'matrix_mxisd_ldap_attribute_threepid_msisdn'
|
||
|
- 'matrix_mxisd_ldap_identity_filter'
|
||
|
- 'matrix_mxisd_ldap_identity_medium'
|
||
|
- 'matrix_mxisd_ldap_auth_filter'
|
||
|
- 'matrix_mxisd_ldap_directory_filter'
|
||
|
- 'matrix_mxisd_template_config'
|
||
|
|
||
|
- name: Ensure mxisd configuration does not contain any dot-notation keys
|
||
|
fail:
|
||
|
msg: >
|
||
|
Since version 1.3.0, mxisd will not accept property-style configuration keys.
|
||
|
You have defined a key (`{{ item.key }}`) which contains a dot.
|
||
|
Instead, use nesting. See: https://github.com/kamax-matrix/mxisd/wiki/Upgrade#v130
|
||
|
when: "matrix_mxisd_enabled and '.' in item.key"
|
||
|
with_dict: "{{ matrix_mxisd_configuration }}"
|
||
6 years ago
|
|
||
6 years ago
|
- name: Fail if mailer is not enabled
|
||
|
fail:
|
||
6 years ago
|
msg: "You need to enable the mailer service (`matrix_mailer_enabled`) to install mxisd"
|
||
6 years ago
|
when: "matrix_mxisd_enabled and not matrix_mailer_enabled"
|
||
|
|
||
|
- name: Ensure mxisd paths exist
|
||
|
file:
|
||
|
path: "{{ item }}"
|
||
|
state: directory
|
||
|
mode: 0750
|
||
|
owner: "{{ matrix_user_username }}"
|
||
|
group: "{{ matrix_user_username }}"
|
||
|
with_items:
|
||
|
- "{{ matrix_mxisd_config_path }}"
|
||
|
- "{{ matrix_mxisd_data_path }}"
|
||
|
when: matrix_mxisd_enabled
|
||
|
|
||
|
- name: Ensure mxisd image is pulled
|
||
|
docker_image:
|
||
6 years ago
|
name: "{{ matrix_mxisd_docker_image }}"
|
||
6 years ago
|
when: matrix_mxisd_enabled
|
||
|
|
||
|
- name: Ensure mxisd config installed
|
||
6 years ago
|
copy:
|
||
|
content: "{{ matrix_mxisd_configuration|to_nice_yaml }}"
|
||
6 years ago
|
dest: "{{ matrix_mxisd_config_path }}/mxisd.yaml"
|
||
|
mode: 0644
|
||
|
owner: "{{ matrix_user_username }}"
|
||
|
group: "{{ matrix_user_username }}"
|
||
|
when: matrix_mxisd_enabled
|
||
|
|
||
|
- name: Ensure matrix-mxisd.service installed
|
||
|
template:
|
||
|
src: "{{ role_path }}/templates/systemd/matrix-mxisd.service.j2"
|
||
|
dest: "/etc/systemd/system/matrix-mxisd.service"
|
||
|
mode: 0644
|
||
|
when: matrix_mxisd_enabled
|
||
|
|
||
|
#
|
||
|
# Tasks related to getting rid of mxisd (if it was previously enabled)
|
||
|
#
|
||
|
|
||
|
- name: Check existence of matrix-mxisd service
|
||
6 years ago
|
stat:
|
||
|
path: "/etc/systemd/system/matrix-mxisd.service"
|
||
6 years ago
|
register: matrix_mxisd_service_stat
|
||
|
|
||
|
- name: Ensure matrix-mxisd is stopped
|
||
6 years ago
|
service:
|
||
|
name: matrix-mxisd
|
||
6 years ago
|
state: stopped
|
||
6 years ago
|
daemon_reload: yes
|
||
6 years ago
|
register: stopping_result
|
||
|
when: "not matrix_mxisd_enabled and matrix_mxisd_service_stat.stat.exists"
|
||
|
|
||
|
- name: Ensure matrix-mxisd.service doesn't exist
|
||
|
file:
|
||
|
path: "/etc/systemd/system/matrix-mxisd.service"
|
||
|
state: absent
|
||
|
when: "not matrix_mxisd_enabled and matrix_mxisd_service_stat.stat.exists"
|
||
|
|
||
|
- name: Ensure Matrix mxisd paths don't exist
|
||
|
file:
|
||
|
path: "{{ matrix_mxisd_base_path }}"
|
||
|
state: absent
|
||
|
when: "not matrix_mxisd_enabled"
|
||
|
|
||
|
- name: Ensure mxisd Docker image doesn't exist
|
||
|
docker_image:
|
||
6 years ago
|
name: "{{ matrix_mxisd_docker_image }}"
|
||
6 years ago
|
state: absent
|
||
6 years ago
|
when: "not matrix_mxisd_enabled"
|