From 958c6c37387d69ff99ecb039949270a20fe39d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Blanco=20L=C3=B3pez?= Date: Fri, 22 Jan 2021 00:08:47 +0100 Subject: [PATCH] fixed password config idempotence --- tasks/config.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasks/config.yml b/tasks/config.yml index 11b3a1d..d5a6c24 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -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