SlideShare a Scribd company logo
1 of 41
Short Lived, Immutable Servers
with Masterless Puppet?
Presented by: Neil Millard
www.millowgroup.co.uk
whoami
• Always programming
• IT professional since 1995
whoami
• Devops / Infrastructure as Code
• Helicopter pilot
whoami
• Educate
• Automate
• Have FUN
Infrastructure
Application
Monitoring & Logging
Application Deployments
Automation
agenda
• Masterless puppet
• Bootstrap
• Modules
• Hieradata
• Roles and Profiles
• Ordering
• Stages
What is Masterless
• Puppet without a master
• Without a master, the automation needs to ‘provide’
all the configuration the
Master gives us
• The master and node
in one
Why Masterless puppet
Pets
http://www.slideshare.net/gmccance/cern-data-centre-evolution - attrib Bill Baker/Microsoft
https://www.iha.com
Scale UP
Why Masterless puppet
Cattle
http://www.slideshare.net/gmccance/cern-data-centre-evolution - attrib Bill Baker/Microsoft
Scale OUT
Why Masterless puppet
• Puppet Masters
• Pets
• Maintenance
• Care
• Sometimes fragile
Why Masterless puppet
• Rebuild
rather than
reconfigure
- Immutable
• Temporary,
worker,
short lived
• Build -> work-> destroy server
Masterless puppet
• Bootstrapping
• Cloud-init
• userdata
- Environment
- Role
Masterless puppet (baking)
• Everything included
• Lots of maintenance required
Masterless puppet (baking)
• Bare shell
• Build according to configuration
(version controlled)
Bootstrapping
• Puppet Prerequisites
• Ruby
• Git
• Gems (puppet, hiera)
• Modules
Bootstrapping
• Preparing to run puppet
Tru-strap https://github.com/MSMFG/tru-strap
Args: Provisioning or configuration repository
Role + Environment Facts, for hiera lookup
echo “init_role=${value}" > /etc/facter/facts.d/init-role.txt
Components
• Hieradata
• Roles and Profiles
• Modules
Masterless puppet
• Fetch configuration (infrastructure as code)
• Puppet
• hieradata
• Puppetfiles
• manifests
• modules
• profiles
• roles
• https://github.com/neilmillard/puppet-dockerhost
hieradata
• Separation of data from code
docker::run { $container:
image => $image,
command => $command,
memory_limit => $memory_limit,
cpuset => $cpuset,
ports => $ports,
expose => $expose,
volumes => $volumes,
links => $links,
use_name => $use_name,
running => $running,
volumes_from => $volumes_from,
net => $net,
username => $username,
hostname => $hostname,
env => $env,
dns => $dns,
dns_search => $dns_search,
lxc_conf => $lxc_conf,
restart_service => $restart_service,
disable_network => $disable_network,
privileged => $privileged,
detach => $detach,
extra_parameters => $extra_parameters,
pull_on_start => $pull_on_start,
depends => $depends,
tty => $tty,
require => $requires,
}
eyamld:
image: "nginx"
ports:
- "80:80"
env:
- NGINX_HOST=foobar.com
- NGINX_PORT=80
use_name: true
docker::run { ‘eyamld’:
image => "nginx",
command => undef,
memory_limit => 0b,
cpuset => [],
ports => ["80:80“],
expose => [],
volumes => [],
links => [],
use_name => true,
running => true,
volumes_from => [],
net => 'bridge',
username => false,
hostname => false,
env => [NGINX_HOST=foobar.com,
NGINX_PORT=80
],
dns => [],
dns_search => [],
lxc_conf => [],
restart_service => true,
disable_network => false,
privileged => false,
detach => true,
extra_parameters => undef,
pull_on_start => false,
depends => [],
tty => false,
require => [],
}
+ =
hieradata
• Separation of data from code
• Code reuse with lookups
profile::docker_containers::containers:
eyamld:
image: "nginx"
ports:
- "80:80"
env:
- NGINX_HOST=foobar.com
- NGINX_PORT=80
use_name: true
# profile::docker_containers
class profile::docker_containers
($containers={}) {
create_resources (
'profile::docker_container', $containers )
}
hieradata
• Separation of data from code
Like pilot from the helicopter
• Code reuse with lookups
• Automatic parameter lookup
# In this example, $parameter's value gets set
# when `myclass` is eventually declared.
# Class definition:
class myclass ($parameter_one = "default text") {
file {'/tmp/foo':
ensure => file,
content => $parameter_one,
}
}
hieradata
• Hiera.yaml – configuration
---
:backends:
- eyaml
- yaml
:eyaml:
:datadir: /etc/puppetlabs/puppet/hieradata
:pkcs7_private_key: /etc/puppet/secure/keys/private_key.pkcs7.pem
:pkcs7_public_key: /etc/puppet/secure/keys/public_key.pkcs7.pem
:yaml:
:datadir: /etc/puppetlabs/puppet/hieradata
:hierarchy:
- "%{::init_env}/%{::init_role}"
- "%{::init_role}"
- "%{::init_env}"
- common
Roles and Profiles
• Business Layer (Roles)
only includes profiles
no logic
one server, one role
• Implementation Layer (Profiles)
Includes classes
Modules and Resources
create_resources{}
Craig Dunn - http://www.slideshare.net/PuppetLabs/roles-talk
Puppet - https://docs.puppet.com/pe/2016.2/r_n_p_intro.html
http://www.slideshare.net/DaeHyung/learning-puppet-basic-thing #64
Modules
• Puppetforge or Git (Github)
Modules
Librarian or r10k from Puppetfile
forge "https://forgeapi.puppetlabs.com"
# Base modules
mod "saz/timezone", "3.0.1"
mod "saz/rsyslog", "4.0.2"
Masterless puppet
• Puppet catalog compilation
• Puppet catalog apply
http://www.slideshare.net/bernstein_aaron/puppet-introduction-26593192 #25
Data
Hieradata
Puppet apply
• Site.pp
• Classes
• Hieradata
• Roles
• Manifests
node default {
hiera_include('classes')
}
hieradata
• Hiera.yaml – configuration
---
:backends:
- eyaml
- yaml
:eyaml:
:datadir: /etc/puppetlabs/puppet/hieradata
:pkcs7_private_key: /etc/puppet/secure/keys/private_key.pkcs7.pem
:pkcs7_public_key: /etc/puppet/secure/keys/public_key.pkcs7.pem
:yaml:
:datadir: /etc/puppetlabs/puppet/hieradata
:hierarchy:
- "%{::init_env}/%{::init_role}"
- "%{::init_role}"
- "%{::init_env}"
- common
:yaml:
:datadir: /etc/puppetlabs/puppet/hieradata
:hierarchy:
- "%{::init_env}/%{::init_role}"
- "%{::init_role}"
- "%{::init_env}"
- common
Hiera Lookups
• Under the Hieradata folder
• ::init_role == dockerhost
• Example code
• https://github.com/neilmillard/puppet-dockerhost
echo “init_role=${value}" > /etc/facter/facts.d/init-role.txt
Classes and role
• Classes:
# hieradata/dockerhost.yaml
---
classes:
- role::dockerhost
Roles and Profiles
• Defined as classes within either Roles Module or Profiles Module
• Roles contain Profiles
• Use include, require or class
class role::dockerhost {
include ::profile::base
include ::profile::os_limits
include ::profile::docker_base
include ::profile::docker_containers
class { '::profile::swapfile':
before => Class['profile::base']
}
}
# profile::docker_containers
class profile::docker_containers
($containers={}) {
create_resources (
'profile::docker_container', $containers )
}
Data file flow summary
Role fact
hieradata
site.pp
role.yaml classes
Role::
Profile::
Profile::
Components
• Hieradata
Colours and size
• Roles and Profiles
Helicopter made up of
components
• Modules
ordering
• Puppet execution is in parallel
• Dependencies need order
anchor { 'ntp::begin': } ->
class { '::ntp::install': } ->
class { '::ntp::config': } ~>
class { '::ntp::service': } ->
anchor { 'ntp::end': }
ordering
• before, require
class { ‘install-ssl':
installdir => "$installdir",
require => Exec['unarchive-source'],
before => File['copy-init-file'],
}
ordering
• ->
• Everything else is attempted at the same time
->
class { ‘install-ssl':
installdir => "$installdir",
}
->
Ordering - stages
• main
• WARNING – use with care.
Can cause dependency cycles
Ordering - stages
• Catalog compiles
• Runs each stage based on order
• Ordering across stages WILL break
Notice: Compiled catalog for ip-10-96-4-130.internal in environment production in 2.10
Notice: /Stage[swapfile]/Profile::Swapfile/Exec[Create swap file /mnt/swap.1]/returns:
Notice: /Stage[swapfile]/Profile::Swapfile/File[/mnt/swap.1]/mode: mode changed '0644'
...
Notice: /Stage[main]/Profile::Docker_base/Exec[yum install -y docker-io]/returns:
Notice: /Stage[main]/Docker::Service/File[/etc/sysconfig/docker]/content: content
Ordering - stages
• Simple manifests best
• swapfile stage
stage { 'swapfile':
before => Stage['main'],
}
class { '::profile::swapfile':
stage => swapfile
before => Class['profile::base']
}
What we covered
• Masterless puppet
• Bootstrap
• Modules
• Hieradata
• Roles and Profiles
• Ordering
• Stages
Neil Millard
Blog: www.neilmillard.com
Info: devops.neilmillard.com
github.com/neilmillard
e: neil.millard@millowgroup.co.uk

More Related Content

What's hot

Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkVance Lucas
 
Keeping It Small with Slim
Keeping It Small with SlimKeeping It Small with Slim
Keeping It Small with SlimRaven Tools
 
With a Mighty Hammer
With a Mighty HammerWith a Mighty Hammer
With a Mighty HammerBen Scofield
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)tompunk
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Anatoly Sharifulin
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tCosimo Streppone
 
