Use alerta user permissions
This commit is contained in:
parent
2b0cab6145
commit
543233b381
@ -14,6 +14,9 @@ vars:
|
||||
smtp_port: "587"
|
||||
smtp_starttls: "True"
|
||||
smtp_username: "alerta-noreply"
|
||||
alerta_user_gid: "0"
|
||||
# See https://github.com/alerta/docker-alerta/blob/858fa5f799835e0b62dd98e6859faf201b146e9e/Dockerfile#L78
|
||||
alerta_user_uid: "1001"
|
||||
|
||||
dirs:
|
||||
- path: /var/lib/alerta/
|
||||
@ -26,15 +29,15 @@ db:
|
||||
files:
|
||||
- src: email.tmpl
|
||||
dest: /var/lib/alerta/email.tmpl
|
||||
owner: "{{ vars.docker_user_uid }}"
|
||||
group: "{{ vars.docker_user_gid }}"
|
||||
owner: "{{ vars.alerta_user_uid }}"
|
||||
group: "{{ vars.alerta_user_gid }}"
|
||||
mode: "664"
|
||||
|
||||
templates:
|
||||
- src: config.json
|
||||
dest: /var/lib/alerta/config.json
|
||||
owner: "{{ vars.docker_user_uid }}"
|
||||
group: "{{ vars.docker_user_gid }}"
|
||||
owner: "{{ vars.alerta_user_uid }}"
|
||||
group: "{{ vars.alerta_user_gid }}"
|
||||
mode: "664"
|
||||
- src: alerta.conf
|
||||
dest: /var/lib/alerta/alerta.conf
|
||||
|
@ -1,19 +0,0 @@
|
||||
---
|
||||
- name: Get uid/guid of the Docker user
|
||||
become: true
|
||||
getent:
|
||||
database: passwd
|
||||
key: docker
|
||||
split: ":"
|
||||
|
||||
- name: Prepare docker user information dictionary
|
||||
set_fact:
|
||||
docker_user_info:
|
||||
{
|
||||
"docker_user_uid": "{{ getent_passwd['docker'][1] }}",
|
||||
"docker_user_gid": "{{ getent_passwd['docker'][2] }}",
|
||||
}
|
||||
|
||||
- name: Store docker user uid/guid in config.vars dictionary
|
||||
set_fact:
|
||||
config: "{{ config | update_vars(docker_user_info) }}"
|
Reference in New Issue
Block a user