Linuix 安装 puppet 6.0
Ubuntu 16.04 安装 puppet
官方网址:https://puppet.com/docs/puppetserver/6.0/install_from_packages.html
- 配置 apt 仓库源
wget https://apt.puppet.com/<PLATFORM_VERSION>-release-<VERSION CODE NAME>.deb
其中 <PLATFORM_VERSION> 为 puppet 的版本,<VERSION CODE NAME> 为 系统的 code name*(可参考code name)
例如:系统为 Ubuntu 16.04 安装 puppet6 版
wget https://apt.puppetlabs.com/puppet6-release-xenial.deb
sudo dpkg -i puppet6-release-xenial.deb
sudo apt-get update
puppetserver 端安装
- 安装
puppetserver
sudo apt-get install puppetserver puppetdb puppetdb-termini -y
- 创建
puppetserver软连接
sudo ln -s /opt/puppetlabs/server/apps/puppetserver/bin/puppetserver /usr/bin/puppetserver
sudo ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
sudo ln -s /opt/puppetlabs/server/apps/puppetdb/bin/puppetdb /usr/bin/puppetdb
- 生成签名配置文件
sudo puppetserver ca setup
- 安装 postgresql
sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/postgresql.list | tee -a
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
sudo apt-get update
sudo apt-get install postgresql-11 postgresql-contrib
$ sudo -u postgres sh
$ createuser -DRSP puppetdb
$ createdb -E UTF8 -O puppetdb puppetdb
$ exit
$ sudo -u postgres sh
$ psql puppetdb -c 'create extension pg_trgm'
$ exit
/etc/postgresql/11/main/pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
- 重启
postgresql
$ sudo service postgresql restart
$ psql -h localhost puppetdb puppetdb
/etc/puppetlabs/puppetdb/conf.d/database.ini
subname = //;localhost:5432/puppetdb
username = puppetdb
password = puppetdb
~
- 启动
puppetdb
puppet-agent 端安装
- 安装 puppet-agent
sudo apt-get install puppet-agent -y
sudo ln -s /opt/puppetlabs/bin/puppet /usr/bin/puppet
CnetOS 安装 puppet6
配置文件
server 端
root@puppetmaster:/etc# tree puppetlabs/
puppetlabs/
├── code
│ ├── environments
│ │ └── production
│ │ ├── data
│ │ ├── environment.conf
│ │ ├── hiera.yaml
│ │ ├── manifests
│ │ └── modules
│ └── modules
├── puppet
│ ├── auth.conf
│ ├── hiera.yaml
│ ├── puppet.conf
│ └── ssl
│ ├── ca
│ │ ├── ca_crl.pem
│ │ ├── ca_crt.pem
│ │ ├── ca_key.pem
│ │ ├── ca_pub.pem
│ │ ├── infra_crl.pem
│ │ ├── infra_inventory.txt
│ │ ├── infra_serials
│ │ ├── inventory.txt
│ │ ├── requests
│ │ ├── root_key.pem
│ │ ├── serial
│ │ └── signed
│ │ └── puppetmaster.pem
│ ├── certificate_requests
│ ├── certs
│ │ ├── ca.pem
│ │ └── puppetmaster.pem
│ ├── crl.pem
│ ├── private
│ ├── private_keys
│ │ └── puppetmaster.pem
│ └── public_keys
│ └── puppetmaster.pem
├── puppetserver
│ ├── conf.d
│ │ ├── auth.conf
│ │ ├── ca.conf
│ │ ├── global.conf
│ │ ├── metrics.conf
│ │ ├── puppetserver.conf
│ │ ├── web-routes.conf
│ │ └── webserver.conf
│ ├── logback.xml
│ ├── request-logging.xml
│ └── services.d
│ └── ca.cfg
└── pxp-agent
└── modules
agent 端
root@puppetagent1:/etc# tree puppetlabs/
puppetlabs/
├── code
│ ├── environments
│ │ └── production
│ │ ├── data
│ │ ├── environment.conf
│ │ ├── hiera.yaml
│ │ ├── manifests
│ │ └── modules
│ └── modules
├── puppet
│ ├── auth.conf
│ ├── hiera.yaml
│ ├── puppet.conf
│ └── ssl
│ ├── certificate_requests
│ ├── certs
│ ├── private
│ ├── private_keys
│ │ └── puppetagent1.pem
│ └── public_keys
│ └── puppetagent1.pem
└── pxp-agent
└── modules
Server 端配置
/etc/puppetlabs/puppet/puppet.conf
[main]
certname = puppetmaster01.example.com
server = puppet
environment = production
runinterval = 1h
strict_variables = true
[master]
dns_alt_names = puppetmaster01,puppetmaster01.example.com,puppet,puppet.example.com
reports = puppetdb
storeconfigs_backend = puppetdb
storeconfigs = true
environment_timeout = unlimited
autosign = true
autosign = /etc/puppetlabs/puppet/autosign.conf
agent 端配置
/etc/puppetlabs/puppet/puppet.conf
[main]
certname = agent01.example.com
server = puppet
environment = production
runinterval = 1h

浙公网安备 33010602011771号