Make sure matrix_user_uid and matrix_user_gid are always set
If one runs the playbook with `--tags=setup-all`, it would have been fine. But running with a specific tag (e.g. `--tags=setup-riot-web`) would have made that initialization be skipped, and the `matrix-riot-web` role would fail, due to missing variables.
This commit is contained in:
parent
a1c5a197a9
commit
8fea6f5130
@ -12,6 +12,13 @@
|
|||||||
tags:
|
tags:
|
||||||
- setup-all
|
- setup-all
|
||||||
|
|
||||||
|
# This needs to always run, because it populates `matrix_user_uid` and `matrix_user_gid`,
|
||||||
|
# which are required by many other roles.
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_matrix_user.yml"
|
||||||
|
when: run_setup|bool
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml"
|
- import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml"
|
||||||
when: run_setup|bool
|
when: run_setup|bool
|
||||||
tags:
|
tags:
|
||||||
|
@ -1,26 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Ensure Matrix group is created
|
|
||||||
group:
|
|
||||||
name: "{{ matrix_user_username }}"
|
|
||||||
state: present
|
|
||||||
register: matrix_group
|
|
||||||
|
|
||||||
- name: Set Matrix Group GID Variable
|
|
||||||
set_fact:
|
|
||||||
matrix_user_gid: "{{ matrix_group.gid }}"
|
|
||||||
|
|
||||||
- name: Ensure Matrix user is created
|
|
||||||
user:
|
|
||||||
name: "{{ matrix_user_username }}"
|
|
||||||
state: present
|
|
||||||
group: "{{ matrix_user_username }}"
|
|
||||||
register: matrix_user
|
|
||||||
|
|
||||||
- name: Set Matrix Group UID Variable
|
|
||||||
set_fact:
|
|
||||||
matrix_user_uid: "{{ matrix_user.uid }}"
|
|
||||||
|
|
||||||
- name: Ensure Matrix base path exists
|
- name: Ensure Matrix base path exists
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
|
22
roles/matrix-base/tasks/setup_matrix_user.yml
Normal file
22
roles/matrix-base/tasks/setup_matrix_user.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure Matrix group is created
|
||||||
|
group:
|
||||||
|
name: "{{ matrix_user_username }}"
|
||||||
|
state: present
|
||||||
|
register: matrix_group
|
||||||
|
|
||||||
|
- name: Set Matrix Group GID Variable
|
||||||
|
set_fact:
|
||||||
|
matrix_user_gid: "{{ matrix_group.gid }}"
|
||||||
|
|
||||||
|
- name: Ensure Matrix user is created
|
||||||
|
user:
|
||||||
|
name: "{{ matrix_user_username }}"
|
||||||
|
state: present
|
||||||
|
group: "{{ matrix_user_username }}"
|
||||||
|
register: matrix_user
|
||||||
|
|
||||||
|
- name: Set Matrix Group UID Variable
|
||||||
|
set_fact:
|
||||||
|
matrix_user_uid: "{{ matrix_user.uid }}"
|
Loading…
Reference in New Issue
Block a user