我在ubuntu 12.04的流浪汉中测试厨师。我使用默认的流浪帐户vagrant
来运行knife solo bootstrap vagrant@192.168.33.10
,每次都显示以下错误:
================================================================================
Error executing action `create` on resource 'user_account[deploy]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
user[deploy] (/home/vagrant/chef-solo/cookbooks-2/user/providers/account.rb line 94) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '6'
---- Begin output of ["useradd", "-c", "deployer", "-g", "deploy", "-s", "/bin/bash", "-u", "9001", "-d", "/home/deploy", "-m", "deploy"] ----
STDOUT:
STDERR: useradd: group 'deploy' does not exist
---- End output of ["useradd", "-c", "deployer", "-g", "deploy", "-s", "/bin/bash", "-u", "9001", "-d", "/home/deploy", "-m", "deploy"] ----
Ran ["useradd", "-c", "deployer", "-g", "deploy", "-s", "/bin/bash", "-u", "9001", "-d", "/home/deploy", "-m", "deploy"] returned 6
这让我很失望。希望有人可以帮助我。
这是我的节点配置文件(/nodes/vagrant.json):
{
"appbox": {
"admin_keys":[ "ssh-rsa blabla" ],
"deploy_keys":[ "ssh-rsa blabla" ]
},
"databox": {
"db_root_password": "welcome!",
"databases": {
"mysql": [
{
"username": "get_real",
"password": "get_real",
"database_name": "get_real"
}
]
}
},
"github_deploys": {
"deploy_user": "deploy",
"github_api": {
"username": "xxx",
"email": "xxx@163.com",
"password": "blabla"
}
},
"rackbox": {
"ruby": {
"versions": ["2.0.0-p247"],
"global_version": "2.0.0-p247"
}
},
"run_list":[
"databox::mysql",
"nodejs",
"rackbox",
"github-deploys"
]
}
答案 0 :(得分:1)
如果您能提供食谱代码,将会很有帮助。但是,错误消息非常清楚。
---- Begin output of ["useradd", "-c", "deployer", "-g", "deploy", "-s", "/bin/bash", "-u", "9001", "-d", "/home/deploy", "-m", "deploy"] ----
从这一行开始,我们知道大厨尝试执行以下命令来创建deploy
组中的deploy
用户。
useradd -c deployer -g deploy -s /bin/bash -u 9001 -d /home/deploy -m deploy
然后,错误消息是:
STDERR: useradd: group 'deploy' does not exist
解决方案应该很简单:在创建此用户之前创建一个deploy
组。您可以使用内置group资源来执行此操作。