Survey of Front End Topics in Rails
Survey of Front End Topics in RailsSurvey of Front End Topics in Rails
Survey of Front End Topics in RailsBenjamin Vandgrift
 
Building Cloud Castles
Building Cloud CastlesBuilding Cloud Castles
Building Cloud CastlesBen Scofield
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web frameworktaggg
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Dotan Dimet
 
Moving from Django Apps to Services
Moving from Django Apps to ServicesMoving from Django Apps to Services
Moving from Django Apps to ServicesCraig Kerstiens
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hopeMarcus Ramberg
 
RubyMotion
RubyMotionRubyMotion
RubyMotionMark
 
PHP Basics and Demo HackU
PHP Basics and Demo HackUPHP Basics and Demo HackU
PHP Basics and Demo HackUAnshu Prateek
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Racksickill
 
Using WordPress as your application stack
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stackPaul Bearne
 

What's hot (20)

Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-Framework
 
Keeping It Small with Slim
Keeping It Small with SlimKeeping It Small with Slim
Keeping It Small with Slim
 
With a Mighty Hammer
With a Mighty HammerWith a Mighty Hammer
With a Mighty Hammer
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)
 
Assetic (Zendcon)
Assetic (Zendcon)Assetic (Zendcon)
Assetic (Zendcon)
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
 
