saltstack-formulas / postfix-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
25 stars 130 forks source link

Any solution to customise master.cf keeping facilities of this formula #46

Closed daks closed 5 years ago

daks commented 8 years ago

Hi,

I'm successfully using this formula, but I extend it to modify master.cf to enable/change maildrop configuration (see http://www.postfix.org/MAILDROP_README.html) with something like this:

postfix_master:
  file.managed:
    - name: '/etc/postfix/master.cf'
    - source: salt://mail_srv/files/master.cf
    - require:
      - pkg: postfix

include:
  - postfix.config
  - postfix

extend:
  postfix:
    service:
      - watch:
        - file: postfix_master

It works well, but it have a major caveat: I can't use this formula 'facilities' like the parameter enable_submission: True because I override master.cf with mine. It's logical but it complexifies management of different setups (with or without submission for example) as I need to manage several master.cf sources.

I wonder if there should have any possibility to manage master.cf but with the ability to customise specific lines? Example I want to change maildrop line, my pillar looks something like

master_config:
  maildrop: unix  -       n       n       -       -       pipe
      flags=ODRhu user=vmail argv=/path/to/maildrop -d ${recipient}

and the formula manage master.cf but change the line for maildrop.

I have no idea if this possible (in Salt, in this formula) but it could be great :)

thanks for your job.

gravyboat commented 8 years ago

It would need to be modified to loop through key value pairs like a few other formulas do. Check out formulas such as the Nginx ng formula: https://github.com/saltstack-formulas/nginx-formula/blob/master/nginx/ng/files/nginx.conf for an example of how this works. It's definitely possible, though it would require some work and need to be backwards compatible.

daks commented 8 years ago

Does this solution allow to have a default master.cf and then only if some values are defined, overwrite them? I'm new at Salt so not sure if I can find how to do this, but I'll look at the nginx solutions and try (if I find some time).

aboe76 commented 6 years ago

@daks is this what you where after: https://github.com/saltstack-formulas/postfix-formula/pull/63

daks commented 6 years ago

@aboe76 Looks like it is, but I'm not sure it lets me change/add any value in master.cf. It seems to only manage submission and dovecot entries.

ixs commented 6 years ago

What @daks says, PR #63 does only offer minimal configuration of the submission parameter but does not allow for generic services configuration/overrides.

I uploaded PR #65 which allows to configure any service which should fix this Issue if I understand the problem OP was having.

ixs commented 5 years ago

We should close this here, I think services are fixed by now.

daks commented 5 years ago

I can't confirm at the moment that it works because we stoppped managing Postfix of our main servers with Salt, but it seems that all master.cf related MR (like #65, #70, #75) do the job.