commit f727f839e9aa4428f344db21e7050ad8e03a2297 Author: nd Date: Wed Sep 12 04:16:33 2018 +0200 Initial commit diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..c86b3a4 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,6 @@ +htpasswdfile: {} +# foo: +# path: /etc/nginx/htpasswd-something +# users: +# - name: bar +# pw: baz diff --git a/tasks/htpasswdfile.yml b/tasks/htpasswdfile.yml new file mode 100644 index 0000000..71fb71f --- /dev/null +++ b/tasks/htpasswdfile.yml @@ -0,0 +1,9 @@ +- name: set user and pw + with_items: "{{ htpasswdfile[passfile].users }}" + htpasswd: + path: "{{ htpasswdfile[passfile].path }}" + name: "{{ item.name }}" + password: "{{ item.pw }}" + owner: root + group: www-data + mode: 0640 diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..861fbdc --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,9 @@ +- name: install python requirements + apt: + pkg: python-passlib + +- name: generate passwordfile + with_items: "{{ htpasswdfile }}" + loop_control: + loop_var: passfile + include_tasks: htpasswdfile.yml