Here we are installing and configuring puppet 4 server, agent and puppetdb,
Step 1: Install puppet4 server and agent
Follow this link to Install puppet4 server and agent do not start puppetserver .Once puppetserver is installed properly. Before moving ahead make sure your host name is setup properly.
Step 2 : Setup host resolution :
vi /etc/hosts
127.0.0.1 localhost 192.168.43.164 puppet puppet.example.testlab
Step 3: Edit puppet conf file.
Edit ” /etc/puppetlabs/puppet/puppet.conf ” and add below to your puppet.conf file. Remember “dns_alt_names” in conf files should match to your host name and domain as you specified in your hosts/dns file.
[main] certname = puppet.example.testlab server = puppet environment = production runinterval = 1h [master] vardir = /opt/puppetlabs/server/data/puppetserver logdir = /var/log/puppetlabs/puppetserver rundir = /var/run/puppetlabs/puppetserver pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid codedir = /etc/puppetlabs/code dns_alt_names = puppet,puppet.example.testlab storeconfigs = true storeconfigs_backend = puppetdb reports = store,puppetdb environment_timeout = unlimited
Step4: Create puppetservers certificate
sudo puppet master --no-daemonize --verbose
Press ctrl+c once it has created server certificate properly. cert get installed in ” /etc/puppetlabs/puppet/ssl/ ” directory
Step 5: Installing and Configuring puppetDB
Install postgresql follow this link Here
After installation locate postgresql.conf and add following at the end of file:
$ vi /etc/postgresql/9.5/main/postgresql.conf
listen_addresses = '*'
After that locate pg_hba.conf file and add or edit following to it in order to accept local and remote connection by postgresql db.
$ vi /etc/postgresql/9.5/main/pg_hba.conf
local all all md5 host all all 127.0.0.1/32 md5 host all all 0.0.0.0/0 md5
Start postgresql service:
$ systemctl start postgresql.service
Create puppet database user and database as follows:
$ sudo -u postgres sh
$ createuser -DRSP puppetdb
$ createdb -E UTF8 -O puppetdb puppetdb
$ exit
You should install the RegExp-optimized index extension pg_trgm
. This may require installing the postgresql-contrib
(or equivalent) package, depending on your distribution:
$ sudo -u postgres sh
$ psql puppetdb -c 'create extension pg_trgm'
$ exit
Make sure you are able to connect to the database using below:
psql -h localhost puppetdb puppetdb psql -h puppet.example.testlab puppetdb puppetdb
Install puppetDB :
sudo puppet resource package puppetdb ensure=latest
After puppetDB installation you will able to see various files and directories inside ” /etc/puppetlabs/puppetdb ” go to conf.d directory and edit ” /etc/puppetlabs/puppetdb/conf.d/database.ini ” add following :
[database] classname = org.postgresql.Driver subprotocol = postgresql # The database address, i.e. //HOST:PORT/DATABASE_NAME subname = //localhost:5432/puppetdb # Connect as a specific user username = puppetdb # Use a specific password password = mypassword # How often (in minutes) to compact the database gc-interval = 60 # Number of seconds before any SQL query is considered 'slow'; offending # queries will not be interrupted, but will be logged at the WARN log level. log-slow-statements = 10
Install puppetdb-terminus:
sudo puppet resource package puppetdb-terminus ensure=latest
Edit routes.yaml file.
puppet master --configprint route_file vi /etc/puppetlabs/puppet/routes.yaml
Add following routes to it:
--- master: facts: terminus: puppetdb cache: yaml
Add or edit ” /etc/puppetlabs/puppet/puppetdb.conf ” and add following to it :
[main] server_urls = https://puppet.example.testlab:8081
Make sure the hostname you specify in above url should match to certificate you have for puppetdb inside ” /etc/puppetlabs/puppetdb/ssl/ ”
openssl x509 -in public.pem -text -noout|grep DNS DNS:puppet, DNS:puppet.example.testlab
Step 6: Change ownership of puppet config directory :
sudo chown -R puppet:puppet `sudo puppet config print confdir`
Step 7: Start puppetdb service
systemctl start puppetdb.service
Step 8:Finally start puppetserver :
systemctl start puppetserver.service
Step 9: Test manifests:
Add/edit site.pp file ” /etc/puppetlabs/code/environments/production/manifests/site.pp ”
node default { notify { "I'm notifying you.": } }
Step 10: Run puppet agent :
If everything is configured properly you should something below.(don’t forget to sign certificates )
puppet agent -tv Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugins Info: Caching catalog for puppet.example.testlab Info: Applying configuration version '1497593520' Notice: I'm notifying you. Notice: /Stage[main]/Main/Node[puppet]/Notify[I'm notifying you.]/message: defined 'message' as 'I'm notifying you.' Notice: Applied catalog in 0.12 seconds
Source : https://docs.puppet.com
Warning: count(): Parameter must be an array or an object that implements Countable in /home/vhosts/howtolinuxblog.orgfree.com/wp-includes/class-wp-comment-query.php on line 399
MOST COMMENTED
Uncategorized
Ubuntu 16.04 No desktop only shows background wallpaper
Administration / DNS / Linux
Dig command examples
Virtualization
OpenVz(Kernel Base Open source Virtulization)
Uncategorized
Install Ansible on Linux
Puppet
Configuring puppet4 server agent and puppetdb on ubuntu16.04
Database
Installing postgresql on ubuntu 16.04
Puppet
opensource puppet4 installation on ubuntu16.04