Postfix: extract main.cf md5sum into variables

This commit is contained in:
Jérémy Lecour 2017-11-15 12:10:10 +01:00 committed by Jérémy Lecour
parent 8a479eee3f
commit d355532a24
4 changed files with 10 additions and 5 deletions

View file

@ -1,6 +1,6 @@
--- ---
- name: check if main.cf is default - name: check if main.cf is default
shell: 'grep -v -E "^(myhostname|mydestination|mailbox_command)" /etc/postfix/main.cf | md5sum -' shell: 'grep -v -E "^(myhostname|mydestination|mailbox_command)" /etc/postfix/main.cf | md5sum -'
changed_when: False changed_when: False
check_mode: no check_mode: no
register: default_main_cf register: default_main_cf

View file

@ -18,7 +18,7 @@
force: yes force: yes
notify: restart postfix notify: restart postfix
when: postfix_force_main_cf == True or when: postfix_force_main_cf == True or
default_main_cf.stdout == "5450c05d65878e99dad696c7c722e511 -" or postfix_maincf_md5_jessie in default_main_cf.stdout or
default_main_cf.stdout == "30022953f1f61f002bfb72e163ecb27e -" postfix_maincf_md5_stretch in default_main_cf.stdout
tags: tags:
- postfix - postfix

View file

@ -21,8 +21,8 @@
force: yes force: yes
notify: restart postfix notify: restart postfix
when: postfix_force_main_cf == True or when: postfix_force_main_cf == True or
default_main_cf.stdout == "5450c05d65878e99dad696c7c722e511 -" or postfix_maincf_md5_jessie in default_main_cf.stdout or
default_main_cf.stdout == "30022953f1f61f002bfb72e163ecb27e -" postfix_maincf_md5_stretch in default_main_cf.stdout
tags: tags:
- postfix - postfix

5
postfix/vars/main.yml Normal file
View file

@ -0,0 +1,5 @@
---
## MD5 hash of default main.cf filter, obtained with this command :
# grep -v -E "^(myhostname|mydestination|mailbox_command)" /etc/postfix/main.cf | md5sum -
postfix_maincf_md5_jessie: "5450c05d65878e99dad696c7c722e511"
postfix_maincf_md5_stretch: "30022953f1f61f002bfb72e163ecb27e"