【问题标题】:Chef appbox with Error executing action `create` on resource 'user_account[deploy]'在资源“user_account[deploy]”上执行操作“create”时出现错误的 Chef 应用程序框
【发布时间】:2013-11-09 16:20:15
【问题描述】:

我在 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"
  ]
}

【问题讨论】:

    标签: deployment chef-infra vagrant knife


    【解决方案1】:

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

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

    从这一行,我们知道chef试图执行以下命令在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 资源来执行此操作。

    【讨论】:

    • 是的,但我使用的是rackboxdatabox,它们应该在没有任何配置的情况下运行。我更新了我的问题并包含了节点配置文件。
    • @aisensiy 添加节点属性不会改变您需要在尝试创建用户之前创建缺少的“部署”组的事实。您需要查看厨师食谱代码。
    猜你喜欢
    • 2014-06-25
    • 1970-01-01
    • 1970-01-01
    • 2015-04-11
    • 1970-01-01
    • 1970-01-01
    • 2020-12-16
    • 2019-01-25
    • 1970-01-01
    相关资源
    最近更新 更多