Friday, 7 October 2016

Messing about with Puppet - It Begins

So, today I learned Puppet …. :-)

Well, to be more honest, I've started to tinker with Puppet, using it to … create a group and a user on a Linux server :-)

Initially, I started with a mixture of Linux boxes; one Ubuntu 16.04 and one Red Hat 6.6.

This may have led to my confusion ….

So I started again with a pair of Red Hat 6.6 boxes.

In both cases, I added the appropriate Red Hat Enterprise Linux 6 repository ( el-6 ): -

sudo gpg --keyserver pgp.mit.edu --recv-key 7F438280EF8D349F
sudo gpg --list-key --fingerprint 7F438280EF8D349F

On the Puppetmaster server, I installed the Puppet Server binary: -

sudo yum install puppetserver

On the Puppet client, I installed the Puppet Agent binary: -

sudo yum install puppet-agent

and started the Puppet service: -

sudo service puppetserver start

Again, on the client, I setup the Puppet environment: -

vi /etc/puppetlabs/puppet/puppet.conf

[main]

started the agent: -

sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true

and invoked the Puppet test: -

sudo /opt/puppetlabs/bin/puppet agent —test

Info: Caching certificate_revocation_list for ca
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for client.uk.ibm.com
Info: Applying configuration version '1475866304'


This generates a Certificate Request on the Puppet server, which I then signed: -

sudo /opt/puppetlabs/bin/puppet cert sign client.uk.ibm.com

Finally, I used the Puppet resource command to generate the syntax for group and user creation: -

sudo puppet resource -e group wasadmins
sudo puppet resource -e user wasadmin

to allow me to create a manifest: -

vi /etc/puppetlabs/code/environments/production/manifests/site.pp 

group { 'wasadmins':
  ensure => 'present',
  gid    => '506',
}

user { 'wasadmin':
  ensure           => 'present',
  home             => '/home/wasadmin',
  password         => '$6$wjKn96pk$2yZ.jzYYDTrlc7NhvdRprJ1MzkSKfjCK8.BcBe1Cnh1viIA7S98mlnHPEPk0NYdjPkT9bhaqOuxb5/QQq2cl9.',
  password_max_age => '99999',
  password_min_age => '0',
  shell            => '/bin/bash',
  uid              => '509',

  gid              => '506',
  comment          => 'wasadmin',
  groups           => 'wasadmins',
}


I re-ran the Puppet Agent test: -

sudo /opt/puppetlabs/bin/puppet agent —test

Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for mta2015a.uk.ibm.com
Info: Applying configuration version '1475868429'
Notice: /Stage[main]/Main/Group[wasadmins]/ensure: created
Notice: /Stage[main]/Main/User[wasadmin]/ensure: created
Notice: Applied catalog in 0.07 seconds
Now to extend this to create ALL the users and groups, then install DB2 and IBM MQ and then ……...

As ever, I had plenty of references: -








No comments:

Yay, VMware Fusion and macOS Big Sur - no longer "NAT good friends" - forgive the double negative and the terrible pun ...

After macOS 11 Big Sur was released in 2020, VMware updated their Fusion product to v12 and, sadly, managed to break Network Address Trans...