如何从自定义非root用户运行Chef-Client Vagrant Provisioner? [英] How to run chef-client vagrant provisioner from custom non-root user?
问题描述
我想知道是否有一种方法可以将用户设置为无业游民的配置,以便从非root帐户配置该框?问题是我想以特定用户(部署者)的身份而不是root的身份在盒子上运行Chef-client,但是为此,我应该先运行Provisioner并创建此用户,然后在root用户下创建此Provisioner。
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?
推荐答案
请原谅,如果我只是想重提您的问题的后半部分,但您似乎可能想创建一个最小的启动预配置程序(以root身份运行),然后以您的预期用户身份生成另一个预配置程序。
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.
以下是我以ssh用户身份安装点文件的示例( vagrant
)
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
这篇关于如何从自定义非root用户运行Chef-Client Vagrant Provisioner?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!