mirror of
https://github.com/famedly/ansible-collection-base
synced 2024-11-10 06:24:17 +00:00
feat(lego): allow configuring permissions of lego's certificate store folder
This commit is contained in:
parent
84c8e7ca0d
commit
b980e37177
3 changed files with 19 additions and 2 deletions
|
@ -1,5 +1,9 @@
|
||||||
---
|
---
|
||||||
lego_base_path: /opt/lego
|
lego_base_path: /opt/lego
|
||||||
|
lego_certificate_store: "{{ lego_base_path }}/certificates"
|
||||||
|
lego_certificate_store_user: "{{ lego_user_res.uid | default(lego_user) }}"
|
||||||
|
lego_certificate_store_group: "{{ lego_user_res.group | default(lego_user) }}"
|
||||||
|
lego_certificate_store_mode: "0750"
|
||||||
lego_systemd_path: /etc/systemd/system
|
lego_systemd_path: /etc/systemd/system
|
||||||
lego_version: 4.5.2
|
lego_version: 4.5.2
|
||||||
lego_system_type: "linux"
|
lego_system_type: "linux"
|
||||||
|
|
|
@ -14,8 +14,17 @@
|
||||||
file:
|
file:
|
||||||
path: "{{ lego_base_path }}"
|
path: "{{ lego_base_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ lego_user_res.uid }}"
|
owner: "{{ lego_certificate_store_user }}"
|
||||||
group: "{{ lego_user_res.group }}"
|
group: "{{ lego_certificate_store_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Ensure certificate directory exists and has the configured permissions
|
||||||
|
file:
|
||||||
|
path: "{{ lego_certificate_store }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ lego_certificate_store_user }}"
|
||||||
|
group: "{{ lego_certificate_store_group }}"
|
||||||
|
mode: "{{ lego_certificate_store_mode }}"
|
||||||
|
|
||||||
- name: Check if binary exsists and is the correct version
|
- name: Check if binary exsists and is the correct version
|
||||||
command:
|
command:
|
||||||
|
|
|
@ -12,7 +12,11 @@ Type=oneshot
|
||||||
Group={{ lego_user_res.group }}
|
Group={{ lego_user_res.group }}
|
||||||
User={{ lego_user_res.name }}
|
User={{ lego_user_res.name }}
|
||||||
WorkingDirectory={{ lego_base_path }}
|
WorkingDirectory={{ lego_base_path }}
|
||||||
|
ExecStartPre=+-chown {{ lego_certificate_store_user }}:{{ lego_certificate_store_group }} {{ lego_certificate_store }}
|
||||||
|
ExecStartPre=+-chmod {{ lego_certificate_store_mode }} {{ lego_certificate_store }}
|
||||||
ExecStart={{ lego_command_systemd }}
|
ExecStart={{ lego_command_systemd }}
|
||||||
|
ExecStartPost=+-/bin/sh -c 'chown {{ lego_certificate_store_user }}:{{ lego_certificate_store_group }} {{ lego_certificate_store }}/*'
|
||||||
|
ExecStartPost=+-/bin/sh -c 'chmod 0640 {{ lego_certificate_store }}/*'
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in a new issue