阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Puppet入门基础学习

150次阅读
没有评论

共计 2289 个字符,预计需要花费 6 分钟才能阅读完成。

一、查看官方提供的下载源

https://docs.puppet.com/guides/puppetlabs_package_repositories.html

二、选择对应系统的下载源

      因为本机是 CentOS 7.1,故选择 YUM 源

      https://yum.puppetlabs.com/

三、安装 Puppet

      # wget https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm

      # rpm -ivh puppetlabs-release-el-7.noarch.rpm

      # yum install puppet -y

      # puppet –version

        3.8.7

四、Puppet 配置文件介绍

Puppet 的主配置文件均放到 /etc/puppet 目录下,3.8.7 版本有以下几个文件

auth.conf  modules  puppet.conf

其中:

puppet.conf 是 Master 守护进程的主配置文件,定义了 Master 的运行环境,启动加载文件等信息。守护进程在启动前会根据这个文件进行预检,只要预检成功才能启动

守护进程。

auth.conf 主要用来定义 Agent 访问 Master 上目录的权限。如果没有权限控制的话,Agent 可以访问 Master 服务器上的所有资源。

五、安装 nginx 包并启动 nginx 服务

安装 nginx 包,可先通过 puppet resource 命令生成相关的模板,然后再对其进行编辑。

[root@master1 ~]# puppet resource package nginx
package {‘nginx’:
  ensure => ‘absent’,
}
[root@master1 ~]# puppet resource service nginx
service {‘nginx’:
  ensure => ‘stopped’,
  enable => ‘false’,
}

    其中,puppet resource package 是生成安装包的模板,puppet resource service 是生成服务的模板

    最后,nginx 包的配置文件如下:

package {‘nginx’:
  ensure => ‘present’,
}
service {‘nginx’:
  ensure => ‘running’,
}

在本地应用该配置文件

# puppet apply nginx.pp

Notice: Compiled catalog for master1.localdomain in environment production in 0.56 seconds
Notice: /Stage[main]/Main/Package[nginx]/ensure: created
Notice: /Stage[main]/Main/Service[nginx]/ensure: ensure changed ‘stopped’ to ‘running’
Notice: Finished catalog run in 5.76 seconds

查看 nginx 包是否安装以及服务是否启动

[root@master1 ~]# rpm -qa |grep nginx
nginx-1.6.3-9.el7.x86_64
nginx-filesystem-1.6.3-9.el7.noarch
[root@master1 ~]# ps -ef |grep nginx
root      3094  3070  0 13:14 pts/2    00:00:00 tailf /var/log/nginx/error.log
root      3423      1  0 13:16 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx      3424  3423  0 13:16 ?        00:00:00 nginx: worker process
nginx      3425  3423  0 13:16 ?        00:00:00 nginx: worker process
root      3432  1536  0 13:18 pts/0    00:00:00 grep –color=auto nginx

Puppet 学习系列:

Puppet 学习一:安装及简单实例应用 http://www.linuxidc.com/Linux/2013-08/88710.htm

Puppet 学习二: 简单模块配置和应用 http://www.linuxidc.com/Linux/2013-08/88711.htm

相关阅读:

有关 Puppet agent 端三种备份恢复方案探讨研究 http://www.linuxidc.com/Linux/2013-07/87885.htm
选择更安全的方式注册你的 Puppet 节点 http://www.linuxidc.com/Linux/2013-07/87884.htm
通过配置 SSH 深刻理解 Puppet 的语法及工作机制 http://www.linuxidc.com/Linux/2013-07/87882.htm
Puppet 利用 Nginx 多端口实现负载均衡 http://www.linuxidc.com/Linux/2013-02/79794.htm
CentOS(5 和 6)下 Puppet 的 C / S 模式实例 http://www.linuxidc.com/Linux/2011-12/50502.htm

Puppet 的详细介绍 :请点这里
Puppet 的下载地址 :请点这里

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-06/132699.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计2289字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中