chef – 6. 将配置部署到节点

最后一步,我们将配置部署到节点。

服务器上选择要部署的配置(recipe)

如下面的屏幕截图所示,单击设置图标弹出菜单,选择Edit Run list来管理Run list。Run list是当前要部署的配置列表。

图

在可用的recipe中,可以看到我们的learn_chef_httpd,你可以将它拖放到当前运行列表中,然后保存运行列表。

图

节点拉取并部署配置

现在登录到节点,并运行chef-client来执行运行列表。

chef-client

输出


[root@qikegu2 ~]# chef-client Starting Chef Infra Client, version 15.3.14 resolving cookbooks for run list: ["learn_chef_httpd"] Synchronizing Cookbooks: - learn_chef_httpd (0.2.0) Installing Cookbook Gems: Compiling Cookbooks... Converging 4 resources Recipe: learn_chef_httpd::default * yum_package[httpd] action install - install version 0:2.4.6-90.el7.centos.x86_64 of package httpd * service[httpd] action enable - enable service service[httpd] * service[httpd] action start - start service service[httpd] * template[/var/www/html/index.html] action create - create new file /var/www/html/index.html - update content in file /var/www/html/index.html from none to ef4ffd --- /var/www/html/index.html 2019-10-15 00:03:42.220472531 -0400 +++ /var/www/html/.chef-index20191015-3810-m1014s.html 2019-10-15 00:03:42.220472531 -0400 @@ -1 +1,6 @@ +<html> + <body> + <h1>hello world</h1> + </body> +</html> - restore selinux security context * service[iptables] action stop (up to date) Running handlers: Running handlers complete Chef Infra Client finished, 4/5 resources updated in 31 seconds

完成!我们已经成功地安装了Chef,并将Apache从Chef服务器部署到了节点。



浙ICP备17015664号-1 浙公网安备 33011002012336号 联系我们 网站地图  
@2019 qikegu.com 版权所有,禁止转载