Puppet 6.0.2 : Install on Ubuntu 18.04 (bionic) – 2020 – BogoToBogo

Puppet 6.0.2 : Install on Ubuntu 18.04 (Bionic)

Puppet with Amazon AWS I – Puppet Accounts with Amazon AWS II (ssh and puppetmaster/puppet installation) Puppet with Amazon AWS III – Puppet running Hello World Puppet Code Basics – Terminology Puppet with Amazon AWS on CentOS 7 (I) – Master Configuration in EC2 Puppet with Amazon AWS on CentOS 7 (II) – Configuring a Puppet Master Server with Passenger and Apache Puppet master /agent Installing Ubuntu 14.04 on EC2 nodes Subsequent tasks to Puppet master – master’s installation Configuring names and certificates, post-installation tasks of the Puppet agent: configure the agent, hostnames, and EC2 signing request Basic tasks of the Puppet master/agent: main manifest with a resource/file module and immediate execution on an agent node Configuring puppet master and agent with simple scripts on EC2 / remote installation from the EC2 desktop Puppet – Install lamp with a manifest (‘puppet apply’) EC2 Puppet – Install lamp with a module Puppet Variable Scope Puppet packages, services and files Puppet packages, services and files II with nginx Puppet templates Create and manage Puppet user accounts with SSH Puppet access Locking user accounts and deploying sudoer files Puppet Forge Executive Resource Puppet Forge classes and modules Puppet Express Modules Puppet Express 2 Puppet 4 : Changes Puppet -configprint Puppet with Docker Puppet 6.0.2 install on Ubuntu 18.04

Puppet is a configuration management tool. The user describes system resources and their status, either using a declarative language of Ruby DSL or Puppet. This system information is stored in files called manifest files. Puppet discovers system information through a utility called Facter and compiles the manifests into a system-specific catalog containing resources and resource dependency, which are enforced against target systems. Any action taken by Puppet is reported.

We can configure systems with Puppet either in a client-server architecture, using the Puppet agent and Puppet master applications, or in a standalone architecture, using the Puppet application application.

Puppet is available in two versions, Enterprise and Open Source.

In an agent-master architecture, configuration information is controlled by a Puppet master server, and each managed agent node requests its own configuration catalog from the master. Each Puppet agent periodically sends data to the Puppet master and requests a catalog. The master compiles and returns the catalog for that node, using various sources of information to which it has access.

Once it receives a catalog, the Puppet agent applies it to the node by checking each resource that describes the catalog.

After applying the catalog, the agent sends a report to the Puppet master.

Before we begin, we will need to configure the /etc/hosts file and /etc/hostname on the Server node and the agent node, so that they can communicate with each other.

On server node /etc/hosts: 172.31.41.98 puppet /etc/hostname: puppet

On agent node

: /etc/hosts: 172.31.41.98 puppet /

etc/hostname

: agent

Restart the nodes, and then we will see that the hostnames have been changed to the new names

: ubuntu@puppet:~$ ubuntu@agent:~$

Install the puppetlabs-release repository on Ubuntu 18.04 and update our system.

Ref: Puppet Server: Installing from Packages

This process downloads a .deb file that will configure the repositories for us

: $ wget https://apt.puppetlabs.com/puppet6-release-bionic.deb $ sudo dpkg -i puppet6-release-bionic.deb $ sudo apt update

Install the puppet server

: $ sudo apt-get install puppetserver

Generate a root and intermediate signature CA for Puppet

Server: root@puppet:~# PuppetServer CA Configuration

Start the

Puppet Server service: $ sudo systemctl start puppetserver

or

$ sudo service puppetserver start $ puppetserver -version puppetserver version: 6.0.2

By default, Puppet Server is configured to use 2 GB of RAM. However, if we want to experiment with Puppet Server in a virtual machine, we can safely allocate as little as 512 MB of memory. To change the memory allocation of the Puppet server, we can edit the startup configuration file, /etc/default/puppetserver

: Update the

line:

# Modify this if you want to change the memory allocation, enable JMX, etc JAVA_ARGS=”-Xms2g -Xmx2g”

Replace 2g with the amount of memory you want to allocate to Puppet Server. For example, to allocate 1 GB of memory, use JAVA_ARGS=”-Xms1g -Xmx1g”; for 512 MB, use JAVA_ARGS=”-Xms512m -Xmx512m”.

Update /etc/puppet

/puppet.conf and add the dns_alt_names line to the [main] section, replacing puppet.example.com with our own FQDN: [main]

server=puppet

Start the Puppet server and enable it to start at boot with the following command

: $ sudo systemctl start puppetserver $ sudo systemctl enable puppetserver

On agent nodes running Ubuntu 18.04, use this command to

install Puppet (Puppet Agent Installation: Linux): $ wget https://apt.puppetlabs.com/puppet6-release-bionic.deb $ sudo dpkg -i puppet6-release-bionic.deb $ sudo apt update $ sudo apt-get install puppet-agent Start the puppet service: $ sudo /opt/puppetlabs/bin/

