• 安装puppet


    安装puppet服务  

    先安装ruby语言包、ruby标准库、ruby shadow库
    yum install -y ruby ruby-libs ruby-shadow
    2.需要添加EPRL库,来支持puppet
    [root@test date]#wget http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    [root@test date]#rpm -Uvh epel-release-6-8.noarch.rpm
    如果你的系统是其他版本或者是32位的,可以到网站:
    dl.fedoraproject.org查找你们想要的

    在 master上安装和启用 puppet 服务:
    [root@master ~]# yum install -y puppet puppet-server facter

    [root@master ~]# chkconfig --list |grep puppet

    puppet 0:off 1:off 2:off 3:off 4:off 5:off 6:off

    puppetmaster 0:off 1:off 2:off 3:off 4:off 5:off 6:off

    [root@master ~]# chkconfig puppet on

    [root@master ~]# service puppetmaster start

    Starting puppetmaster: [ OK ]

    [root@master ~]#vi /etc/sysconfig/network

    hostname master.test.com

    在clients上安装puppet客户端

    [root@node1 ~]# yum install -y puppet

    [root@node1 ~]# chkconfig --list |grep puppet

    puppet 0:off 1:off 2:off 3:off 4:off 5:off 6:off

    [root@node1 ~]# chkconfig puppet on

    [root@node1 ~]# chkconfig --list |grep puppet

    puppet 0:off 1:off 2:on 3:on 4:on 5:on 6:off

    [root@node1 ~]# service puppet start

    Starting puppet agent: [ OK ]

    [root@node1 ~]#

    在clients上解析pupetmaster 的域名

    [root@node1 ~]#vim /etc/hosts

    192.168.50.30 master.test.com

    3.配置puppet

    对于puppet 客户端,修改/etc/puppet/puppet.conf,指定master服务器
    [main]

    # The Puppet log directory.

    # The default value is '$vardir/log'.

    logdir = /var/log/puppet

    # Where Puppet PID files are kept.

    # The default value is '$vardir/run'.

    rundir = /var/run/puppet

    # Where SSL certificates are kept.

    # The default value is '$confdir/ssl'.

    ssldir = $vardir/ssl

    [agent]

    # The file in which puppetd stores a list of the classes

    # associated with the retrieved configuratiion. Can be loaded in# the separate ``puppet`` executable using the ``--loadclasses``

    # option.

    # The default value is '$confdir/classes.txt'.

    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration. An

    # extension indicating the cache format is added automatically.

    # The default value is '$confdir/localconfig'.

    localconfig = $vardir/localconfig

    server = master.test.com

    并重启puppet服务
    [root@node1 ~]# service puppet restart

    Stopping puppet agent: [ OK ]

    Starting puppet agent: [ OK ]

    [root@node1 ~]#

    4.Client申请证书  
    服务端自动签发证书设置  
    设置master自动签发所有的证书,我们只需要在/etc/puppet 目录下创建 autosign.conf 文件。(不需要修改 /etc/puppet/puppet.conf文件,因为我默认的autosign.conf 文件的位置没有修改)
    [root@master ~]# ll /etc/puppet/

    total 28

    -rw-r--r--. 1 root root 4178 Nov 4 06:24 auth.conf

    drwxr-xr-x. 3 root root 4096 Dec 29 15:44 environments

    -rw-r--r--. 1 root root 1462 Nov 4 06:23 fileserver.conf

    drwxr-xr-x. 2 root root 4096 Nov 4 06:24 manifests

    drwxr-xr-x. 2 root root 4096 Nov 4 06:24 modules

    -rw-r--r--. 1 root root 853 Nov 4 06:23 puppet.conf

    [root@master ~]# cat > /etc/puppet/autosign.conf <<EOF

    > *.fisteam2.com

    > EOF

    [root@master ~]# service puppetmaster restart

    Stopping puppetmaster: [ OK ]

    Starting puppetmaster: [ OK ]

    [root@master ~]#

    这样就会对所有来自fisteam2.com的机器的请求,都自动签名。  
    client需要向服务器端发出请求, 让服务器对客户端进行管理. 这其实是一个证书签发的过程. 第一次运行puppet 客户端的时候会生成一个 SSL 证书并指定发给 Puppet 服务端, 服务器端如果同意管理客户端,就会对这个证书进行签发,可以用这个命令来签发证书,由于我们已经在客户端设置了server地址,因此不需要跟服务端地址
    [root@master ~]# puppet agent

    为了详细了解注册的过程和日后排错,可以增加参数,因为配置文件里  
    –no-daemonize 前台输出日志  
    –verbose 输入更加详细的日志  
    –debug 更加详细的日志,排错的时候使用  
    –test 表示测试,就带一个–test参数就可以
    [root@node1 ~]# puppet agent --no-daemonize --onetime --verbose --debug

    CentOS6.5+Puppet3.7.3 安装、配置及测试

    就可以申请证书了,由于我配置的自动签发证书,所以直接就签发了,在服务端执行
    [root@master ~]# puppet cert list --all

    CentOS6.5+Puppet3.7.3 安装、配置及测试

    就可以看到所有客户端已经都已签发证书,前面带”+”号的就是签发成功的,如果没有签名的,可以用
    [root@master ~]# puppet cert --sign node1.localdomain

    CentOS6.5+Puppet3.7.3 安装、配置及测试

    即可看到证书已经签发。

  • 相关阅读:
    POJ 1251 Jungle Roads
    1111 Online Map (30 分)
    1122 Hamiltonian Cycle (25 分)
    POJ 2560 Freckles
    1087 All Roads Lead to Rome (30 分)
    1072 Gas Station (30 分)
    1018 Public Bike Management (30 分)
    1030 Travel Plan (30 分)
    22. bootstrap组件#巨幕和旋转图标
    3. Spring配置文件
  • 原文地址:https://www.cnblogs.com/tengfei520/p/5481172.html
Copyright © 2020-2023  润新知