Skip to content

Commit 958c6c3

Browse files
committed
fixed password config idempotence
1 parent add88ab commit 958c6c3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tasks/config.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
notify: restart pihole_lighttpd
88
when: pihole_web_server
99

10+
- name: Pi-hole | Check current password hash
11+
command: grep -oP 'WEBPASSWORD=\K\w+' /etc/pihole/setupVars.conf
12+
changed_when: false
13+
ignore_errors: true
14+
register: pihole_current_password_hash
15+
1016
- name: Pi-hole | Set password
1117
command: "pihole -a -p {{ pihole_password }}"
12-
when: pihole_password | length > 0
18+
changed_when: true
19+
when: pihole_password | length > 0 and
20+
pihole_password | hash('sha256') | hash('sha256') != pihole_current_password_hash.stdout

0 commit comments

Comments
 (0)