Make vars.yml snapshotting optional and more configurable

Certain people organize their inventory in a different way
and we'd like to accommodate them.

Related to #542 (Github Issue).
This commit is contained in:
Slavi Pantaleev 2020-06-14 10:00:22 +03:00
parent 67ab7e7a1b
commit 7729511a84
2 changed files with 8 additions and 1 deletions

View File

@ -59,6 +59,12 @@ matrix_riot_jitsi_preferredDomain: ''
# The Docker network that all services would be put into # The Docker network that all services would be put into
matrix_docker_network: "matrix" matrix_docker_network: "matrix"
# Controls whether we'll preserve the vars.yml file on the Matrix server.
# If you have a differently organized inventory, you may wish to disable this feature,
# or to repoint `matrix_vars_yml_snapshotting_src` to the file you'd like to preserve.
matrix_vars_yml_snapshotting_enabled: true
matrix_vars_yml_snapshotting_src: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}/vars.yml"
# Controls whether a `/.well-known/matrix/server` file is generated and used at all. # Controls whether a `/.well-known/matrix/server` file is generated and used at all.
# #
# If you wish to rely on DNS SRV records only, you can disable this. # If you wish to rely on DNS SRV records only, you can disable this.

View File

@ -12,11 +12,12 @@
- name: Preserve vars.yml on the server for easily restoring if it gets lost later on - name: Preserve vars.yml on the server for easily restoring if it gets lost later on
copy: copy:
src: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}/vars.yml" src: "{{ matrix_vars_yml_snapshotting_src }}"
dest: "{{ matrix_base_data_path }}/vars.yml" dest: "{{ matrix_base_data_path }}/vars.yml"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
mode: '0660' mode: '0660'
when: "matrix_vars_yml_snapshotting_enabled|bool"
# `docker_network` doesn't work as expected when the given network # `docker_network` doesn't work as expected when the given network
# is a substring of a network that already exists. # is a substring of a network that already exists.