70
How to keep track of puppet with Foreman Glen Ogilve - [email protected]

How to keep track of puppet with Foreman

Embed Size (px)

Citation preview

Page 1: How to keep track of puppet with Foreman

How to keep track of puppetwith Foreman

Glen Ogilve - [email protected]

Page 2: How to keep track of puppet with Foreman
Page 3: How to keep track of puppet with Foreman

do?

What does the

Page 4: How to keep track of puppet with Foreman

Provisioning

"Provision on bare-metal & public or private clouds all from one place."

It does with a mix of:

hardware via network boot and automated install

virtual by connecting to the hypervisors

AMI customisation

Page 5: How to keep track of puppet with Foreman

NetworkFor network installation, it signals the target server to network boot,by communicating with the BMC or hypervisor, and creates theappropraite network boot PXE setup via the foreman proxy to installthe OS.

The contents of the network boot file are built from templates andcustomised before starting the installation. It relies on a thrid partysource for the installation media, and has templates available forJumpstart, Kickstart, Preseed, AutoYast.

Page 6: How to keep track of puppet with Foreman

Image based (AMI)For cloud based compute resources, new systems are provisionedusing images, rather than running an installation. These are thenfinished by Foreman logging into the instance via ssh.

Page 7: How to keep track of puppet with Foreman
Page 8: How to keep track of puppet with Foreman

Supported platformsEC2

Google compute engine

Libvirt

OpenStack Nova

oVirt / RHEV

Rackspace

VMware

Physical hardware via BMC

Page 9: How to keep track of puppet with Foreman

InputsWhen creating a system via foreman, it requires a number of detailsabout the new system which then are used in the templates andfinish scripts. This includes things like, disk size, cpus, memory,networks, puppet classes, host groups, variables, owner, availbilityzone, vpc, os, architecture or AMI image

Page 10: How to keep track of puppet with Foreman
Page 11: How to keep track of puppet with Foreman

Managed systemsIf you have provisioning turned on for a system, in some cases, youwill have access to the system console, and the ability todelete/rebuild the machine from the foreman console.

Page 12: How to keep track of puppet with Foreman

Turning off provisioningFor basic usage of foreman with puppet, as I am describing in thistalk, the provisioning component can be disabled. It is disabled asper below:

/etc/foreman/settings.yaml

# Disable foreman provisioning:unattended: true

Page 13: How to keep track of puppet with Foreman

Configuration

"A complete configuration management solution including an ENCfor Puppet, built-in support for parameterized classes and

hierarchical parameter storage."

Page 14: How to keep track of puppet with Foreman

ENCExternal Node Classifier

(replaces node definitions)

Page 15: How to keep track of puppet with Foreman

Parameters and metainformation

Foreman stores variables, paramters, meta information, class andfacts.

Page 16: How to keep track of puppet with Foreman

Paramerized classesControl how your classes behave, for one or many systems

Page 17: How to keep track of puppet with Foreman

Host GroupsGroup systems togeather and apply parameters and classes to the

group. Group groups.

Page 18: How to keep track of puppet with Foreman
Page 19: How to keep track of puppet with Foreman
Page 20: How to keep track of puppet with Foreman

Monitoring

"Collect Puppet reports and facts. Monitor host configuration.Report status, distribution and trends."

Page 21: How to keep track of puppet with Foreman

What did puppet do?Reports

Page 22: How to keep track of puppet with Foreman
Page 23: How to keep track of puppet with Foreman
Page 24: How to keep track of puppet with Foreman
Page 25: How to keep track of puppet with Foreman

Factsyou can use them to find out stuff

Page 26: How to keep track of puppet with Foreman
Page 27: How to keep track of puppet with Foreman
Page 28: How to keep track of puppet with Foreman

Are my hosts managed withpuppet?

Has puppet run recently?

Page 29: How to keep track of puppet with Foreman
Page 30: How to keep track of puppet with Foreman

Dashboard

Page 31: How to keep track of puppet with Foreman
Page 32: How to keep track of puppet with Foreman

Statistics

Page 33: How to keep track of puppet with Foreman
Page 34: How to keep track of puppet with Foreman

General featuresRobust API, restful. CLI as well

Management of DHCP, DNS, TFTP, PXE

PuppetCA

Roles, Users, LDAP

Packaged, managed with puppet

Auditing

Page 35: How to keep track of puppet with Foreman

Extra cool featuresForeman data accessable from puppet manifests, removing the

need for puppetdb.

Facts for any host

Hosts matching x

Classes assigned to other hosts

Page 36: How to keep track of puppet with Foreman

Review

Page 37: How to keep track of puppet with Foreman

Puppet without foremansite.pp or nodes.pp

maybe hiera

read log files

Page 38: How to keep track of puppet with Foreman

Agent runsSync pluginsSends factsPuppet master looks for node matching it's nameCompiles catalogNode applies catalogNode logs results to disk, and maybe back to themaster

