0

I am managing the main.cf config file in my postfix sls. If the same minion has also assigned the amavis state, the line content_filter = smtp-amavis:[127.0.0.1]:10024should be appended to the managed main.cf file.

My postfix sls looks like this:

/etc/postfix/main.cf:
  file.managed:
    - template: jinja
    - source: salt://postfix/files/etc/postfix/main.cf

And in my amavis sls, I try to append said line with:

/etc/postfix/main.cf-amavis:
  file.append:
    - name: /etc/postfix/main.cf
    - text: "content_filter = smtp-amavis:[127.0.0.1]:10024"
    - require_in:
      - file: /etc/postfix/main.cf

However, append happens before manage instead of executing it vice-versa.

Name: /etc/postfix/main.cf - Function: file.append - Result: Changed
Name: /etc/postfix/main.cf - Function: file.managed - Result: Changed

What is the proper way to append contents to a managed file? Or is there another way to solve my problem?

pdu
  • 167
  • 14

1 Answers1

3

You want require not require_in:

/etc/postfix/main.cf-amavis:
  file.append:
    - name: /etc/postfix/main.cf
    - text: "content_filter = smtp-amavis:[127.0.0.1]:10024"
    - require:
      - file: /etc/postfix/main.cf
Dan Garthwaite
  • 2,922
  • 18
  • 29