chef-infra - 如何在 Chef 中创建测试用户,以便 Pedant (chef-server-ctl test) 可以使用它们
问题描述
我chef-server-ctl test
每隔一段时间在我的厨师服务器上运行一次,以测试一切是否正常。我使用此测试的输出来使用监控软件监控厨师服务器。但我观察到,即使在 Pedant 的配置中(chef-server-ctl test
正在使用),它位于/var/opt/opscode/oc-chef-pedant/etc/pedant_config.rb
我有:
delete_org true
chef-server-ctl test
运行多次后仍有一些剩菜。我所说的剩菜是指chef-server-ctl test
为测试而创建但没有删除的组织和用户:
[example@example /]# chef-server-ctl user-list
pedant_nobody_chef_26547
pedant_testorg_chef_26547_owner
pedant_testorg_chef_30029_owner
pedant_user_chef_26547
pivotal
test-26547
有时 Pedant 正在删除它们,有时它们在测试后仍然没有被删除。我不知道这取决于什么。但这就是为什么我认为我将禁用测试组织的创建,/var/opt/opscode/oc-chef-pedant/etc/pedant_config.rb
而是使用现有的组织。我想对用户做同样的事情。但是pedant_config.rb
声明它需要五个不同的用户:
# Test users. The five users specified below are required; their
# names (:user, :non_org_user, etc.) are indicative of their role
# within the tests. All users must have a ':name' key. If they have
# a ':create_me' key, Pedant will create these users for you. If you
# are using pre-existing users, you must supply a ':key_file' key,
# which should be the fully-qualified path /on the machine Pedant is
# running on/ to a private key for that user.
superuser_name 'pivotal'
requestors({
:clients => {
:admin => {
:name => "pedant_admin_client_#{chef_server_uid}",
:create_me => true,
:create_knife => true,
:admin => true
},
:non_admin => {
:name => "pedant_client_#{chef_server_uid}",
:create_me => true,
:create_knife => true,
},
:bad => {
:name => "bad_client_#{chef_server_uid}",
:create_me => true,
:bogus => true
}
},
:users => {
# An administrator in the testing organization
:admin => {
:name => "pedant_admin_user_#{chef_server_uid}",
:create_me => true,
:create_knife => true,
:admin => true
},
:non_admin => {
:name => "pedant_user_#{chef_server_uid}",
:create_me => true,
:create_knife => true,
:admin => false
},
# A user that is not a member of the testing organization
:bad => {
:name => "pedant_nobody_#{chef_server_uid}",
:create_me => true,
:create_knife => true,
:associate => false
},
}
})
而且我了解如何创建将成为测试组织中的管理员的用户(pedant_admin_user_#{chef_server_uid}
截至目前在配置中),如何创建将成为一部分或组织但不是管理员(pedant_user_#{chef_server_uid}
)的用户,以及不会成为成员的用户检测机构(pedant_nobody_#{chef_server_uid}
)。但是如何从“ :clients =>
”部分创建所有这些用户,而不是“ :users =>
”?我的意思是那些有名字的人:
pedant_admin_client_#{chef_server_uid}
pedant_client_#{chef_server_uid}
bad_client_#{chef_server_uid}
这个配置对客户端意味着什么以及如何创建它们?
解决方案
不要那样做。Pedant 不适合持续使用。它是一个一致性套件,用作打包过程的一部分。它不供公众使用,也绝对不用于真正的 Chef Server 实例。
如果您想检查事情是否正在运行,请尝试chef-server-ctl status
:)
推荐阅读
- java - 在 asp.net 页面中从 android 应用程序接收数据
- android - Android 构建失败 - FormatException
- github - 是否可以仅向 github 中的协作者提供访问权限
- java - 如何使用 jenkins 将 Spring Boot jar 文件部署到 EC2?
- c++ - 如何使此函数使用 getline 读取字符串并使用 int 表现相同?
- android - 我们如何在 MainActivity 中启动一个扩展 AppCompatActivity 的活动
- visual-studio-code - 是否可以在 VS Code 中调试 Service Fabric 应用程序?
- sql - 确定计划/最低隔离级别
- android - 错误是:命令 ./gradlew 失败,退出代码为 1
- java - 通过读取 dat 文件更新 Arraylist