progmaticltd / homebox

A set of ansible scripts to build a personal mail server / private cloud / etc.
https://homebox.space/
GNU General Public License v3.0
461 stars 52 forks source link

smtpd_flags variable not set when not in devel or debug mode #342

Closed Noxeus closed 4 years ago

Noxeus commented 4 years ago

Hi, It seems that the template for postfix' master.cf uses the smtpd_flags variable which is only set when system.devel or system.debug are true. I think this should either always be set, but set to '' when the above are false.

EDIT: I just learned of the default filter in ansible, maybe use that?

arodier commented 4 years ago

Well spotted, thanks. Yes we can add the default filter to nothing, but it is always better, in my opinion, to have a clear separation between the code and the data, or in our case, the tasks and the template. Therefore, I should have written the task like this:

# See http://www.postfix.org/DEBUG_README.html
- name: Set SMTP flag for debugging or development
  set_fact:
    smtpd_flags: '{{ (system.debug or system.devel) | ternary("-v", "") }}'

If you clone the repository and create a pull request, then I will accept it. I may also invite you to take part in the project.