Page 39: How to keep track of puppet with Foreman

node 'common' { $ntpserver = 'time.example.com' include common}node "myhost.linuxbox.co.nz" inherits common { $owner_name = "Glen Ogilvie" include basicstuff class{"mysql": port => 3306, listen => 192.168.213.12, }}

Page 40: How to keep track of puppet with Foreman

Or maybe your using hiera/etc/puppet/hieradata/myhost.linuxbox.co.nz.yaml

---"owner_name" : "Glen Ogilvie""classes" : ["mysql","basicstuff"],"mysql::port" : "3306","mysql::listen" : "192.168.213.12"

/etc/puppet/hieradata/common.yaml

---"classes" : [ "common" ],"ntpserver" : "time.example.com"

Page 41: How to keep track of puppet with Foreman

Puppet with Foreman

Page 42: How to keep track of puppet with Foreman

Agent runsSync pluginsSends factsPuppet master connects to foreman, sending nodenameForeman returns node classes and parameters tomasterCompiles catalogNode applies catalogNode logs results to disk, and to the masterMaster sends results and facts to foreman forstorage

Page 43: How to keep track of puppet with Foreman

Foreman YAML---classes: common: mysql: port: 3306 listen: "192.168.213.12" basicstuff:parameters: puppetmaster: configmgmt.oss.co.nz root_pw: $1$xxxxxxxxxxxxxxxxxxx foreman_env: dev owner_name: Glen Ogilvie owner_email: [email protected] ntpserver: time.example.comenvironment: dev

Page 44: How to keep track of puppet with Foreman

Foreman Architecture

Page 45: How to keep track of puppet with Foreman

Using Foreman

Page 46: How to keep track of puppet with Foreman

PuppetCA interfaceto sign new servers

Page 47: How to keep track of puppet with Foreman
Page 48: How to keep track of puppet with Foreman

Import your classes andenviroments

Page 49: How to keep track of puppet with Foreman
Page 50: How to keep track of puppet with Foreman

And check the rdoc basedclass docs

Page 51: How to keep track of puppet with Foreman
Page 52: How to keep track of puppet with Foreman

Setup an existing hostSet meta data like (enviroment, owner)

Attach classes and host groups

Set parameters, or overide parametrizedclasses

Page 53: How to keep track of puppet with Foreman
Page 54: How to keep track of puppet with Foreman
Page 55: How to keep track of puppet with Foreman
Page 56: How to keep track of puppet with Foreman
Page 57: How to keep track of puppet with Foreman
Page 58: How to keep track of puppet with Foreman

It keeps a record of changes

Page 59: How to keep track of puppet with Foreman

Parameterized class

# Class: apt# This module manages the initial configuration of apt.## Parameters:# disable_keys - disables package signing check# always_apt_update - apt updated on every run (for dev)

class apt( $always_apt_update = false, $disable_keys = undef, $proxy_host = false, $proxy_port = '8080', $purge_sources_list = false, $purge_sources_list_d = false, $purge_preferences_d = false) {# implimentaton}

Page 60: How to keep track of puppet with Foreman
Page 61: How to keep track of puppet with Foreman
Page 62: How to keep track of puppet with Foreman
Page 63: How to keep track of puppet with Foreman
Page 64: How to keep track of puppet with Foreman

Installing ForemanInstallation of foreman is actually rather straight forward. Theinstaller, based on your answers, it does some of the below.

Installs puppetSets up a puppet master and configures itInstalls postgresqlSets up tftp, pxe, binddhcpd (disabled by default)Sets up foreman, in apache passenger

Page 65: How to keep track of puppet with Foreman

USE the Foreman-installerand

Read the instructions, theyhelp!

http://theforeman.org/manuals/1.3/index.html#3.InstallingForeman

Page 66: How to keep track of puppet with Foreman

Installing notesMake sure apt / yum / ruby gem works before youstartThe foreman repo will be added by the installer, if it'snot availableRHEL: make sure EPEL, RHEL optional andpuppetlabs repos are availableMake sure your hostname is what you want. SSLcerts will be created with it.Foreman works with SELinux on, but check the auditlogs if you have troubleRuby versions can be a problem. I use Red Hat SCLto run on ruby 1.9.3

Page 67: How to keep track of puppet with Foreman

PuppetUse a recent version of puppet. Your life will be easier! I recommend

using the community version supplied by puppetlabs.

http://yum.puppetlabs.com/

http://apt.puppetlabs.com/

unless all distro's you manage with puppet have version 3.3.x orabove of puppet already.

Page 68: How to keep track of puppet with Foreman
Page 69: How to keep track of puppet with Foreman

Questions?Track me down at LCA :)

or email me: [email protected]

google+: [email protected]

Page 70: How to keep track of puppet with Foreman

Demo