Survey of Front End Topics in Rails
Survey of Front End Topics in RailsSurvey of Front End Topics in Rails
Survey of Front End Topics in Rails
 
Building Cloud Castles
Building Cloud CastlesBuilding Cloud Castles
Building Cloud Castles
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
Moving from Django Apps to Services
Moving from Django Apps to ServicesMoving from Django Apps to Services
Moving from Django Apps to Services
 
Intro to Ember.JS 2016
Intro to Ember.JS 2016Intro to Ember.JS 2016
Intro to Ember.JS 2016
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
RubyMotion
RubyMotionRubyMotion
RubyMotion
 
PHP Basics and Demo HackU
PHP Basics and Demo HackUPHP Basics and Demo HackU
PHP Basics and Demo HackU
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
 
Using WordPress as your application stack
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stack
 

Similar to Short lived immutable servers with masterless puppet

Can puppet help you run docker on a T2.Micro?
Can puppet help you run docker on a T2.Micro?Can puppet help you run docker on a T2.Micro?
Can puppet help you run docker on a T2.Micro?Neil Millard
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoiceDave Barcelo
 
10 things I learned building Nomad packs
10 things I learned building Nomad packs10 things I learned building Nomad packs
10 things I learned building Nomad packsBram Vogelaar
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at BazaarvoicePuppet
 
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Miguel Zuniga
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsRichard Rodger
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)DECK36
 
Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School
Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School
Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School Elana Jacobs
 
