SlideShare a Scribd company logo
1 of 44
Continuous Integration of Puppet
Code
@d2si
Who am I ?
2
Jack of all trades, I love challenges of any kind from motor sports to IT.
@fgouteroux
@d2si
Outline
Puppet Dev and Tests
State of the art
What's missing ?
Enters beaker
Principles and common use cases
Examples
Real use case testing with beaker
Simulate a true puppet deployment
Details and Setup
Integration in the dev workflow
@d2si
Tests
Why ?
Syntax error  Manifest does not compile
Duplicate resource  Dependency cycle
Forgetting to include a module or set a variable  puppet run fails
Result
The host fails to enforce the expected state
@d2si
State of the art
Writing tests is a good way to verify that your modules are
• functional
• reusable
Ensure the module does what you want it to do
@d2si
State of the art
Automated testing is one of the key ways to ensure that:
• your libraries
• your manifests
are meeting your expectations !
@d2si
State of the art
There are differents ways to test puppet manifests
Puppet-lint
• Quick way to ensure that everybody is following a common set of conventions
• Analyze your manifests and look for deviations from the Puppet style guide
@d2si
Puppet-lint
@d2si
State of the art
Puppet-rspec
• Manifests and modules compile
• Manifests contain the expected values
• Specific types, classes or definitions are in the compiled catalog
• Parameters match the expectations
@d2si
Puppet-Rspec
@d2si
State of the art
Puppet apply
• Applies a standalone Puppet manifest to the local system
• « Simulates » a catalog compilation with modulepath option
$ puppet apply -l /tmp/manifest.log manifest.pp
$ puppet apply --modulepath=/root/dev/modules -e "include ntpd::server"
$ puppet apply --catalog catalog.json
@d2si
It’s cool but, beakerful
You want to be sure that running Puppet on a host will:
• build the host the way you want
• have the behavior you expect
That means, verify services like:
• SSH
• Postgres
• Nginx
are running and serving resources !
@d2si
What's missing ?
Testing entire systems:
1. Create virtual machines
2. Configure virtual machines
3. Deploy applications
4. Execute tests
5. Report on tests
6. Destroy virtual machines
6 5
4
3
1
2
@d2si
Enters Beaker
• Open source acceptance testing tool
• Built by Alice Nodelman (Puppet Labs)
• Build test environments by vm provisionning
• Multi-Cloud Providers (AWS, Google, Openstack)
• Multi Virtualisation support (Docker, vSphere, Vagrant, Virtualbox)
• Lifecycle management
• First step for Continuous Integration
@d2si
Principles and common use cases
• Tests are just Ruby files
• Tests passed if no errors/exceptions
• Tests use asserts to explicitly enforce a state
@d2si
Principles and common use cases
Let’s look at tests !
@d2si
Principles and common use cases
More examples !
@d2si
Simulate a true puppet deployment on AWS
Tasks:
1. Create 5 Virtual machines
2. Configure 4 Virtual machines
3. Deploy applications
4. Execute tests
5. Report tests
6. Destroy 5 Virtual machines
@d2si
TASK 1: Create VMs
How to reproduce this use case with beaker ?
@d2si
TASK 1: Create VMs
Create a file and describes your nodes:
@d2si
Beaker Roles
Each host in a host configuration file has one or more roles
Beaker natively supports the following roles:
• master
• agent
• frictionless
• dashboard
• database
These roles indicate what Puppet responsibilities the host will assume.
If puppet is installed as part of the Beaker test execution then the roles will be
honored (ie, the host defined as master will become the puppet master node).
Other than puppet installation, the roles provide shortcuts to access nodes
@d2si
TASK 2: Configure VMs
@d2si
TASK 2: Configure VMs
Step 1: Bootstrap master node
• Update package list
• Install puppetmaster, ruby packages
• Install/Configure Hiera
• Install/Configure/Deploy r10k
• Run puppet apply
Step 2: Bootstrap agent nodes
• Update package list
• Install curl, augeas packages
• Push hostname and public IP to Consul KV
• Install puppet agent
• Set Default Puppet Environment
• Run puppet agent
@d2si
r10k is a tool to help manage dynamic environments.
• Creates new environments from git branches
• Deploy modules to that environment.
R10K
@d2si
@d2si
beaker_helper.rb
@d2si
TASK 3: Deploy applications
@d2si
Puppet Stack – Roles/Profiles
From Craig Dunn: http://www.craigdunn.org/2012/05/239/
• Nodes get a single role
• Roles use several profiles
• Profiles and Roles are Puppet modules
@d2si
Puppet Stack - Hiera
From Craig Dunn
• Top down hierarchy for overriding configuration values based on
roles, environments…
• Puppet modules without hard-coded data are easily shared and
more re-usable
• Infrastructure configuration can be managed without needing to
edit Puppet code
Pluggable Backends:
• Source data from multiple locations
• Data source is abstracted from code
@d2si
Then it’s puppet job !
• Puppet get the node’s role with the node’s name
• Puppet apply the manifest according to the role
For front-server role, puppet need backends server infos like:
• hostname
• public IP
To get these infos, puppet call hiera consul backend.
TASK 3: Deploy applications
@d2si
front_server.pp
@d2si
apache_server.pp
@d2si
TASK 4: Execute Tests
@d2si
app_server.rb
@d2si
front_server.rb
@d2si
client.rb
@d2si
Task 5: Reporting
@d2si
@d2si
@d2si
Task 6: Destroy VMs
@d2si
Integration in the dev workflow
Developper update
a module
Trigger a hook
Run puppet-lint
Run puppet-rspec
Run integration tests
Merge dev to prod
(pipeline)
Run tests Play configuration
@d2si
Questions ?
@d2si
Go further
https://github.com/fgouteroux/demo-puppet-beaker
http://blog.d2-si.fr/2015/03/18/technique-puppet-beaker/
@d2si
Thank you !

