diff options
Diffstat (limited to 'roles/htpasswd')
-rw-r--r-- | roles/htpasswd/defaults/main.yml | 4 | ||||
-rw-r--r-- | roles/htpasswd/tasks/main.yml | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/roles/htpasswd/defaults/main.yml b/roles/htpasswd/defaults/main.yml new file mode 100644 index 0000000..458b9c1 --- /dev/null +++ b/roles/htpasswd/defaults/main.yml @@ -0,0 +1,4 @@ +htpasswd_user: "www" +htpasswd_password: "" +htpasswd_dir: "/htpasswd" +htpasswd_service: "" diff --git a/roles/htpasswd/tasks/main.yml b/roles/htpasswd/tasks/main.yml new file mode 100644 index 0000000..9586c82 --- /dev/null +++ b/roles/htpasswd/tasks/main.yml @@ -0,0 +1,11 @@ +- name: ensure htpasswd service is specified + fail: + when: + +- name: set variable for realm generation + set_facts: + htpasswd_credentials_: "{{ htpasswd_user }}:{{ htpasswd_password }}" + htpasswd_file_: "{{ htpasswd_dir }}/{{ htpasswd_service }}" + +- name: generate realm file + shell: echo "{{ htpasswd_credentials_ }}" | htpasswd -I "{{ htpasswd_file_ }}" |