From f727f839e9aa4428f344db21e7050ad8e03a2297 Mon Sep 17 00:00:00 2001 From: nd Date: Wed, 12 Sep 2018 04:16:33 +0200 Subject: [PATCH] Initial commit --- defaults/main.yml | 6 ++++++ tasks/htpasswdfile.yml | 9 +++++++++ tasks/main.yml | 9 +++++++++ 3 files changed, 24 insertions(+) create mode 100644 defaults/main.yml create mode 100644 tasks/htpasswdfile.yml create mode 100644 tasks/main.yml 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