More Related Content

What's hot

Big datatraining.in devops-part1
Big datatraining.in devops-part1Big datatraining.in devops-part1
Big datatraining.in devops-part1
MvkZ
 

What's hot (16)

PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
 
Pietro Di Bello, Paolo D'Incau - Continuous Delivery su progetti Java: cosa a...
Pietro Di Bello, Paolo D'Incau - Continuous Delivery su progetti Java: cosa a...Pietro Di Bello, Paolo D'Incau - Continuous Delivery su progetti Java: cosa a...
Pietro Di Bello, Paolo D'Incau - Continuous Delivery su progetti Java: cosa a...
 
Drupal Deployment
Drupal DeploymentDrupal Deployment
Drupal Deployment
 
Configuration As Code - Adoption of the Job DSL Plugin at Netflix
Configuration As Code - Adoption of the Job DSL Plugin at NetflixConfiguration As Code - Adoption of the Job DSL Plugin at Netflix
Configuration As Code - Adoption of the Job DSL Plugin at Netflix
 
Introduction to Puppet Enterprise 10/03/2018
Introduction to Puppet Enterprise 10/03/2018Introduction to Puppet Enterprise 10/03/2018
Introduction to Puppet Enterprise 10/03/2018
 
Provisioning environments. A simplistic approach
Provisioning  environments. A simplistic approachProvisioning  environments. A simplistic approach
Provisioning environments. A simplistic approach
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Meet Puppet's new product lineup 12/7/2017
Meet Puppet's new product lineup 12/7/2017Meet Puppet's new product lineup 12/7/2017
Meet Puppet's new product lineup 12/7/2017
 
Puppet Release Workflows at Jive Software
Puppet Release Workflows at Jive SoftwarePuppet Release Workflows at Jive Software
Puppet Release Workflows at Jive Software
 
Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)
 
Make It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version ControlMake It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version Control
 
Engineering Tools at Netflix: Enabling Continuous Delivery
Engineering Tools at Netflix: Enabling Continuous DeliveryEngineering Tools at Netflix: Enabling Continuous Delivery
Engineering Tools at Netflix: Enabling Continuous Delivery
 
Puppet Keynote: Puppet Camp London
Puppet Keynote: Puppet Camp LondonPuppet Keynote: Puppet Camp London
Puppet Keynote: Puppet Camp London
 
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
 
