Skip to content

Commit

Permalink
fixed password config idempotence
Browse files Browse the repository at this point in the history
  • Loading branch information
blalop committed Jan 21, 2021
1 parent add88ab commit 958c6c3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
notify: restart pihole_lighttpd
when: pihole_web_server

- name: Pi-hole | Check current password hash
command: grep -oP 'WEBPASSWORD=\K\w+' /etc/pihole/setupVars.conf
changed_when: false
ignore_errors: true
register: pihole_current_password_hash

- name: Pi-hole | Set password
command: "pihole -a -p {{ pihole_password }}"
when: pihole_password | length > 0
changed_when: true
when: pihole_password | length > 0 and
pihole_password | hash('sha256') | hash('sha256') != pihole_current_password_hash.stdout

0 comments on commit 958c6c3

Please sign in to comment.