0

我在 ubuntu 12.04 的 vagrant 中测试了厨师。我使用默认的 vagrant 帐户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"
  ]
}
4

1 回答 1

1

如果您可以提供食谱的代码,这将很有帮助。但是,错误消息非常清楚。

---- Begin output of ["useradd", "-c", "deployer", "-g", "deploy", "-s", "/bin/bash", "-u", "9001", "-d", "/home/deploy", "-m", "deploy"] ----

从这一行,我们知道厨师试图执行以下命令来创建一个用户,即deploydeploy组中。

useradd -c deployer -g deploy -s /bin/bash -u 9001 -d /home/deploy -m deploy

然后,错误消息是:

STDERR: useradd: group 'deploy' does not exist

解决方案应该很简单:deploy在创建此用户之前创建一个组。您可以使用内置资源来执行此操作。

于 2013-11-09T08:12:11.413 回答