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.

vaggry
  • 31
  • 1

1 Answers1

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

James Shewey
  • 3,752
  • 1
  • 17
  • 38