From 543233b3818881125f775f8494c8cceca5351a07 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Thu, 16 Apr 2020 13:04:19 +0200 Subject: [PATCH] Use alerta user permissions --- deploy.d/config.yml | 11 +++++++---- deploy.d/plays/predeploy.yml | 19 ------------------- 2 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 deploy.d/plays/predeploy.yml diff --git a/deploy.d/config.yml b/deploy.d/config.yml index 2fc47fa..c165823 100644 --- a/deploy.d/config.yml +++ b/deploy.d/config.yml @@ -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 diff --git a/deploy.d/plays/predeploy.yml b/deploy.d/plays/predeploy.yml deleted file mode 100644 index 29b4b8d..0000000 --- a/deploy.d/plays/predeploy.yml +++ /dev/null @@ -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) }}"