0

Is it possible to make salt require that a particular file was appended to as opposed to the file merely existing?

It seems like I can only require a file state. The source looks like it strips out any method names from a require attribute.

In the example below, I only want the foo service to run if my lines have been appended to /etc/security/limits.conf.

file.append:
  - name: /etc/security/limits.conf
  - text:
    - root hard nofile 65535
    - root soft nofile 65535

foo:
  service.running:
    - enable: True
    - require:
      - file.append: /etc/security/limits.conf

1 Answer 1

1

You could change it a bit:

foo_file:
  file.append:
    - name: /etc/security/limits.conf
    - text:
      - root hard nofile 65535
      - root soft nofile 65535

foo:
  service.running:
    - enable: True
    - require:
      - file: foo_file

This should do it.

1
  • It seems to be working either way. I can't find that bit in the source code where it strips out the append part. Jul 2, 2013 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .