Allow matrix_user_uid/matrix_user_gid to be specified manually

This commit is contained in:
Slavi Pantaleev 2020-07-06 11:05:34 +03:00
parent 024d3b84de
commit 227f1a28e3
3 changed files with 8 additions and 10 deletions

View File

@ -26,6 +26,12 @@ matrix_federation_public_port: 8448
matrix_user_username: "matrix"
matrix_user_groupname: "matrix"
# By default, the playbook creates the user (`matrix_user_username`)
# and group (`matrix_user_groupname`) with a random id.
# To use a specific user/group id, override these variables.
matrix_user_uid: ~
matrix_user_gid: ~
matrix_base_data_path: "/matrix"
matrix_base_data_path_mode: "750"

View File

@ -3,6 +3,7 @@
- name: Ensure Matrix group is created
group:
name: "{{ matrix_user_groupname }}"
gid: "{{ omit if matrix_user_gid is none else matrix_user_gid }}"
state: present
register: matrix_group
@ -13,6 +14,7 @@
- name: Ensure Matrix user is created
user:
name: "{{ matrix_user_username }}"
uid: "{{ omit if matrix_user_uid is none else matrix_user_uid }}"
state: present
group: "{{ matrix_user_groupname }}"
register: matrix_user

View File

@ -1,11 +1 @@
---
- name: (Deprecation) Warn about unused user/group variables
fail:
msg: >
The `{{ item }}` variable defined in your configuration is not used by this playbook anymore.
User/group creation is now dynamic. You can remove these variables from your configuration, as they have no effect on anything.
when: "item in vars"
with_items:
- 'matrix_user_uid'
- 'matrix_user_gid'