Answers: <p>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:</p>
  
  <pre><code>/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
  </code></pre>
  
  <p>Also, be sure you are using the <a href="https://repo.saltstack.com/" rel="nofollow noreferrer">latest version</a> of Salt Stack, 2016.11</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-05-25T18:13:53.750Z
Answers: 2017-05-25T18:13:53.750Z
Answers: James Shewey
Body: <p>I use file.managed to add a file:</p>
  
  <pre><code>/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
  </code></pre>
  
  <p>The file is added; however the file is owned by root/root and does not change to by owned by vagrant.</p>
  
  <p>Using Vagrant 1.8.5.
  Salt is configured to be masterless and file client is local.</p>
  
Tags: <vagrant><salt>
Title: SaltStack and Vagrant adding files
UserDisplayName: vaggry
ThreadText: # SaltStack and Vagrant adding files
  
  (Asked by: username_0 on 2017-05-25)
  
  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.
  
  **Tags:** vagrant, salt
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-05-25. Score: 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](https://repo.saltstack.com/) of Salt Stack, 2016.11
  
  
  ---
  
  