Twig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHPTwig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHPFabien Potencier
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...Yury Bushmelev
 
Agiles Peru 2019 - Infrastructure As Code
Agiles Peru 2019 - Infrastructure As CodeAgiles Peru 2019 - Infrastructure As Code
Agiles Peru 2019 - Infrastructure As CodeMario IC
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOSPetr Dvorak
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and DesktopElizabeth Smith
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 

Similar to Short lived immutable servers with masterless puppet (20)

Can puppet help you run docker on a T2.Micro?
Can puppet help you run docker on a T2.Micro?Can puppet help you run docker on a T2.Micro?
Can puppet help you run docker on a T2.Micro?
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
 
10 things I learned building Nomad packs
10 things I learned building Nomad packs10 things I learned building Nomad packs
10 things I learned building Nomad packs
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at Bazaarvoice
 
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
 
Twig
TwigTwig
Twig
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.js
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)
 
Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School
Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School
Digital Ocean Presentation - Ruby Dev Stackup - The Flatiron School
 
Twig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHPTwig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHP
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
Django Celery
Django Celery Django Celery
Django Celery
 
Agiles Peru 2019 - Infrastructure As Code
Agiles Peru 2019 - Infrastructure As CodeAgiles Peru 2019 - Infrastructure As Code
Agiles Peru 2019 - Infrastructure As Code
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOS
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 

Recently uploaded

Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedDelhi Call girls
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Pooja Nehwal
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaKayode Fayemi
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIINhPhngng3
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalFabian de Rijk
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxraffaeleoman
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Delhi Call girls
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatmentnswingard
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lodhisaajjda
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfSenaatti-kiinteistöt
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCamilleBoulbin1
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Baileyhlharris
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Vipesco
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar TrainingKylaCullinane
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoKayode Fayemi
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfSkillCertProExams
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...amilabibi1
 

Recently uploaded (18)

Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptx
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 

