patternMinor
SaltStack and Vagrant adding files
Viewed 0 times
vagrantsaltstackaddingfilesand
Problem
I use file.managed to add a file:
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.
/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: trueThe 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.
Solution
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:
Also, be sure you are using the latest version of Salt Stack, 2016.11
/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: trueAlso, be sure you are using the latest version of Salt Stack, 2016.11
Code Snippets
/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: trueContext
StackExchange DevOps Q#1243, answer score: 1
Revisions (0)
No revisions yet.