Getting Started with Puppet Bolt
Getting Started with Puppet BoltGetting Started with Puppet Bolt
Getting Started with Puppet Bolt
 
Big datatraining.in devops-part1
Big datatraining.in devops-part1Big datatraining.in devops-part1
Big datatraining.in devops-part1
 

Similar to Continuous integration of_puppet_code

Similar to Continuous integration of_puppet_code (20)

Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
 
Experiences from Running Masterless Puppet - PuppetConf 2014
Experiences from Running Masterless Puppet - PuppetConf 2014Experiences from Running Masterless Puppet - PuppetConf 2014
Experiences from Running Masterless Puppet - PuppetConf 2014
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
Building XWiki
Building XWikiBuilding XWiki
Building XWiki
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
Django and Docker
Django and DockerDjango and Docker
Django and Docker
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
 
Keeping your Kubernetes Cluster Secure
Keeping your Kubernetes Cluster SecureKeeping your Kubernetes Cluster Secure
Keeping your Kubernetes Cluster Secure
 
Using Docker for Testing - Mukta
Using Docker for Testing - MuktaUsing Docker for Testing - Mukta
Using Docker for Testing - Mukta
 
Improving WordPress Development and Deployments with Docker
Improving WordPress Development and Deployments with DockerImproving WordPress Development and Deployments with Docker
Improving WordPress Development and Deployments with Docker
 
PuppetConf 2017: Puppet Development Kit: A Seamless Workflow for Module Devel...
PuppetConf 2017: Puppet Development Kit: A Seamless Workflow for Module Devel...PuppetConf 2017: Puppet Development Kit: A Seamless Workflow for Module Devel...
PuppetConf 2017: Puppet Development Kit: A Seamless Workflow for Module Devel...
 
ContainerCon - Test Driven Infrastructure
ContainerCon - Test Driven InfrastructureContainerCon - Test Driven Infrastructure
ContainerCon - Test Driven Infrastructure
 
Puppet and docker
Puppet and dockerPuppet and docker
Puppet and docker
 
Using the puppet debugger for lightweight exploration
Using the puppet debugger for lightweight explorationUsing the puppet debugger for lightweight exploration
Using the puppet debugger for lightweight exploration
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
CI/CD with Azure DevOps and Azure Databricks
CI/CD with Azure DevOps and Azure DatabricksCI/CD with Azure DevOps and Azure Databricks
CI/CD with Azure DevOps and Azure Databricks
 
Shipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSShipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOS
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 

More from Devoteam Revolve

Présentation D2SI AWS Summit Paris 2014
Présentation D2SI AWS Summit Paris 2014Présentation D2SI AWS Summit Paris 2014
Présentation D2SI AWS Summit Paris 2014
Devoteam Revolve
 

More from Devoteam Revolve (20)

Talk be secret like a ninja with Vault
Talk  be secret like a ninja with VaultTalk  be secret like a ninja with Vault
Talk be secret like a ninja with Vault
 
How to scale with Terraform
How to scale with TerraformHow to scale with Terraform
How to scale with Terraform
 
Formations AWS - Catalogue D2SI Authorized Training Partner
Formations AWS - Catalogue D2SI Authorized Training PartnerFormations AWS - Catalogue D2SI Authorized Training Partner
Formations AWS - Catalogue D2SI Authorized Training Partner
 
Meetup Sécurité - AWS - Boundary Policy
Meetup Sécurité - AWS - Boundary PolicyMeetup Sécurité - AWS - Boundary Policy
Meetup Sécurité - AWS - Boundary Policy
 
Meetup Sécurité - AWS - Recap Reinforce 2019
Meetup Sécurité - AWS - Recap Reinforce 2019Meetup Sécurité - AWS - Recap Reinforce 2019
Meetup Sécurité - AWS - Recap Reinforce 2019
 
Meetup Sobriété numérique
Meetup Sobriété numériqueMeetup Sobriété numérique
Meetup Sobriété numérique
 
La DSI plateforme : DevOps, Agilité et Cloud
La DSI plateforme : DevOps, Agilité et CloudLa DSI plateforme : DevOps, Agilité et Cloud
La DSI plateforme : DevOps, Agilité et Cloud
 