Short lived immutable servers with masterless puppet

  • 1. Short Lived, Immutable Servers with Masterless Puppet? Presented by: Neil Millard www.millowgroup.co.uk
  • 2. whoami • Always programming • IT professional since 1995
  • 3. whoami • Devops / Infrastructure as Code • Helicopter pilot
  • 6. agenda • Masterless puppet • Bootstrap • Modules • Hieradata • Roles and Profiles • Ordering • Stages
  • 7. What is Masterless • Puppet without a master • Without a master, the automation needs to ‘provide’ all the configuration the Master gives us • The master and node in one
  • 8. Why Masterless puppet Pets http://www.slideshare.net/gmccance/cern-data-centre-evolution - attrib Bill Baker/Microsoft https://www.iha.com Scale UP
  • 10. Why Masterless puppet • Puppet Masters • Pets • Maintenance • Care • Sometimes fragile
  • 11. Why Masterless puppet • Rebuild rather than reconfigure - Immutable • Temporary, worker, short lived • Build -> work-> destroy server
  • 12. Masterless puppet • Bootstrapping • Cloud-init • userdata - Environment - Role
  • 13. Masterless puppet (baking) • Everything included • Lots of maintenance required
  • 14. Masterless puppet (baking) • Bare shell • Build according to configuration (version controlled)
  • 15. Bootstrapping • Puppet Prerequisites • Ruby • Git • Gems (puppet, hiera) • Modules
  • 16. Bootstrapping • Preparing to run puppet Tru-strap https://github.com/MSMFG/tru-strap Args: Provisioning or configuration repository Role + Environment Facts, for hiera lookup echo “init_role=${value}" > /etc/facter/facts.d/init-role.txt
  • 17. Components • Hieradata • Roles and Profiles • Modules
  • 18. Masterless puppet • Fetch configuration (infrastructure as code) • Puppet • hieradata • Puppetfiles • manifests • modules • profiles • roles • https://github.com/neilmillard/puppet-dockerhost
  • 19. hieradata • Separation of data from code docker::run { $container: image => $image, command => $command, memory_limit => $memory_limit, cpuset => $cpuset, ports => $ports, expose => $expose, volumes => $volumes, links => $links, use_name => $use_name, running => $running, volumes_from => $volumes_from, net => $net, username => $username, hostname => $hostname, env => $env, dns => $dns, dns_search => $dns_search, lxc_conf => $lxc_conf, restart_service => $restart_service, disable_network => $disable_network, privileged => $privileged, detach => $detach, extra_parameters => $extra_parameters, pull_on_start => $pull_on_start, depends => $depends, tty => $tty, require => $requires, } eyamld: image: "nginx" ports: - "80:80" env: - NGINX_HOST=foobar.com - NGINX_PORT=80 use_name: true docker::run { ‘eyamld’: image => "nginx", command => undef, memory_limit => 0b, cpuset => [], ports => ["80:80“], expose => [], volumes => [], links => [], use_name => true, running => true, volumes_from => [], net => 'bridge', username => false, hostname => false, env => [NGINX_HOST=foobar.com, NGINX_PORT=80 ], dns => [], dns_search => [], lxc_conf => [], restart_service => true, disable_network => false, privileged => false, detach => true, extra_parameters => undef, pull_on_start => false, depends => [], tty => false, require => [], } + =
  • 20. hieradata • Separation of data from code • Code reuse with lookups profile::docker_containers::containers: eyamld: image: "nginx" ports: - "80:80" env: - NGINX_HOST=foobar.com - NGINX_PORT=80 use_name: true # profile::docker_containers class profile::docker_containers ($containers={}) { create_resources ( 'profile::docker_container', $containers ) }
  • 21. hieradata • Separation of data from code Like pilot from the helicopter • Code reuse with lookups • Automatic parameter lookup # In this example, $parameter's value gets set # when `myclass` is eventually declared. # Class definition: class myclass ($parameter_one = "default text") { file {'/tmp/foo': ensure => file, content => $parameter_one, } }
  • 22. hieradata • Hiera.yaml – configuration --- :backends: - eyaml - yaml :eyaml: :datadir: /etc/puppetlabs/puppet/hieradata :pkcs7_private_key: /etc/puppet/secure/keys/private_key.pkcs7.pem :pkcs7_public_key: /etc/puppet/secure/keys/public_key.pkcs7.pem :yaml: :datadir: /etc/puppetlabs/puppet/hieradata :hierarchy: - "%{::init_env}/%{::init_role}" - "%{::init_role}" - "%{::init_env}" - common
  • 23. Roles and Profiles • Business Layer (Roles) only includes profiles no logic one server, one role • Implementation Layer (Profiles) Includes classes Modules and Resources create_resources{} Craig Dunn - http://www.slideshare.net/PuppetLabs/roles-talk Puppet - https://docs.puppet.com/pe/2016.2/r_n_p_intro.html http://www.slideshare.net/DaeHyung/learning-puppet-basic-thing #64
  • 25. Modules Librarian or r10k from Puppetfile forge "https://forgeapi.puppetlabs.com" # Base modules mod "saz/timezone", "3.0.1" mod "saz/rsyslog", "4.0.2"
  • 26. Masterless puppet • Puppet catalog compilation • Puppet catalog apply http://www.slideshare.net/bernstein_aaron/puppet-introduction-26593192 #25 Data Hieradata
  • 27. Puppet apply • Site.pp • Classes • Hieradata • Roles • Manifests node default { hiera_include('classes') }
  • 28. hieradata • Hiera.yaml – configuration --- :backends: - eyaml - yaml :eyaml: :datadir: /etc/puppetlabs/puppet/hieradata :pkcs7_private_key: /etc/puppet/secure/keys/private_key.pkcs7.pem :pkcs7_public_key: /etc/puppet/secure/keys/public_key.pkcs7.pem :yaml: :datadir: /etc/puppetlabs/puppet/hieradata :hierarchy: - "%{::init_env}/%{::init_role}" - "%{::init_role}" - "%{::init_env}" - common :yaml: :datadir: /etc/puppetlabs/puppet/hieradata :hierarchy: - "%{::init_env}/%{::init_role}" - "%{::init_role}" - "%{::init_env}" - common
  • 29. Hiera Lookups • Under the Hieradata folder • ::init_role == dockerhost • Example code • https://github.com/neilmillard/puppet-dockerhost echo “init_role=${value}" > /etc/facter/facts.d/init-role.txt
  • 30. Classes and role • Classes: # hieradata/dockerhost.yaml --- classes: - role::dockerhost
  • 31. Roles and Profiles • Defined as classes within either Roles Module or Profiles Module • Roles contain Profiles • Use include, require or class class role::dockerhost { include ::profile::base include ::profile::os_limits include ::profile::docker_base include ::profile::docker_containers class { '::profile::swapfile': before => Class['profile::base'] } } # profile::docker_containers class profile::docker_containers ($containers={}) { create_resources ( 'profile::docker_container', $containers ) }
  • 32. Data file flow summary Role fact hieradata site.pp role.yaml classes Role:: Profile:: Profile::
  • 33. Components • Hieradata Colours and size • Roles and Profiles Helicopter made up of components • Modules
  • 34. ordering • Puppet execution is in parallel • Dependencies need order anchor { 'ntp::begin': } -> class { '::ntp::install': } -> class { '::ntp::config': } ~> class { '::ntp::service': } -> anchor { 'ntp::end': }
  • 35. ordering • before, require class { ‘install-ssl': installdir => "$installdir", require => Exec['unarchive-source'], before => File['copy-init-file'], }
  • 36. ordering • -> • Everything else is attempted at the same time -> class { ‘install-ssl': installdir => "$installdir", } ->
  • 37. Ordering - stages • main • WARNING – use with care. Can cause dependency cycles
  • 38. Ordering - stages • Catalog compiles • Runs each stage based on order • Ordering across stages WILL break Notice: Compiled catalog for ip-10-96-4-130.internal in environment production in 2.10 Notice: /Stage[swapfile]/Profile::Swapfile/Exec[Create swap file /mnt/swap.1]/returns: Notice: /Stage[swapfile]/Profile::Swapfile/File[/mnt/swap.1]/mode: mode changed '0644' ... Notice: /Stage[main]/Profile::Docker_base/Exec[yum install -y docker-io]/returns: Notice: /Stage[main]/Docker::Service/File[/etc/sysconfig/docker]/content: content
  • 39. Ordering - stages • Simple manifests best • swapfile stage stage { 'swapfile': before => Stage['main'], } class { '::profile::swapfile': stage => swapfile before => Class['profile::base'] }
  • 40. What we covered • Masterless puppet • Bootstrap • Modules • Hieradata • Roles and Profiles • Ordering • Stages
  • 41. Neil Millard Blog: www.neilmillard.com Info: devops.neilmillard.com github.com/neilmillard e: neil.millard@millowgroup.co.uk

Editor's Notes

  1. Good lunch, break? Raise your hand if you use AWS Raise if you are a developer Raise if you are operations or infrastructure
  2. Raise your hand if you use AWS Raise if you are a developer Raise if you are operations or infrastructure Would you describe yourself as DevOps,
  3. Raise your hand if you use AWS Raise if you are a developer Raise if you are operations or infrastructure Would you describe yourself as DevOps,
  4. Raise your hand if you use AWS Raise if you are a developer Raise if you are operations or infrastructure Would you describe yourself as DevOps,
  5. My focus is on deploying Infrastructure, applications with monitoring those deployment. All facilitated by Automation, with tools such as puppet, with support from Git
  6. Does your infrastructure currently use Puppet? What masterless puppet is and why you would use it. Bootstrapping an instance, Other components before we run puppet apply.
  7. Why, flexibility and scaling Pets: They are unique, loved and cared for. When they become ill, they are nursed back to health and you hope they will stay well for a long time. You couldn’t possibly imagine getting rid of or decommissioning the server. Long life Cattle: They are name more like a number – S02343 They are pretty much identical to the others When they get ill, you just get another one. As the server is so easily replace, you wouldn’t think twice about removing any you don’t need, at night for instance. Elastic capacity if you are using a cloud provider.
  8. Why, flexibility and scaling Pets: They are unique, loved and cared for. When they become ill, they are nursed back to health and you hope they will stay well for a long time. You couldn’t possibly imagine getting rid of or decommissioning the server. Long life Cattle: They are name more like a number – S02343 They are pretty much identical to the others When they get ill, you just get another one. As the server is so easily replace, you wouldn’t think twice about removing any you don’t need, at night for instance. Elastic capacity if you are using a cloud provider.
  9. Build play destroy
  10. Build play destroy
  11. Autoscaling config Teraform Need an image to start from. Most linux distros now include Cloud-init - Cloud-init: Scott Moser - Ubuntu Server Team
  12. Your boot image can contain as much or as little as you want. affects startup time, Creates an overhead if things in the image change often
  13. Your boot image can contain as much or as little as you want. affects startup time, Creates an overhead if things in the image change often
  14. Either way, we need Puppet prereqs Creates an overhead if things in the image change often
  15. Your boot image can contain as much or as little as you want. affects startup time, Creates an overhead if things in the image change often
  16. Puppet needs components to build the server.
  17. Loads configuration via hieradata and our roles and profiles
  18. Without hardcoding values, we can provide defaults instead. Your hieradata is then merged with the defaults to provide the actual config This makes your code reusable. In this case, it’s a define that can run multiple containers from a small set of hieradata
  19. This is where in the code the merge happens with lookups
  20. Automatic lookups simplifies code further
  21. This is where we can see the tru-strap arguments for environment and role.
  22. Avoid spaghetti code. Reusable profiles
  23. Lib contains custom Types and Providers
  24. Facts: External Data/ENC: in our case Hieradata Puppet manifests and modules
  25. Back at our hieradata again. Notice the hierarchy bit. The ::init_env and ::init_role are Facts, that are passed to hiera from puppet during the run The boot script sets these up using facter.
  26. Loads configuration via hieradata and our roles and profiles
  27. A server only has ONE role Profiles include modules, classes or define usages
  28. Puppet needs components to build the server.
  29. Self contained modules
  30. Does your infrastructure currently use Puppet? What masterless puppet is and why you would use it. Bootstrapping an instance, Other components before we run puppet apply.