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') }}"