3

I use file.managed to add a file:

/home/vagrant/.bash_profile:
  file.append:
    - name: /home/vagrant/.bash_profile
    - source: salt://config/user/.bash_profile
    - user: vagrant
    - group: vagrant
    - template: jinja
    - mode: 0775
    - replace: true

The file is added; however the file is owned by root/root and does not change to by owned by vagrant.

Using Vagrant 1.8.5. Salt is configured to be masterless and file client is local.

1 Answer 1

1

You aren't actually using file.managed, you are using file.append - so salt is expecting to add onto the end of an existing file. This may be the cause of your issue. Instead try:

/home/vagrant/.bash_profile:
  file.managed:
    - name: /home/vagrant/.bash_profile
    - source: salt://config/user/.bash_profile
    - mode: 0775
    - user: vagrant
    - group: vagrant
    - template: jinja
    - replace: true

Also, be sure you are using the latest version of Salt Stack, 2016.11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.