summaryrefslogtreecommitdiff
path: root/roles/web/tasks/setup_auth.yaml
diff options
context:
space:
mode:
authorrepliqa <sarzilhossain@proton.me>2025-07-23 14:06:15 +0600
committerrepliqa <sarzilhossain@proton.me>2025-07-23 14:06:15 +0600
commit69acb7a82a68eeb439e55b994281056df52c81b1 (patch)
tree7c6a53694e11511a3014470c213255a503f9c95e /roles/web/tasks/setup_auth.yaml
v0.0.1alphaHEADmain
Diffstat (limited to 'roles/web/tasks/setup_auth.yaml')
-rw-r--r--roles/web/tasks/setup_auth.yaml12
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