Sécurité via l'automatisation : DevOps pour InfoSec. chez Renault Digital - A...
Sécurité via l'automatisation : DevOps pour InfoSec. chez Renault Digital - A...Sécurité via l'automatisation : DevOps pour InfoSec. chez Renault Digital - A...
Sécurité via l'automatisation : DevOps pour InfoSec. chez Renault Digital - A...
 
Scaling @Bouygues Telecom AWS Paris 2019
Scaling @Bouygues Telecom AWS Paris 2019Scaling @Bouygues Telecom AWS Paris 2019
Scaling @Bouygues Telecom AWS Paris 2019
 
Entreprise Plateforme - Le nouveau modèle ?
Entreprise Plateforme - Le nouveau modèle ? Entreprise Plateforme - Le nouveau modèle ?
Entreprise Plateforme - Le nouveau modèle ?
 
A way to share secrets in your pipeline - Hashidays 2018
A way to share secrets in your pipeline - Hashidays 2018A way to share secrets in your pipeline - Hashidays 2018
A way to share secrets in your pipeline - Hashidays 2018
 
Transformation Cloud & DevOps chez Renault Digital - AWS Summit Paris 2018
Transformation Cloud & DevOps chez Renault Digital - AWS Summit Paris 2018Transformation Cloud & DevOps chez Renault Digital - AWS Summit Paris 2018
Transformation Cloud & DevOps chez Renault Digital - AWS Summit Paris 2018
 
Automation of Active Directory's Deployments on AWS
Automation of Active Directory's Deployments on AWSAutomation of Active Directory's Deployments on AWS
Automation of Active Directory's Deployments on AWS
 
AWS Summit Paris 2017 : DevOps in a container world
AWS Summit Paris 2017 : DevOps in a container worldAWS Summit Paris 2017 : DevOps in a container world
AWS Summit Paris 2017 : DevOps in a container world
 
AWS Summit Paris 2017 : AWS loves Microsoft Workloads
AWS Summit Paris 2017 : AWS loves Microsoft WorkloadsAWS Summit Paris 2017 : AWS loves Microsoft Workloads
AWS Summit Paris 2017 : AWS loves Microsoft Workloads
 
AWS Summit Paris 2017 : Gameday Veolia
AWS Summit Paris 2017 : Gameday VeoliaAWS Summit Paris 2017 : Gameday Veolia
AWS Summit Paris 2017 : Gameday Veolia
 
Meetup Responsive Org #1
Meetup Responsive Org #1Meetup Responsive Org #1
Meetup Responsive Org #1
 
Réunion de triage en holacratie v2
Réunion de triage en holacratie v2Réunion de triage en holacratie v2
Réunion de triage en holacratie v2
 
[Oldies] Club client D2SI : DevOps
[Oldies] Club client D2SI : DevOps [Oldies] Club client D2SI : DevOps
[Oldies] Club client D2SI : DevOps
 
Présentation D2SI AWS Summit Paris 2014
Présentation D2SI AWS Summit Paris 2014Présentation D2SI AWS Summit Paris 2014
Présentation D2SI AWS Summit Paris 2014
 

