added support for different owner and crypt_scheme

This commit is contained in:
nd 2018-11-01 21:18:55 +01:00
parent f727f839e9
commit 22340271b1
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
2 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,10 @@
htpasswdfile: {} htpasswdfile: {}
# foo: # foo:
# path: /etc/nginx/htpasswd-something # path: /etc/nginx/htpasswd-something
# owner: root
# group: www-data
# mode: 0640
# crypt_scheme: apr_md5_crypt
# users: # users:
# - name: bar # - name: bar
# pw: baz # pw: baz

View file

@ -1,9 +1,11 @@
- name: set user and pw - name: set user and pw
with_items: "{{ htpasswdfile[passfile].users }}" with_items: "{{ htpasswdfile[passfile].users }}"
htpasswd: htpasswd:
crypt_scheme: "{{ htpasswdfile[passfile].crypt_scheme|d('apr_md5_crypt') }}"
path: "{{ htpasswdfile[passfile].path }}" path: "{{ htpasswdfile[passfile].path }}"
name: "{{ item.name }}" name: "{{ item.name }}"
password: "{{ item.pw }}" password: "{{ item.pw }}"
owner: root owner: "{{htpasswdfile[passfile].owner|d('root') }}"
group: www-data group: "{{htpasswdfile[passfile].group|d('www-data') }}"
mode: 0640 mode: "{{htpasswdfile[passfile].mode|d('0640') }}"
state: "{{htpasswdfile[passfile].state|d('present') }}"