aboutsummaryrefslogtreecommitdiffstats
path: root/roles/htpasswd
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
commitb232b894c3cbe087c8d504e91637dcf62199eed1 (patch)
treeea72a7d1a7f63c6425ee46785e1cec924351b2c3 /roles/htpasswd
parent22126073344e60c405d086df37b64da0c6d3c086 (diff)
downloadinfrastructure-b232b894c3cbe087c8d504e91637dcf62199eed1.tar.gz
Bump to third revision of homelab
Diffstat (limited to 'roles/htpasswd')
-rw-r--r--roles/htpasswd/defaults/main.yml4
-rw-r--r--roles/htpasswd/tasks/main.yml11
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_ }}"
remember that computers suck.