blob: edcd83efba07643a3c1902f78bcf90873cd221b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
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
|