How to run chef-client vagrant provisioner from custom non-root user?

谁说胖子不能爱 提交于 2019-12-13 06:27:11

问题


I wonder is there a way to set user in vagrant configuration, so that box will be provisioned from non-root account? The thing is that I want to run chef-client on boxes as specific user (deployer), and not root, but for that I should run provisioner and create this user first, and this provisioner is created under root user.

As I understand, the one solution is to run provisioning for create deployer user, and then change all chef-related files and directories on box to be owned by deployer user, and then run the actual provisioning from chef server.

Is there some better solution?


回答1:


Forgive me if I'm just restating the second half of your question but it seems like you may want to create a minimal starting provisioner (runs as root) then spawn another provisioner as your intended user.

Here is an example of how I install my dotfiles as my ssh user (vagrant)

# ... in shell provision script...
su -c "cd /home/vagrant/.dotfiles && bash install.bash" vagrant

Similar Vagrant github issue



来源:https://stackoverflow.com/questions/20461686/how-to-run-chef-client-vagrant-provisioner-from-custom-non-root-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!