Recently uploaded

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Continuous integration of_puppet_code

  • 2. @d2si Who am I ? 2 Jack of all trades, I love challenges of any kind from motor sports to IT. @fgouteroux
  • 3. @d2si Outline Puppet Dev and Tests State of the art What's missing ? Enters beaker Principles and common use cases Examples Real use case testing with beaker Simulate a true puppet deployment Details and Setup Integration in the dev workflow
  • 4. @d2si Tests Why ? Syntax error  Manifest does not compile Duplicate resource  Dependency cycle Forgetting to include a module or set a variable  puppet run fails Result The host fails to enforce the expected state
  • 5. @d2si State of the art Writing tests is a good way to verify that your modules are • functional • reusable Ensure the module does what you want it to do
  • 6. @d2si State of the art Automated testing is one of the key ways to ensure that: • your libraries • your manifests are meeting your expectations !
  • 7. @d2si State of the art There are differents ways to test puppet manifests Puppet-lint • Quick way to ensure that everybody is following a common set of conventions • Analyze your manifests and look for deviations from the Puppet style guide
  • 9. @d2si State of the art Puppet-rspec • Manifests and modules compile • Manifests contain the expected values • Specific types, classes or definitions are in the compiled catalog • Parameters match the expectations
  • 11. @d2si State of the art Puppet apply • Applies a standalone Puppet manifest to the local system • « Simulates » a catalog compilation with modulepath option $ puppet apply -l /tmp/manifest.log manifest.pp $ puppet apply --modulepath=/root/dev/modules -e "include ntpd::server" $ puppet apply --catalog catalog.json
  • 12. @d2si It’s cool but, beakerful You want to be sure that running Puppet on a host will: • build the host the way you want • have the behavior you expect That means, verify services like: • SSH • Postgres • Nginx are running and serving resources !
  • 13. @d2si What's missing ? Testing entire systems: 1. Create virtual machines 2. Configure virtual machines 3. Deploy applications 4. Execute tests 5. Report on tests 6. Destroy virtual machines 6 5 4 3 1 2
  • 14. @d2si Enters Beaker • Open source acceptance testing tool • Built by Alice Nodelman (Puppet Labs) • Build test environments by vm provisionning • Multi-Cloud Providers (AWS, Google, Openstack) • Multi Virtualisation support (Docker, vSphere, Vagrant, Virtualbox) • Lifecycle management • First step for Continuous Integration
  • 15. @d2si Principles and common use cases • Tests are just Ruby files • Tests passed if no errors/exceptions • Tests use asserts to explicitly enforce a state
  • 16. @d2si Principles and common use cases Let’s look at tests !
  • 17. @d2si Principles and common use cases More examples !
  • 18. @d2si Simulate a true puppet deployment on AWS Tasks: 1. Create 5 Virtual machines 2. Configure 4 Virtual machines 3. Deploy applications 4. Execute tests 5. Report tests 6. Destroy 5 Virtual machines
  • 19. @d2si TASK 1: Create VMs How to reproduce this use case with beaker ?
  • 20. @d2si TASK 1: Create VMs Create a file and describes your nodes:
  • 21. @d2si Beaker Roles Each host in a host configuration file has one or more roles Beaker natively supports the following roles: • master • agent • frictionless • dashboard • database These roles indicate what Puppet responsibilities the host will assume. If puppet is installed as part of the Beaker test execution then the roles will be honored (ie, the host defined as master will become the puppet master node). Other than puppet installation, the roles provide shortcuts to access nodes
  • 23. @d2si TASK 2: Configure VMs Step 1: Bootstrap master node • Update package list • Install puppetmaster, ruby packages • Install/Configure Hiera • Install/Configure/Deploy r10k • Run puppet apply Step 2: Bootstrap agent nodes • Update package list • Install curl, augeas packages • Push hostname and public IP to Consul KV • Install puppet agent • Set Default Puppet Environment • Run puppet agent
  • 24. @d2si r10k is a tool to help manage dynamic environments. • Creates new environments from git branches • Deploy modules to that environment. R10K
  • 25. @d2si
  • 27. @d2si TASK 3: Deploy applications
  • 28. @d2si Puppet Stack – Roles/Profiles From Craig Dunn: http://www.craigdunn.org/2012/05/239/ • Nodes get a single role • Roles use several profiles • Profiles and Roles are Puppet modules
  • 29. @d2si Puppet Stack - Hiera From Craig Dunn • Top down hierarchy for overriding configuration values based on roles, environments… • Puppet modules without hard-coded data are easily shared and more re-usable • Infrastructure configuration can be managed without needing to edit Puppet code Pluggable Backends: • Source data from multiple locations • Data source is abstracted from code
  • 30. @d2si Then it’s puppet job ! • Puppet get the node’s role with the node’s name • Puppet apply the manifest according to the role For front-server role, puppet need backends server infos like: • hostname • public IP To get these infos, puppet call hiera consul backend. TASK 3: Deploy applications
  • 38. @d2si
  • 39. @d2si
  • 41. @d2si Integration in the dev workflow Developper update a module Trigger a hook Run puppet-lint Run puppet-rspec Run integration tests Merge dev to prod (pipeline) Run tests Play configuration