April 21, 2016

First Puppet manifest !

Posted in Puppet tagged , at 1:44 pm by alessiodini


Today I wrote my first puppet manifest ( I have a masterless puppet environment ).
The customer needs to use puppet during openstack instances creation letting it install middleware products and apply some configuration.

I wanted to try a jboss useradd via puppet and it worked!!!
Following the manifest I wrote:

[root@node1 tmp]# cat jboss.pp
user {'jboss':
ensure => 'present',
shell => '/bin/bash',
home => '/home/jboss',
managehome => 'true',
password => '$6$u2mt6rcq$x7DiM5E2vDjuIFYSxmPWFRNShkvNbeonZjSG3DQZm66Vxlkb5hGAg3nJ5DCBTQYzTFP24bNX9BicrRQwqVzs.0'
}

group {'jboss':
ensure => 'present',
}

I tried to execute it:

[root@node1 tmp]# puppet apply jboss.pp
Notice: Compiled catalog for node1 in environment production in 8.32 seconds
Notice: /Stage[main]/Main/User[jboss]/ensure: created
Notice: Finished catalog run in 0.15 seconds

Nice!!
I was curious to test the user , so I opened a new putty and I tried the connection with the new credentials:

login as: jboss
jboss@192.168.111.130's password:
Last login: Thu Apr 21 15:26:46 2016 from 192.168.111.1
[jboss@node1 ~]$
[jboss@node1 ~]$
[jboss@node1 ~]$ id
uid=502(jboss) gid=502(jboss) groups=502(jboss) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[jboss@node1 ~]$ pwd
/home/jboss
[jboss@node1 ~]$

Advertisements