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
Jeff Strunk
  • 2,107
  • 1
  • 24
  • 29

1 Answers1

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.

Christopher Perrin
  • 4,741
  • 17
  • 32
  • It seems to be working either way. I can't find that bit in the source code where it strips out the append part. – Jeff Strunk Jul 02 '13 at 20:26