SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Downloaden Sie, um offline zu lesen
DevOps Automation with
Puppet Bolt & Puppet Enterprise
Eficode DevOps Tooling Morning 2019
Kevin Reeuwijk
Sr Sales Engineer NEMEA
kevinr@puppet.com
Bolt: an open source task runner
Bolt provides a simple way to execute agentless automation against remote hosts
• Zero requirements to the remote host. No agents, no python, no nothing.
• Authenticate via SSH, WinRM, PCP
• Execute arbitrary commands, scripts, Puppet Tasks and Puppet Task Plans
• Use scripts in any language the remote host can execute
• Mature at your own pace from scripts à tasks à plans à puppet code
• If you have Puppet Enterprise, leverage PE from Bolt
Accessible automation at no cost
bolt command run <cmd> --nodes … bolt script run <file> --nodes … bolt task run <task> --nodes …
2. Scripts
.sh .ps1
PS C:>
[root/]#
1. Commands
Start-Service W32Time
systemctl start ntpd
3. Tasks
.ps1 .json
- Task description
- Allowed parameters
- Input validation
bolt plan run <plan> --nodes …
4. Plans
plan timesync::manage {
run_task ( ‘timesync::reset’, $nodes, default => true )
apply ( $nodes ) {
# some Puppet code here to manage time synchronization
}
run_task ( ‘timesync::restart’, $nodes, force => true )
}
+
Version Control
Using Bolt
Bolt command line syntax:
bolt [command|script|task|plan] run <name> --nodes <nodes> [options]
To run a simple Bash command on a remote SSH host:
bolt command run 'echo Hello World!' --nodes 10.0.0.1, 10.0.0.2
--user root --private-key /path/to/key --transport ssh --no-host-key-check
To run a simple PowerShell command on a remote WinRM host:
bolt command run 'write-host Hello World!' --nodes 10.0.0.1, 10.0.0.2
--user administrator --password 'P@ssw0rd' --transport winrm --no-ssl
Easing Bolt’s configuration
Bolt provides ways to make common activities more efficient
• Use a bolt.yaml file to store generic settings like modulepath or PE integration
• Use an inventory.yaml file to prevent typing in connection info every time
• Use a Boltdir to bundle all the files you need and have Bolt automatically use it
https://puppet.com/docs/bolt
Bolt Inventory File - Syntax
groups:
- name: group_name
nodes:
- IP_address_or_name_of_node1
- IP_address_or_name_of_node2
config:
transport: [ ssh | winrm ]
ssh:
user: user_name
run-as: root_name
private-key: /path/to/key
host-key-check: [ true | false ]
winrm:
user: user_name
password: password
ssl: [ true | false ]
https://puppet.com/docs/bolt/latest/inventory_file.html
Nesting of groups is allowed:
groups:
- name: top_group
groups:
- name: sub_group
nodes:
- …
Turning a script into a Puppet Task
Make your scripts more useful in Bolt by turning them into Puppet Tasks
• Any script file in a tasks directory of a module becomes a Task
• Tasks are name spaced automatically, using familiar Puppet syntax:
modules/mymod/tasks/script1.ps1 # mymod::script1
modules/aws/tasks/show_vpc.sh # aws::show_vpc
modules/mysql/tasks/sql.rb # mysql::sql
modules/yum/tasks/init.rb # yum
https://puppet.com/docs/bolt/latest/writing_tasks.html
Writing metadata for Puppet Tasks
Make your Tasks more useful and robust by writing metadata files for them
• A metadata file has the same name as the script file, but with a .json extension
• Metadata files using the following (JSON) syntax:
{
"description": ”Description of your Puppet Task",
"input_method": "environment | stdin | powershell",
"parameters": {
”param1": {
"description": "Description of the parameter usage",
"type": "String | Enum | Pattern | Integer | Array | Hash | Boolean"
}
}
}
Writing Puppet Task Plans
Puppet Task Plans can use all of the previously covered capabilities, and more, in a
single plan. It’s ideally suited to:
• String Tasks together
• Perform more complex logic & error handling, or interact with Puppet Enterprise
• Combine command/scripts/Tasks with applying desired-state Puppet code
• Plans are stored in a plans directory of a module and have a .pp extension
• Plans must be name spaced according to their module & plan name
https://puppet.com/docs/bolt/latest/writing_plans.html
Anatomy of a Puppet Task Plan
located in modules/my_mod/plans/my_plan.pp
plan my_mod::my_plan(
String[1] $load_balancer,
TargetSpec $frontends,
TargetSpec $backends,
) {
# process frontends
run_task('my_mod ::lb_remove', $load_balancer, frontends => $frontends)
run_task('my_mod ::update_frontend_app', $frontends, version => '1.2.3')
run_task('my_mod ::lb_add', $load_balancer, frontends => $frontends)
}
https://puppet.com/docs/bolt/latest/writing_plans.html
Enable efficient coding with VS Code + plugin and the PDK
https://puppet.com/download-puppet-development-kit
+
Full description: https://github.com/lingua-pupuli/puppet-vscode
Coding for Puppet in VS Code, much better!
Isn’t there a better way to automation than Tasks?
So far, we’ve been using scripting approaches to fix time synchronization issues
• But the script only works on Windows
• If we also built a script for Linux, it wouldn’t look anything like the Windows one
• We don’t *want* to keep running scripts on systems over and over
• How would we know if we needed to run the script again? Would that even work?
• Surely *someone* has solved this issue already, right?!
- Insert eyeroll here -
Puppet DSL: Infrastructure as Code (IaC)
building { 'home':
ensure => 'clean',
front_door => 'closed',
keys => 'key_hook',
jacket => 'closet',
floor => 'vacuumed’,
litter_box => 'empty',
remote => 'coffee_table',
}
Puppet gives teams
a common,
model-driven
language.
Managing desired state configuration with Puppet DSL (1/2)
What if we could just describe what
end result we wanted:
• Time should always be in sync
• A specific list of timeservers
should be used to sync from
• Only sync as a client (don’t act as
an authoritative source)
class { 'windowstime':
servers => {
'0.nl.pool.ntp.org' => '0x08',
'1.nl.pool.ntp.org' => '0x08'
}
}
The 0x08 flag is
Windows-speak
for ‘Client’
Managing desired state configuration with Puppet DSL (2/2)
We still want the same things, but
now for any Linux OS:
• Time should always be in sync
• A specific list of timeservers
should be used to sync from
• Only sync as a client (don’t act as
an authoritative source)
class { 'ntp':
servers => [
'0.nl.pool.ntp.org',
'1.nl.pool.ntp.org'
]
restrict => [‘127.0.0.1’]
}
This is
Linux-speak
for ‘Client’
Applying Puppet DSL can also be done in a Bolt plan
Run your Puppet code from a plan,
using an Apply() block:
• Can be combined with all other
Plan functions (run_task,
run_command, etc)
• Requires the apply_prep() function
to be run first on nodes, this will
ensure the Puppet agent is
available and will run facter
plan tools::timesync_code(
TargetSpec $nodes,
) {
apply_prep($nodes)
apply($nodes) {
class { 'windowstime':
servers => {
'0.nl.pool.ntp.org' => '0x08',
'1.nl.pool.ntp.org' => '0x08’
}
}
}
What have we learned so far
We’ve now learned how with Puppet Bolt, we can:
• Commands, scripts, tasks, plans and manifests can be run with Puppet Bolt
• What the natural progression of automation looks like
• Turning interactive commands into scripts
• Turning scripts into tasks
• Turning tasks into plans
• Leveraging existing desired state modules and manifests
• Incorporating desired state code into plans
Bolt rocks, duh
Manage at scale.
Keep it compliant.
Puppet Enterprise Vendor neutral.
• Any container in any cloud
• Any bare metal or VM server
• Common network devices
• Any operating system
Model-driven and task-oriented.
• Desired-state configuration management
• Simple and orchestrated tasks
Enterprise-grade.
• Team features: RBAC, code mgmt
• Simple: installation / upgrade, console
• Scalability: 100k nodes and beyond
• Workflows: direct change, convergence
• Reporting & Compliance
A Leader in
Configuration
Management
Automation
Source: Forrester Research, Configuration Management Software for
Infrastructure Automation, Q4 2018. Download at puppet.com
Puppet Enterprise provides better situational awareness…
…across your entire infrastructure
See the enforcement history of every server in detail
See the state of all resources under management for a node
Automatically inspect & manage software across your estate
Control Puppet runs from a central location
Let’s connect our nodes to Puppet Enterprise
To complete the automation journey, all that’s left to do is maturing into PE
• Leverage PE to continuously & automatically enforce desired state code
• Gain auditability in PE on Bolt Tasks, Task Plans and manifests
• Use RBAC in PE to delegate permissions to other teams/coworkers
• Connect Bolt to PE to gain direct control over PE-managed nodes
We can natively run Tasks against our nodes from PE
• Available Tasks are
read from a code
repository
• Tasks can be
protected with
RBAC
• A Tasks history is
kept in the ‘Jobs’
view
Puppet Enterprise dynamically generates the UI for Tasks
You can even run Tasks agentlessly now (from PE 2019)
As well as specify a schedule for the Task to run on
You control who can run Tasks on which nodes…
…and all Tasks & Plans that ran get automatically logged
Can’t I just use Bolt directly against PE-managed nodes?
Bolt supports another transport: PCP (Puppet Communications Protocol)
• This is the protocol that Puppet Enterprise uses to centrally control nodes
• It uses PE’s RBAC for security, so you don’t need SSH/WinRM credentials
• Everything you do via PCP is automatically tracked & logged in Puppet Enterprise
• To set this up, you need three things:
• The puppetlabs/bolt_shim module on the PE server (already setup in this lab)
• The Tasks you want to use from Bolt must be copied into Git so PE can see them
• 4 entries in the pcp: section of bolt.yaml to tell Bolt how to connect to PE
The gift that keeps on giving…
Download the 2018 State of DevOps Report today
Figure out where you are in the journey. Learn what works. Reach for the next stage.
https://puppet.com/resources/whitepaper/state-of-devops-report
The shortest path
to better software.

Weitere ähnliche Inhalte

Was ist angesagt?

Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Git
dirtytactics
 

Was ist angesagt? (20)

Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Git
 
Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
 
More Productivitiy with Spring Roo
More Productivitiy with Spring RooMore Productivitiy with Spring Roo
More Productivitiy with Spring Roo
 
PuppetConf track overview: Puppet Applied
PuppetConf track overview: Puppet AppliedPuppetConf track overview: Puppet Applied
PuppetConf track overview: Puppet Applied
 
Getting started with Octopus Deploy
Getting started with Octopus DeployGetting started with Octopus Deploy
Getting started with Octopus Deploy
 
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
 
Continuous delivery with open source tools
Continuous delivery with open source toolsContinuous delivery with open source tools
Continuous delivery with open source tools
 
Create Your Own Chatbot with Hubot and CoffeeScript
Create Your Own Chatbot with Hubot and CoffeeScriptCreate Your Own Chatbot with Hubot and CoffeeScript
Create Your Own Chatbot with Hubot and CoffeeScript
 
Step away from that knife!
Step away from that knife!Step away from that knife!
Step away from that knife!
 
Code in the cloud with eclipse che and docker / snowcamp.io 2017
Code in the cloud with eclipse che and docker /  snowcamp.io 2017Code in the cloud with eclipse che and docker /  snowcamp.io 2017
Code in the cloud with eclipse che and docker / snowcamp.io 2017
 
PuppetConf track overview: Windows
PuppetConf track overview: WindowsPuppetConf track overview: Windows
PuppetConf track overview: Windows
 
Using Docker in CI process
Using Docker in CI processUsing Docker in CI process
Using Docker in CI process
 
Production Ready WordPress #WPLDN
Production Ready WordPress #WPLDNProduction Ready WordPress #WPLDN
Production Ready WordPress #WPLDN
 
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
 
PuppetConf 2016: How Not to Freak Out When You Start Writing Puppet Modules f...
PuppetConf 2016: How Not to Freak Out When You Start Writing Puppet Modules f...PuppetConf 2016: How Not to Freak Out When You Start Writing Puppet Modules f...
PuppetConf 2016: How Not to Freak Out When You Start Writing Puppet Modules f...
 
PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...
PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...
PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...
 
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDENantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
 
Crafting interactive troubleshooting guides and team documentation for your K...
Crafting interactive troubleshooting guides and team documentation for your K...Crafting interactive troubleshooting guides and team documentation for your K...
Crafting interactive troubleshooting guides and team documentation for your K...
 
Production Ready WordPress - WC Utrecht 2017
Production Ready WordPress  - WC Utrecht 2017Production Ready WordPress  - WC Utrecht 2017
Production Ready WordPress - WC Utrecht 2017
 
LVPHP.org
LVPHP.orgLVPHP.org
LVPHP.org
 

Ähnlich wie DevOps Automation with Puppet Bolt & Puppet Enterprise

Ähnlich wie DevOps Automation with Puppet Bolt & Puppet Enterprise (20)

Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
PuppetConf 2017: Puppet Enterprise Roadmap 2017- Ryan Coleman, Puppet
PuppetConf 2017: Puppet Enterprise Roadmap 2017- Ryan Coleman, PuppetPuppetConf 2017: Puppet Enterprise Roadmap 2017- Ryan Coleman, Puppet
PuppetConf 2017: Puppet Enterprise Roadmap 2017- Ryan Coleman, Puppet
 
Virtual Bolt Workshop - April 28, 2020
Virtual Bolt Workshop - April 28, 2020Virtual Bolt Workshop - April 28, 2020
Virtual Bolt Workshop - April 28, 2020
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Puppet
PuppetPuppet
Puppet
 
GDG-MLOps using Protobuf in Unity
GDG-MLOps using Protobuf in UnityGDG-MLOps using Protobuf in Unity
GDG-MLOps using Protobuf in Unity
 
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
 
Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrape
 
2016 05-cloudsoft-amp-and-brooklyn-new
2016 05-cloudsoft-amp-and-brooklyn-new2016 05-cloudsoft-amp-and-brooklyn-new
2016 05-cloudsoft-amp-and-brooklyn-new
 
OpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in PythonOpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in Python
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scaling
 
Where's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind PloneWhere's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind Plone
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack Summit
 
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
 

Mehr von Eficode

Mehr von Eficode (20)

Saving money with Consolidations
Saving money with ConsolidationsSaving money with Consolidations
Saving money with Consolidations
 
Scaling DevOps: Pitfalls to avoid
Scaling DevOps: Pitfalls to avoidScaling DevOps: Pitfalls to avoid
Scaling DevOps: Pitfalls to avoid
 
Microservices, IoT, DevOps: A Case Study
Microservices, IoT, DevOps: A Case StudyMicroservices, IoT, DevOps: A Case Study
Microservices, IoT, DevOps: A Case Study
 
Building a Knowledge Graph at Zalando
Building a Knowledge Graph at ZalandoBuilding a Knowledge Graph at Zalando
Building a Knowledge Graph at Zalando
 
How to build the Cloud Native applications the way you want – not the way the...
How to build the Cloud Native applications the way you want – not the way the...How to build the Cloud Native applications the way you want – not the way the...
How to build the Cloud Native applications the way you want – not the way the...
 
The Future of Enterprise Applications is Serverless
The Future of Enterprise Applications is ServerlessThe Future of Enterprise Applications is Serverless
The Future of Enterprise Applications is Serverless
 
Why Serverless is scary without DevSecOps and Observability
Why Serverless is scary without DevSecOps and ObservabilityWhy Serverless is scary without DevSecOps and Observability
Why Serverless is scary without DevSecOps and Observability
 
Securing Modern Applications: The Data Behind DevSecOps
Securing Modern Applications: The Data Behind DevSecOpsSecuring Modern Applications: The Data Behind DevSecOps
Securing Modern Applications: The Data Behind DevSecOps
 
Secure your Azure and DevOps in a smart way
Secure your Azure and DevOps in a smart waySecure your Azure and DevOps in a smart way
Secure your Azure and DevOps in a smart way
 
Can I Contain This?
Can I Contain This?Can I Contain This?
Can I Contain This?
 
The Mono-repo – a contradiction with Microservices
The Mono-repo – a contradiction with MicroservicesThe Mono-repo – a contradiction with Microservices
The Mono-repo – a contradiction with Microservices
 
Using Go in DevOps
Using Go in DevOpsUsing Go in DevOps
Using Go in DevOps
 
Why Should You Be Thinking About DesignOps?
Why Should You Be Thinking About DesignOps?Why Should You Be Thinking About DesignOps?
Why Should You Be Thinking About DesignOps?
 
A beginners guide to scaling DevOps
A beginners guide to scaling DevOpsA beginners guide to scaling DevOps
A beginners guide to scaling DevOps
 
From Zero to SAFe
From Zero to SAFeFrom Zero to SAFe
From Zero to SAFe
 
Bringing value to the business and for your customer through DevOps
Bringing value to the business and for your customer through DevOpsBringing value to the business and for your customer through DevOps
Bringing value to the business and for your customer through DevOps
 
Disconnected Pipelines: The Missing Link
Disconnected Pipelines: The Missing LinkDisconnected Pipelines: The Missing Link
Disconnected Pipelines: The Missing Link
 
The Best & Worst Uses of AI in Software Testing
The Best & Worst Uses of AI in Software TestingThe Best & Worst Uses of AI in Software Testing
The Best & Worst Uses of AI in Software Testing
 
Model-based programming and AI-assisted software development
Model-based programming and AI-assisted software developmentModel-based programming and AI-assisted software development
Model-based programming and AI-assisted software development
 
2018 State Of DevOps Report Key Findings
2018 State Of DevOps Report Key Findings2018 State Of DevOps Report Key Findings
2018 State Of DevOps Report Key Findings
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

DevOps Automation with Puppet Bolt & Puppet Enterprise

  • 1. DevOps Automation with Puppet Bolt & Puppet Enterprise Eficode DevOps Tooling Morning 2019 Kevin Reeuwijk Sr Sales Engineer NEMEA kevinr@puppet.com
  • 2.
  • 3. Bolt: an open source task runner Bolt provides a simple way to execute agentless automation against remote hosts • Zero requirements to the remote host. No agents, no python, no nothing. • Authenticate via SSH, WinRM, PCP • Execute arbitrary commands, scripts, Puppet Tasks and Puppet Task Plans • Use scripts in any language the remote host can execute • Mature at your own pace from scripts à tasks à plans à puppet code • If you have Puppet Enterprise, leverage PE from Bolt Accessible automation at no cost
  • 4. bolt command run <cmd> --nodes … bolt script run <file> --nodes … bolt task run <task> --nodes … 2. Scripts .sh .ps1 PS C:> [root/]# 1. Commands Start-Service W32Time systemctl start ntpd 3. Tasks .ps1 .json - Task description - Allowed parameters - Input validation bolt plan run <plan> --nodes … 4. Plans plan timesync::manage { run_task ( ‘timesync::reset’, $nodes, default => true ) apply ( $nodes ) { # some Puppet code here to manage time synchronization } run_task ( ‘timesync::restart’, $nodes, force => true ) } + Version Control
  • 5. Using Bolt Bolt command line syntax: bolt [command|script|task|plan] run <name> --nodes <nodes> [options] To run a simple Bash command on a remote SSH host: bolt command run 'echo Hello World!' --nodes 10.0.0.1, 10.0.0.2 --user root --private-key /path/to/key --transport ssh --no-host-key-check To run a simple PowerShell command on a remote WinRM host: bolt command run 'write-host Hello World!' --nodes 10.0.0.1, 10.0.0.2 --user administrator --password 'P@ssw0rd' --transport winrm --no-ssl
  • 6. Easing Bolt’s configuration Bolt provides ways to make common activities more efficient • Use a bolt.yaml file to store generic settings like modulepath or PE integration • Use an inventory.yaml file to prevent typing in connection info every time • Use a Boltdir to bundle all the files you need and have Bolt automatically use it https://puppet.com/docs/bolt
  • 7. Bolt Inventory File - Syntax groups: - name: group_name nodes: - IP_address_or_name_of_node1 - IP_address_or_name_of_node2 config: transport: [ ssh | winrm ] ssh: user: user_name run-as: root_name private-key: /path/to/key host-key-check: [ true | false ] winrm: user: user_name password: password ssl: [ true | false ] https://puppet.com/docs/bolt/latest/inventory_file.html Nesting of groups is allowed: groups: - name: top_group groups: - name: sub_group nodes: - …
  • 8. Turning a script into a Puppet Task Make your scripts more useful in Bolt by turning them into Puppet Tasks • Any script file in a tasks directory of a module becomes a Task • Tasks are name spaced automatically, using familiar Puppet syntax: modules/mymod/tasks/script1.ps1 # mymod::script1 modules/aws/tasks/show_vpc.sh # aws::show_vpc modules/mysql/tasks/sql.rb # mysql::sql modules/yum/tasks/init.rb # yum https://puppet.com/docs/bolt/latest/writing_tasks.html
  • 9. Writing metadata for Puppet Tasks Make your Tasks more useful and robust by writing metadata files for them • A metadata file has the same name as the script file, but with a .json extension • Metadata files using the following (JSON) syntax: { "description": ”Description of your Puppet Task", "input_method": "environment | stdin | powershell", "parameters": { ”param1": { "description": "Description of the parameter usage", "type": "String | Enum | Pattern | Integer | Array | Hash | Boolean" } } }
  • 10. Writing Puppet Task Plans Puppet Task Plans can use all of the previously covered capabilities, and more, in a single plan. It’s ideally suited to: • String Tasks together • Perform more complex logic & error handling, or interact with Puppet Enterprise • Combine command/scripts/Tasks with applying desired-state Puppet code • Plans are stored in a plans directory of a module and have a .pp extension • Plans must be name spaced according to their module & plan name https://puppet.com/docs/bolt/latest/writing_plans.html
  • 11. Anatomy of a Puppet Task Plan located in modules/my_mod/plans/my_plan.pp plan my_mod::my_plan( String[1] $load_balancer, TargetSpec $frontends, TargetSpec $backends, ) { # process frontends run_task('my_mod ::lb_remove', $load_balancer, frontends => $frontends) run_task('my_mod ::update_frontend_app', $frontends, version => '1.2.3') run_task('my_mod ::lb_add', $load_balancer, frontends => $frontends) } https://puppet.com/docs/bolt/latest/writing_plans.html
  • 12. Enable efficient coding with VS Code + plugin and the PDK https://puppet.com/download-puppet-development-kit + Full description: https://github.com/lingua-pupuli/puppet-vscode
  • 13. Coding for Puppet in VS Code, much better!
  • 14. Isn’t there a better way to automation than Tasks? So far, we’ve been using scripting approaches to fix time synchronization issues • But the script only works on Windows • If we also built a script for Linux, it wouldn’t look anything like the Windows one • We don’t *want* to keep running scripts on systems over and over • How would we know if we needed to run the script again? Would that even work? • Surely *someone* has solved this issue already, right?! - Insert eyeroll here -
  • 15. Puppet DSL: Infrastructure as Code (IaC) building { 'home': ensure => 'clean', front_door => 'closed', keys => 'key_hook', jacket => 'closet', floor => 'vacuumed’, litter_box => 'empty', remote => 'coffee_table', } Puppet gives teams a common, model-driven language.
  • 16. Managing desired state configuration with Puppet DSL (1/2) What if we could just describe what end result we wanted: • Time should always be in sync • A specific list of timeservers should be used to sync from • Only sync as a client (don’t act as an authoritative source) class { 'windowstime': servers => { '0.nl.pool.ntp.org' => '0x08', '1.nl.pool.ntp.org' => '0x08' } } The 0x08 flag is Windows-speak for ‘Client’
  • 17. Managing desired state configuration with Puppet DSL (2/2) We still want the same things, but now for any Linux OS: • Time should always be in sync • A specific list of timeservers should be used to sync from • Only sync as a client (don’t act as an authoritative source) class { 'ntp': servers => [ '0.nl.pool.ntp.org', '1.nl.pool.ntp.org' ] restrict => [‘127.0.0.1’] } This is Linux-speak for ‘Client’
  • 18. Applying Puppet DSL can also be done in a Bolt plan Run your Puppet code from a plan, using an Apply() block: • Can be combined with all other Plan functions (run_task, run_command, etc) • Requires the apply_prep() function to be run first on nodes, this will ensure the Puppet agent is available and will run facter plan tools::timesync_code( TargetSpec $nodes, ) { apply_prep($nodes) apply($nodes) { class { 'windowstime': servers => { '0.nl.pool.ntp.org' => '0x08', '1.nl.pool.ntp.org' => '0x08’ } } }
  • 19. What have we learned so far We’ve now learned how with Puppet Bolt, we can: • Commands, scripts, tasks, plans and manifests can be run with Puppet Bolt • What the natural progression of automation looks like • Turning interactive commands into scripts • Turning scripts into tasks • Turning tasks into plans • Leveraging existing desired state modules and manifests • Incorporating desired state code into plans Bolt rocks, duh
  • 20. Manage at scale. Keep it compliant.
  • 21. Puppet Enterprise Vendor neutral. • Any container in any cloud • Any bare metal or VM server • Common network devices • Any operating system Model-driven and task-oriented. • Desired-state configuration management • Simple and orchestrated tasks Enterprise-grade. • Team features: RBAC, code mgmt • Simple: installation / upgrade, console • Scalability: 100k nodes and beyond • Workflows: direct change, convergence • Reporting & Compliance
  • 22. A Leader in Configuration Management Automation Source: Forrester Research, Configuration Management Software for Infrastructure Automation, Q4 2018. Download at puppet.com
  • 23. Puppet Enterprise provides better situational awareness…
  • 24. …across your entire infrastructure
  • 25. See the enforcement history of every server in detail
  • 26. See the state of all resources under management for a node
  • 27. Automatically inspect & manage software across your estate
  • 28. Control Puppet runs from a central location
  • 29. Let’s connect our nodes to Puppet Enterprise To complete the automation journey, all that’s left to do is maturing into PE • Leverage PE to continuously & automatically enforce desired state code • Gain auditability in PE on Bolt Tasks, Task Plans and manifests • Use RBAC in PE to delegate permissions to other teams/coworkers • Connect Bolt to PE to gain direct control over PE-managed nodes
  • 30. We can natively run Tasks against our nodes from PE • Available Tasks are read from a code repository • Tasks can be protected with RBAC • A Tasks history is kept in the ‘Jobs’ view
  • 31. Puppet Enterprise dynamically generates the UI for Tasks
  • 32. You can even run Tasks agentlessly now (from PE 2019)
  • 33. As well as specify a schedule for the Task to run on
  • 34. You control who can run Tasks on which nodes…
  • 35. …and all Tasks & Plans that ran get automatically logged
  • 36. Can’t I just use Bolt directly against PE-managed nodes? Bolt supports another transport: PCP (Puppet Communications Protocol) • This is the protocol that Puppet Enterprise uses to centrally control nodes • It uses PE’s RBAC for security, so you don’t need SSH/WinRM credentials • Everything you do via PCP is automatically tracked & logged in Puppet Enterprise • To set this up, you need three things: • The puppetlabs/bolt_shim module on the PE server (already setup in this lab) • The Tasks you want to use from Bolt must be copied into Git so PE can see them • 4 entries in the pcp: section of bolt.yaml to tell Bolt how to connect to PE The gift that keeps on giving…
  • 37. Download the 2018 State of DevOps Report today Figure out where you are in the journey. Learn what works. Reach for the next stage. https://puppet.com/resources/whitepaper/state-of-devops-report
  • 38. The shortest path to better software.