Puppet Add Users

Task :

As a new teammate has joined Nautilus application development team, the application development team has asked the DevOps team to create a new user for the new teammate on all application servers in Stratos Datacenter. The task needs to be performed using Puppet only. You can find more details below about the task.

Create a Puppet programming file blog.pp under /etc/puppetlabs/code/environments/production/manifests directory on master node i.e Jump Server, and using Puppet user resource add a user on all app servers as mentioned below:

Create a user ravi and set its UID to 1200 on all Puppet agent nodes i.e all App Servers.
Note: Please perform this task using blog.pp only, do not create any separate inventory file.

Solutions :

# cd /etc/puppetlabs/code/environments/production/manifests
# vi blog.pp
node 'stapp01.stratos.xfusioncorp.com','stapp02.stratos.xfusioncorp.com','stapp03.stratos.xfusioncorp.com' {
include user
class user {
   user { 'ravi':
      ensure => present,
      uid => '1200',
      home => '/home/ravi',
      managehome => true
$ ssh tony@stapp01
# sudo puppet agent -tv
$ id -u ravi

$ ssh steve@stapp02
# puppet agent -tv
$ id -u ravi

$ ssh banner@stapp03
# puppet agent -tv
$ id -u ravi

Leave a Reply

Your email address will not be published. Required fields are marked *