puppet master /client on centos 7 with httpd/tomcat manifests

[root@localhost ~]# rpm -Uvh https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm
Retrieving https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:puppet5-release-5.0.0-4.el7      ################################# [100%]
[root@localhost ~]#  yum -y install puppetserver
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.estointernet.in
 * extras: centos.mirrors.estointernet.in
 * updates: centos.mirrors.estointernet.in
base                                                                                                                           | 3.6 kB  00:00:00   
extras                                                                                                                         | 2.9 kB  00:00:00   
puppet5                                                                                                                        | 2.5 kB  00:00:00   
updates                                                                                                                        | 2.9 kB  00:00:00   
zabbix                                                                                                                         | 2.9 kB  00:00:00   
zabbix-non-supported                                                                                                           |  951 B  00:00:00   
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package puppetserver.noarch 0:5.3.9-1.el7 will be installed
--> Processing Dependency: puppet-agent >= 4.99.0 for package: puppetserver-5.3.9-1.el7.noarch
--> Running transaction check
---> Package facter.x86_64 1:2.4.6-1.el7 will be obsoleted
---> Package hiera.noarch 0:1.3.4-1.el7 will be obsoleted
---> Package puppet-agent.x86_64 0:5.5.16-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                               Arch                            Version                                 Repository                        Size
======================================================================================================================================================
Installing:
 puppet-agent                          x86_64                          5.5.16-1.el7                            puppet5                           20 M
     replacing  facter.x86_64 1:2.4.6-1.el7
     replacing  hiera.noarch 1.3.4-1.el7
 puppetserver                          noarch                          5.3.9-1.el7                             puppet5                           53 M

Transaction Summary
======================================================================================================================================================
Install  2 Packages

Total download size: 73 M
Downloading packages:
(1/2): puppet-agent-5.5.16-1.el7.x86_64.rpm                                                                                    |  20 MB  00:00:42   
(2/2): puppetserver-5.3.9-1.el7.noarch.rpm                                                                                     |  53 MB  00:01:32   
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 808 kB/s |  73 MB  00:01:32   
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
1:mariadb-libs-5.5.64-1.el7.x86_64 is a duplicate with 1:mariadb-libs-5.5.56-2.el7.x86_64
  Installing : puppet-agent-5.5.16-1.el7.x86_64                                                                                                   1/4
  Installing : puppetserver-5.3.9-1.el7.noarch                                                                                                    2/4
usermod: no changes
  Erasing    : hiera-1.3.4-1.el7.noarch                                                                                                           3/4
  Erasing    : 1:facter-2.4.6-1.el7.x86_64                                                                                                        4/4
  Verifying  : puppet-agent-5.5.16-1.el7.x86_64                                                                                                   1/4
  Verifying  : puppetserver-5.3.9-1.el7.noarch                                                                                                    2/4
  Verifying  : 1:facter-2.4.6-1.el7.x86_64                                                                                                        3/4
  Verifying  : hiera-1.3.4-1.el7.noarch                                                                                                           4/4

Installed:
  puppet-agent.x86_64 0:5.5.16-1.el7                                         puppetserver.noarch 0:5.3.9-1.el7                                     

Replaced:
  facter.x86_64 1:2.4.6-1.el7                                                hiera.noarch 0:1.3.4-1.el7                                             

Complete!

