Open gondo opened 11 years ago
You can change the owner:group from within a chef recipe with the execute block.
execute "fix permissions" do command "chown -R www-data:www-data" action :run only_if do File.exists?("/var/www") end end
nickd
On Mon, Jun 17, 2013 at 9:58 AM, gondo notifications@github.com wrote:
i'm using chef recipes to install apache2, php. originally, i had problem with apache not being able to create new folders, as by default, apache2 runs as "www-data:www-data" i've solved this by adding nfs option to my syn_folder option config.vm.synced_folder "www", "/var/www/", :nfs => true in my Vagrant file but i still have a problem with AWS. i understand that i need to set apache2 to run as user who owns the files, but the problem is, that this user is different for different provider. by running vagrant locally, the user and group is vagrant:vagrant however when i use aws provider, the user is ubuntu:ubuntu (as this is default AWS user) now the problem is, that i dont know what user is used inside chef recipies, as chef is always run as root so my question is, is there anyway how to solve this? f.e. have special chef settings inside aws setting in vagrant file? or is it possible to pass/detect the user information inside chef recipe? (i've tried to check platform but its the same for both, ubuntu)
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant-aws/issues/99 .
unfortunately that doesn't work for VirtualBox, you can not change ownership of rsynced files. i want to use the same setup and be able to run Vagrant locally as well on AWS.
also even if this would work, i dont want to change permissions or ownership of my web app files, as it would again cause problems with my local development and any local change to those files would overwrite this settings and i would have to re run chmod/chown
I don't think I understand exactly what your trying to do. Do you have two separate Vagrantfiles? One for local VirtualBox and one for AWS?
On Mon, Jun 17, 2013 at 4:51 PM, gondo notifications@github.com wrote:
also even if this would work, i dont want to change permissions or ownership of my web app files, as it would again cause problems with my local development and any local change to those files would overwrite this settings and i would have to re run chmod/chown
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant-aws/issues/99#issuecomment-19582678 .
here is what im trying to do:
what i have:
what is the problem:
what i dont want to do:
question:
my current solution:
chef.json = {
:vmbox => config.vm.box
}
if node['hostname'] != node['vmbox']
node.set['apache']['user'] = "ubuntu"
node.set['apache']['group'] = "ubuntu"
end
i'm using chef recipes to install apache2, php. originally, i had problem with apache not being able to create new folders, as by default, apache2 runs as "www-data:www-data" i've solved this by adding
nfs
option to my syn_folder optionconfig.vm.synced_folder "www", "/var/www/", :nfs => true
in my Vagrant file but i still have a problem with AWS. i understand that i need to set apache2 to run as user who owns the files, but the problem is, that this user is different for different provider. by running vagrant locally, the user and group isvagrant:vagrant
however when i use aws provider, the user isubuntu:ubuntu
(as this is default AWS user) now the problem is, that i dont know what user is used inside chef recipies, as chef is always run asroot
so my question is, is there anyway how to solve this? f.e. have special chef settings inside aws setting in vagrant file? or is it possible to pass/detect the user information inside chef recipe? (i've tried to check platform but its the same for both, ubuntu)