From 22340271b12cc3df0db869b30bf8ead7229d731c Mon Sep 17 00:00:00 2001 From: nd Date: Thu, 1 Nov 2018 21:18:55 +0100 Subject: [PATCH] added support for different owner and crypt_scheme --- defaults/main.yml | 4 ++++ tasks/htpasswdfile.yml | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c86b3a4..9fd481d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,10 @@ htpasswdfile: {} # foo: # path: /etc/nginx/htpasswd-something +# owner: root +# group: www-data +# mode: 0640 +# crypt_scheme: apr_md5_crypt # users: # - name: bar # pw: baz diff --git a/tasks/htpasswdfile.yml b/tasks/htpasswdfile.yml index 71fb71f..b68a14b 100644 --- a/tasks/htpasswdfile.yml +++ b/tasks/htpasswdfile.yml @@ -1,9 +1,11 @@ - name: set user and pw with_items: "{{ htpasswdfile[passfile].users }}" htpasswd: + crypt_scheme: "{{ htpasswdfile[passfile].crypt_scheme|d('apr_md5_crypt') }}" path: "{{ htpasswdfile[passfile].path }}" name: "{{ item.name }}" password: "{{ item.pw }}" - owner: root - group: www-data - mode: 0640 + owner: "{{htpasswdfile[passfile].owner|d('root') }}" + group: "{{htpasswdfile[passfile].group|d('www-data') }}" + mode: "{{htpasswdfile[passfile].mode|d('0640') }}" + state: "{{htpasswdfile[passfile].state|d('present') }}"