[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.10.2  netmask 255.255.255.240  broadcast 172.20.10.15
        inet6 fe80::e9b6:a1b4:d2c0:6d7b  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c8:6f:d4  txqueuelen 1000  (Ethernet)
        RX packets 57429  bytes 80467806 (76.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28690  bytes 1931162 (1.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 9369  bytes 554106 (541.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9369  bytes 554106 (541.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:40:25:4a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# vi /etc/hosts

172.20.10.2 master.puppy.io
172.20.10.14 agent.puppy.io


[root@localhost ~]# systemctl enable puppetserver
Created symlink from /etc/systemd/system/multi-user.target.wants/puppetserver.service to /usr/lib/systemd/system/puppetserver.service.

[root@localhost ~]# cat  /etc/puppetlabs/puppet/puppet.conf
# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://puppet.com/docs/puppet/latest/config_important_settings.html
# - https://puppet.com/docs/puppet/latest/config_about_settings.html
# - https://puppet.com/docs/puppet/latest/config_file_main.html
# - https://puppet.com/docs/puppet/latest/configuration.html
[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=master.puppy.io,puppet

 [main]
 certname = master.puppy.io
 server = master.puppy.io
 environment = production
 runinterval = 1h

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

###########################################
# Init settings for puppetserver
###########################################

# Location of your Java binary (version 8)
JAVA_BIN="/usr/bin/java"

# Modify this if you'd like to change the memory allocation, enable JMX, etc
JAVA_ARGS="-Xms512m -Xmx512m -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"

[root@master ~]# service puppetserver start
Redirecting to /bin/systemctl start puppetserver.service
[root@master ~]# service puppetserver status
Redirecting to /bin/systemctl status puppetserver.service
● puppetserver.service - puppetserver Service
   Loaded: loaded (/usr/lib/systemd/system/puppetserver.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-10-01 05:52:29 IST; 27s ago
  Process: 3479 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS)
 Main PID: 3486 (java)
    Tasks: 31 (limit: 4915)
   CGroup: /system.slice/puppetserver.service
           └─3486 /usr/bin/java -Xms512m -Xmx512m -Djruby.logger.class=com.pu...

Oct 01 05:49:25 master.puppy.io systemd[1]: Starting puppetserver Service...
Oct 01 05:52:29 master.puppy.io systemd[1]: Started puppetserver Service.
[root@master ~]#



[root@master ~]# /opt/puppetlabs/bin/puppet cert sign agent.puppy.io

Warning: `puppet cert` is deprecated and will be removed in a future release.
   (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:370:in `run')
Signing Certificate Request for:
  "agent.puppy.io" (SHA256) DA:51:52:AF:C8:FF:4E:AA:94:8F:EF:A9:15:7F:E9:7D:B9:11:66:CA:CB:37:A5:64:DF:FC:69:8D:C5:01:14:A5
Notice: Signed certificate request for agent.puppy.io
Notice: Removing file Puppet::SSL::CertificateRequest agent.puppy.io at '/etc/puppetlabs/puppet/ssl/ca/requests/agent.puppy.io.pem'
[root@master ~]#

root@master ~]# /opt/puppetlabs/bin/puppet cert list

Warning: `puppet cert` is deprecated and will be removed in a future release.
   (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:370:in `run')
[root@master ~]#

client side


[root@localhost ~]# rpm -Uvh https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm
Retrieving https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:puppet5-release-5.0.0-4.el7      ################################# [100%]
[root@localhost ~]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.10.14  netmask 255.255.255.240  broadcast 172.20.10.15
        inet6 fe80::e9b6:a1b4:d2c0:6d7b  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::e5da:5dbc:3974:b514  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a4:be:44  txqueuelen 1000  (Ethernet)
        RX packets 3638  bytes 3751548 (3.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2411  bytes 175346 (171.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 158  bytes 9275 (9.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 158  bytes 9275 (9.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:40:25:4a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# yum install -y puppet-agent
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                            | 6.4 kB  00:00:00   
 * base: mirror.nbrc.ac.in
 * epel: repos.del.extreme-ix.org
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
base                                                            | 3.6 kB  00:00:00   
extras                                                          | 2.9 kB  00:00:00   
puppet5                                                         | 2.5 kB  00:00:00   
sensu                                                           | 2.5 kB  00:00:00   
updates                                                         | 2.9 kB  00:00:00   
puppet5/x86_64/primary_db                                       | 251 kB  00:00:01   
Resolving Dependencies
--> Running transaction check
---> Package facter.x86_64 1:2.4.6-1.el7 will be obsoleted
---> Package puppet-agent.x86_64 0:5.5.16-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package               Arch            Version                  Repository        Size
=======================================================================================
Installing:
 puppet-agent          x86_64          5.5.16-1.el7             puppet5           20 M
     replacing  facter.x86_64 1:2.4.6-1.el7

Transaction Summary
=======================================================================================
Install  1 Package

Total download size: 20 M
Downloading packages:
puppet-agent-5.5.16-1.el7.x86_64.rpm                            |  20 MB  00:00:33   
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : puppet-agent-5.5.16-1.el7.x86_64                                    1/2
  Erasing    : 1:facter-2.4.6-1.el7.x86_64                                         2/2
  Verifying  : puppet-agent-5.5.16-1.el7.x86_64                                    1/2
  Verifying  : 1:facter-2.4.6-1.el7.x86_64                                         2/2

Installed:
  puppet-agent.x86_64 0:5.5.16-1.el7                                                 

Replaced:
  facter.x86_64 1:2.4.6-1.el7                                                       

Complete!
[[root@localhost ~]# cat /etc/hosts
172.20.10.2 master.puppy.io
172.20.10.14 agent.puppy.io


[root@localhost ~]# cat /etc/puppetlabs/puppet/puppet.conf

# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://puppet.com/docs/puppet/latest/config_important_settings.html
# - https://puppet.com/docs/puppet/latest/config_about_settings.html
# - https://puppet.com/docs/puppet/latest/config_file_main.html
# - https://puppet.com/docs/puppet/latest/configuration.html
[main]
 certname = agent.puppy.io
 server = master.puppy.io
 environment = production
 runinterval = 1h

[root@localhost ~]# firewall-cmd --add-port=8140/tcp --permanent

success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]# /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true

Notice: /Service[puppet]/ensure: ensure changed 'stopped' to 'running'
service { 'puppet':
  ensure => 'running',
  enable => 'true',
}
[
[root@localhost ~]# /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true

service { 'puppet':
  ensure => 'running',
  enable => 'true',
}
[root@localhost ~]#

[root@localhost ~]# /opt/puppetlabs/bin/puppet cert list

Warning: `puppet cert` is deprecated and will be removed in a future release.
   (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:370:in `run')
[root@localhost ~]# 


[root@localhost ~]# /opt/puppetlabs/bin/puppet agent --test

Info: Caching certificate for agent.puppy.io
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for agent.puppy.io

Info: Using configured environment 'production'
Info: Retrieving pluginfacts

Info: Caching catalog for agent.puppy.io
Info: Applying configuration version '1569889798'
Notice: Applied catalog in 0.02 seconds

on server side
create manifest

[root@master ~]# cd /etc/puppetlabs/code/
[root@master code]# cd environments/production/manifests

[root@master manifests]# cat site.pp
node 'agent.puppy.io' {
     package { 'httpd':
         ensure  => "installed",
     }
     service { 'httpd':
         ensure => running,
     enable => true
     }
 }
[root@master manifests]# 

on client side

/opt/puppetlabs/bin/puppet agent --test


Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for agent.puppy.io
Info: Applying configuration version '1569890540'
Notice: /Stage[main]/Main/Node[agent.puppy.io]/Service[httpd]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Main/Node[agent.puppy.io]/Service[httpd]: Unscheduling refresh on Service[httpd]
Notice: Applied catalog in 3.78 seconds

on server side 

[root@master manifests]# cat  site.pp
node 'agent.puppy.io' {
     package { 'tomcat':
         ensure  => "installed",
     }
     service { 'tomcat':
         ensure => running,
     enable => true
     }
 }


on client side 

/opt/puppetlabs/bin/puppet agent --test


Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for agent.puppy.io

Info: Applying configuration version '1569891066'
Notice: /Stage[main]/Main/Node[agent.puppy.io]/Package[tomcat]/ensure: created
Notice: /Stage[main]/Main/Node[agent.puppy.io]/Service[tomcat]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Main/Node[agent.puppy.io]/Service[tomcat]: Unscheduling refresh on Service[tomcat]
Notice: Applied catalog in 80.21 seconds


server side 

node 'agent.puppy.io' {
     package { 'tomcat':
         ensure  => "installed",
     }
     package { 'tomcat-admin-webapps':
         ensure  => "installed",
     }
     package { 'tomcat-webapps':
         ensure  => "installed",
     }
     service { 'tomcat':
         ensure => running,
     enable => true
     }
 }
~                   

client side

Info: Applying configuration version '1569891523'
Notice: /Stage[main]/Main/Node[agent.puppy.io]/Package[tomcat-admin-webapps]/ensure: created
Notice: /Stage[main]/Main/Node[agent.puppy.io]/Package[tomcat-webapps]/ensure: created
Notice: Applied catalog in 24.05 seconds


[root@localhost ~]#  rpm -qa | grep tomcat
tomcat-7.0.76-9.el7_6.noarch
tomcat-webapps-7.0.76-9.el7_6.noarch
tomcat-admin-webapps-7.0.76-9.el7_6.noarch

server side
[root@master manifests]# cat  site.pp
node 'agent.puppy.io' {
     package { 'mariadb-server':
         ensure  => "installed",
     }
     service { 'mariadb':
         ensure => running,
     enable => true
     }
 }
[root@master manifests]# 
client side

sion 1.8.6
Info: Applying configuration version '1569892112'
Notice: /Stage[main]/Main/Node[agent.puppy.io]/Package[mariadb-server]/ensure: created
Notice: /Stage[main]/Main/Node[agent.puppy.io]/Service[mariadb]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Main/Node[agent.puppy.io]/Service[mariadb]: Unscheduling refresh on Service[mariadb]

[root@localhost ~]#  rpm -qa | grep mariadb
mariadb-5.5.64-1.el7.x86_64
mariadb-libs-5.5.64-1.el7.x86_64
mariadb-server-5.5.64-1.el7.x86_64
[root@localhost ~]# 


Comments