diff options
Diffstat (limited to 'roles/web/tasks/setup_auth.yaml')
| -rw-r--r-- | roles/web/tasks/setup_auth.yaml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/roles/web/tasks/setup_auth.yaml b/roles/web/tasks/setup_auth.yaml new file mode 100644 index 00000000..edcd83ef --- /dev/null +++ b/roles/web/tasks/setup_auth.yaml @@ -0,0 +1,12 @@ +--- +- name: "generate arbitrary passwords for htpasswd" + ansible.builtin.set_fact: + htpasswd_passwords: "{{ htpasswd_passwords|default({}) | combine({ item: lookup('community.general.random_string', length=14, base64=true) }) }}" + loop: "{{ user_pass_dict.keys() }}" + +- name: "generate htpasswd" + ansible.builtin.shell: " echo {{item}}:{{htpasswd_passwords[item]}} | htpasswd -I /var/www/reactance/{{ item }}/.htpasswd && chown www /var/www/reactance/{{ item }}/.htpasswd && chmod 700 /var/www/reactance/{{ item }}/.htpasswd" + loop: "{{ user_pass_dict.keys() }}" + notify: + - show_htpasswd_passwords + - restart_httpd |