puppet resource service

puppet ensure=running enable=true

Modify the host file of our Puppet Agent (/etc/hosts ) to resolve

the Puppet master IP as puppet: 172.31.41.98 puppet Add the server value to the [main]

section of node ‘s /etc/puppet/puppet.conf, replacing puppet.example.com with the FQDN of our Puppet master: [main]

server=puppet.example.com Restart the Puppet service: $ sudo systemctl start puppet $ sudo systemctl enable puppet In

the Puppet master:

Run sudo /opt/puppetlabs/bin/puppetserver ca

List to view pending requests. Run sudo /opt/puppetlabs/bin/puppetserver ca

sign

<NAME

> to sign a request.

Because each Puppet agent runs for the first time, it sends a certificate signing request (CSR) to the CA Puppet master. You must log on to that server to find and sign certificates. After signing an agent’s certificate, you regularly obtain and apply configuration catalogs from the Puppet master.

On the master node

: root@puppet:~# puppetserver ca list Requested certificates: agent.ec2.internal (SHA256) B6:D5:16:E2:0D:CA:21:4A:94:48:19:06:7B:85:8A:F7:21:EC:2E:8D:D6:14:3E:D4:FA:58:4A:94:8F:BE:B5:0D ip-172-31-33-206.ec2.internal (SHA256) 72:FE:09:08:0F:7A:14:B1:34:41:FA:C4:7C:C0:5F:31:FA:57:B9:B3:F7:8C:33:5B:94:96:25:88:2A: CC:86:E4 root@puppet:~# puppetserver ca sign -certname agent.ec2.internal Successfully signed certificate request for agent.ec2.internal

On the agent node

: root@agent:~# puppet agent -t Information: Using the configured environment ‘production’ Information: Retrieving pluginfacts Information: Retrieving plugin Information: Retrieving locales Information: Caching Catalog for agent.ec2.internal Information: Applying the version of ‘1540876180’ configuration Notice: Catalog applied in 0.01 seconds

To create a simple Puppet manifest to install the Nginx web server. Let’s start by creating a folder path for the nginx class. The /etc/puppet/modules directory will host all our modules.

$ sudo mkdir -p /etc/puppet/modules/nginx/manifests Then, create the nginx

resource by creating a file, /etc/puppet/modules/nginx/manifests/

nginx.pp: class nginx { package { ‘nginx’: ensure => installed, } service { ‘nginx’: ensure => true, enable => true, require => Package[‘nginx’], } }

We may want to run the puppet agent -test command (from the agent node), if we do not want to wait for the scheduled extraction of the Puppet agent.

On the Puppet master, install the

Puppet Forge puppetlabs-apache module: # ./puppet module install puppetlabs-apache Notice: Preparing to install in /etc/puppetlabs/code/environments/production/modules … Notice: Downloading from https://forgeapi.puppet.com … Warning: Installing – do not interrupt … /etc/puppetlabs/code/environments/production/modules |- puppetlabs-apache (v3.4.0) |- puppetlabs-concat (v5.1.0) |- puppetlabs-stdlib (v5.1.0)

Now in /etc/puppet/manifest/site.pp

: node ‘agent01’ { class { ‘apache’: } # use apache module apache::vhost { ‘example.com’: # define vhost resource port => ’80’, docroot => ‘/var/www/html’ } } Puppet with Amazon AWS I – Puppet Puppet Accounts with Amazon AWS II (ssh & installation from puppetmaster/puppet) Puppet with Amazon AWS III – Puppet running Hello World Puppet Code Basics – Terminology Puppet with Amazon AWS on CentOS 7 (I) – Master Configuration in EC2 Puppet with Amazon AWS on CentOS 7 (II) – Configuring a Puppet Master Server with Passenger and Apache Puppet master / agent Installing Ubuntu 14.04 on EC2 nodes Post-installation tasks of the puppet master – configuring names and certificates of the master master, Puppet Agent Post-Installation Tasks: Configure the EC2 Agent, Hostnames, and Signing Request Basic Puppet Master/Agent Tasks: Main Manifest with a File Resource/Module and Immediate Execution on an Agent Node Configuring Puppet Master and Agent with Simple Scripts on EC2 / Remote Installation from the Desktop EC2 Puppet – Install lamp with a manifest (‘puppet apply’) EC2 Puppet – Install lamp with one module Puppet variable range Puppet packages, services and files Puppet packs, services and files II with nginx Puppet templates Create and manage Puppet user accounts with SSH Puppet access Locking user accounts and deploying sudoer files Puppet Executive Resource Puppet Forge classes and modules Puppet Express Modules Puppet Express 2 Puppet 4 : Changes Puppet -configprint Puppet with Docker Puppet 6.0.2 install on Ubuntu 18.04