SlideShare a Scribd company logo
The Cloud Specialists
Configuration	Management	Best	
Practices
Dag	Sonstebo
Cloud	Architect	
dag.sonstebo@shapeblue.com
Twitter:	@dagsonstebo
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A b o u t M e
• Cloud Architect @ ShapeBlue
• Background:
• Cloud	and	virtualization	architect	with	19	
years	experience	from	the	service	provider,	
financial	and	manufacturing	industries.
• Specialize	in:
• Cloud	infrastructure	architecture	and	
engineering.
• Virtualization	- VMware	vSphere,	Citrix	
XenServer,	KVM.
• Automation	and	configuration	
management.
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A b o u t S h a p e B l u e
“ShapeBlue are expert builders of public &
private clouds. They are the leading global
Apache CloudStack
integrator & consultancy”
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
S h a p e B l u e c u s t o m e r s
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Configuration management
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
W h a t i s c o n f i g u r a t i o n m a n a g e m e n t ?
• Wikipedia:
“Configuration management (CM) is a
systems engineering process for
establishing and maintaining consistency
of a product's performance, functional,
and physical attributes with its
requirements, design, and operational
information throughout its life.”
• Originated in the US military in the 1950’s,
has been adopted by a number of fields
since then – among these ITIL.
• Is becoming an important building block in
the devops and cloud era.
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Ve r y g o o d . . s o h o w d o e s i t a c t u a l l y w o r k i n o u r w o r l d ?
• From our point of view Configuration Management needs to ensure
idempotency across your infrastructure….
• An	idempotent	element	of	a	set	does	not	change	in	value	when	
multiplied	by	itself…...
• Mathematical	operation	which can	be	applied	multiple	times	
without	changing	the	result	beyond	the	initial	application…..
• Or - for the non-mathematicians:
• If	it	ain’t	broke,	don’t	fix	it....
• Run	it	a	1000	times,	outcome	must	be	the	same....
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Ve r y g o o d . . s o h o w d o e s i t a c t u a l l y w o r k i n o u r w o r l d ?
Config management toolset needs to:
• maintain	the	state	of	your	infrastructure
• be	highly	automated
• be consistent
• centralise	configuration	data	and	
procedures
• replace	your	manual	processes
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
W h y d o I n e e d i t ?
We’re moving…
• into	the	devops /	cloud	era	- bimodal	IT	adds	extra	
overhead
• from	kitten-centric	to	chicken-centric	infrastructure
• from	old-school	enterprise	IT	to	maintaining	our	
commodity	data	and	considering	workloads	as	
disposable
• towards	everything-as-a-service
• towards	consistent	Infrastructure-As-Code
Benefits:
• Reduction	in	cost	– less	effort,	less	manpower
• Increase	in	speed	– faster	execution	of	your	
procedures
• Reduction	of	risk	(remove	errors	and	security	
violations)
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
S o – h o w d o e s C o n f i g M a n a g e m e n t f i t i n t o t h i s ?
• Provides:
• High	degree	of	automation
• Consistent	procedures
• Requires:
• Change	in	company	culture	– from	techies	to	change	
management	team	and	up	to	CTO	office
• Change	in	technology	staff	skillsets
• A	new	approach	to	testing,	auditing	and	
authorization
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Best practices… or how do I get started....
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A p p r o a c h
• Start small, build gradually.
• Rome	wasn’t	built	in	a	day…..don’t	
try	to	take	on	the	world	in	the	first	week.
• Start off with the small tasks:
• Configure	your	NTP	settings
• Add	the	latest	DNS	servers	settings
• Standardize	your	SSH	login	policies.
• Then move on to the big tasks:
• Patch	those	25k	servers.
• Build	a	Continuous	Integration	workflow	which	does	nightly	software	builds	
and	rolls	these	out	to	your	environments	automagically.
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Ve r s i o n c o n t r o l
• Version control is no longer just for
developers…..
• It is a key component for
• Collaboration
• Traceability
• Quality	control
• A	starting	point	for	your	Continuous	
Integration	workflows….
• If you don’t know it – time to learn it!
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
M a k e s u r e e v e r y o n e i s o n b o a r d a n d p l a n y o u r a p p r o a c h … .
• Configuration
management requires a
change in culture - make
sure your team buys into
it.
• Plan your procedures
and make your code
reusable.
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
C h o o s e t h e r i g h t t o o l s f o r t h e j o b
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
C h o o s e t h e r i g h t t o o l s f o r t h e j o b
Things to consider:
• Command line or GUI?
• Agentless?
• Platform support?
• Runbook language skills required?
• Opensource or proprietary?
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A s e l e c t i o n f r o m t h e o p e n s o u r c e t o o l b o x …
Agentless Platform	support Runbooks
Ansible Yes Win /	Lin	/	Unix	/	OSX YAML English
Chef No Win /	Lin	/	Unix	/	OSX Ruby
Puppet No Win /	Lin	/	Unix	/	OSX Ruby
Salt Both
Win /	Lin	/	most	Unix	/	
OSXs
YAML English
Hashicorp . . .
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Tr e n d s
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Ansible
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
W h y d i d I c h o o s e A n s i b l e ?
• I tried Puppet and did not like:
• Ruby	runbooks
• Rolling	out	clients	and	assigning	certificates
• I	needed	something	simpler	and	more	robust…
• Ansible ticked all the boxes:
• Simple	and	agentless.
• All	configuration	done	over	SSH	or	PowerShell	using	username	+	password	or	
SSH	keys.
• Human	readable	configuration,	near	plain	English.
• Support	for:
• all	Operating	Systems
• Cloud	and	systems	providers	like	AWS,	Azure,	CloudStack,	Digitial Ocean,	
Docker,	Google,	OpenStack,	Rackspace,	Vmware…
• Push	or	pull	configuration
• Ad-hoc	tasks	or	bigger	playbooks
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
G e t t i n g s t a r t e d w i t h A n s i b l e
• Build Ansible control machine:
• Linux	or	OSX
• No	major	spec	requirements
• Install	Ansible
• Configure version control:
• E.g.	configure	your	Github repo
• Get started:
• Create	some	playbooks,	with	tasks	and	roles,	as	well	as	a	static	inventory.
• On your control machine pull down your repo and run your
playbooks:
• #	git pull
• #	ansible-playbook	–i inventoryfile playbookname.yml
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A n s i b l e p l a y b o o k – h e l l o w o r l d - i n s t a l l A p a c h e
deployapache.yml:
---
- hosts: webservers
vars: http_port: 80
max_clients: 200
remote_user: root
tasks:
- name: Update all packages
yum: name: '*' state: latest
- name: ensure apache is at the latest version
yum: name: httpd state: latest
- name: write the apache config file
template: src: /srv/httpd.j2 dest: /etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
service: name: httpd state: started
handlers:
- name: restart apache
service: name: httpd state: restarted
myinventory:
---
[webfarm:children]
webservers
mysqlservers
[mysqlservers]
mysqllhost1
Mysqllhost1
[webservers]
apachehost1
apachehost2
#ansible-playbook	–i myinventory deployapache.yml
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A n s i b l e b u i l d i n g b l o c k s
Playbooks
Host	Inventories
Hosts
Groups
Variables	(hosts	
or	groups)
Tasks Modules
Roles Tasks Modules
Templates jinja2
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
H o s t i n v e n t o r i e s
• Static • Dynamic scripts, e.g.
• DYI….
• Ansible Tower
• LDAP
• Cobbler
• AWS	EC2
• OpenStack
• BSD	Jails	
• DigitalOcean
• Google	Compute	Engine	
• Linode
• OpenShift
• Ovirt
• SpaceWalk
• Vagrant
• Zabbix
myinventory:
---
[webfarm:children]
webservers
mysqlservers
[mysqlservers]
mysqllhost1
Mysqllhost1
[webservers]
apachehost1
apachehost2
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A n s i b l e v a r i a b l e s
• Can be defined in:
• In	the	inventory.
• In	the	Ansible playbook.
• In	include	files	for	hosts	or	groups.
Inventory:
[webservers]
apachehost1 http_port=80
apachehost2 http_port=8080
Playbook:
- hosts: webservers
vars:
http_port: 80
Include file:
---
http_port: “80”
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A n s i b l e v a r i a b l e s
• Facts:
• Information	automatically	gathered	from	the	system	(not	user	
defined):
• You	can	also	write	your	own	– just	ensure	the	output	is	valid	JSON!
#	ansible kvmlab5-kvm1	-m	setup	-i hosts_kvmlab5ds-49kvmlab5-kvm1	|	SUCCESS	=>	{
"ansible_facts":	{
"ansible_all_ipv4_addresses":	[
"10.2.2.38",
"192.168.122.1",
"169.254.0.1”
],
"ansible_architecture":	"x86_64",
"ansible_bios_date":	"09/17/2015",
…..
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
A n s i b l e t a s k s a n d r o l e s
• Tasks:
- name:	ensure	yum	cache	is	cleared
shell:	command="yum	clean	all”
- name:	Install	MySQL
yum:	name=mysql-server	state=present
when:	ansible_distribution_major_version ==	"7"
- name:	Copy	DNS	settings	template
template:	
src=templates/resolveconf.j2	
dest=/etc/resolv.conf
• Roles: re-usable collections of tasks – e.g. ”apache”, “mysql”, etc.
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Te m p l a t e s
• Templates:
• used	to	populate	configuration	files,	etc.
• Written	in	the	Jinja2	python	templating	
language.
• Resolveconf.j2:
Variables:
dns_servers:
- 8.8.8.8
- 8.8.4.4
dns_search:		“mylab.local”
resolveconf.j2:
{%	for	ns	in	dns_servers %}
nameserver {{	ns	}}
{%	endfor %}
search	{{	dns_search }}
/etc/resolve.conf:
nameserver 8.8.8.8
nameserver 8.8.4.4
search	mylab.local
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Our use case
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
B a c k g r o u n d
• ShapeBlue:
• Apache	CloudStack	consultancy,	designing	and	
developing	IaaS	solutions	for	our	customers.
• Also	develop	features	and	provide	bugfixes – both	
for	the	open	source	community	as	well	as	our	own	
commercial	clients.
• Problem:
• Development	used	to	be	done	in	everyone's	home	labs	– using	
VMware	workstation	/	Fusion	/	XenServer /KVM	/	VirtualBox /	etc.
• Long	build	time	- 2-5	hours	per	lab	– built	per	FR	or	PR.
• ”It	worked	in	my	lab…...”
• We	needed	an	automated,	consistent	and	efficient	mechanism	to	
build	development	and	test	environments.
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
S o l u t i o n
• Solution:
• Trillian	project	– a	fast,	flexible,	and	consistent	environment	build	
framework	for	building	nested	CloudStack	clouds	in	our	own	CloudStack	
lab	– with	any	configuration	of	application	servers,	operating	systems,	
hypervisor	choice,	storage	options	and	networking	we	want.
• All	built	using	Ansible – 8000	lines	of	code.
• Each	environment	build	require	~2	mins	of	user	input,	environments	are	
built	in	~20	minutes.
• Full	Continuous	Integration	workflow:
PRs	or	commits	to	
Github
Github build	
bot	– Blue	
Orangutan
Jenkins	–
schedules	
build	and	
testing	jobs
Trillian	
environment	
build
Jenkins	
automated	
test	runs
Results	fed	
back	to	
Github
Trillian	
automatic	
decommision
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
R e s u l t
• Productivity increased 100x!
• 1500 environments and 6000 VMs built
over the last 5 months
• Time saving > 4000 man hours.
• Overall great success…
• But – lesson learnt – you can quickly
become a victim of your own success.
Ensure you have the resources and
stability for sustainable growth.
C l i c k t o e d i t
The Cloud Specialists
ShapeBlue.com @ShapeBlue
Questions?
The Cloud Specialists
Configuration	Management	Best	
Practices
Dag	Sonstebo
Cloud	Architect	
dag.sonstebo@shapeblue.com
Twitter:	@dagsonstebo

More Related Content

PDF
ApacheCon Miami / CCCNA17 CloudStack upgrade best practices
PDF
ApacheCon Miami / CCCNA17 Using KVM in CloudStack
PDF
CCNA17 KVM and CloudStack
PDF
CCCNA17 CloudStack upgrade best practices
PDF
CCCNA17 Distributed CI and Testing for Cloudstack in a Hybrid Community
PDF
CCCNA17 Introduction
PDF
CCCNA17 Reliable Host Fencing
PPTX
CCCNA17 CloudStack Container Service
ApacheCon Miami / CCCNA17 CloudStack upgrade best practices
ApacheCon Miami / CCCNA17 Using KVM in CloudStack
CCNA17 KVM and CloudStack
CCCNA17 CloudStack upgrade best practices
CCCNA17 Distributed CI and Testing for Cloudstack in a Hybrid Community
CCCNA17 Introduction
CCCNA17 Reliable Host Fencing
CCCNA17 CloudStack Container Service

What's hot (20)

PDF
CloudStack upgrade best practices - Dag Sonstebo
PDF
CCCNA17 Dynamic Roles in CloudStack
PPTX
Dynamic roles in cloudstack
PDF
CloudStack and NFV
PDF
CloudStack UI
PPTX
CloudStack EU user group - Trillian
PDF
Paul Angus - CloudStack Backup and Recovery Framework
PDF
CloudStack and testing
PPTX
Using the KVMhypervisor in CloudStack
PDF
Giles Sirett: Introduction and CloudStack news
PDF
New stuff in CloudStack!
PDF
CloudStack usage service
PPTX
Introduction and CloudStack news
PDF
Boris Stoyanov - some new features in Apache cloudStack
PPTX
Monkey man
PDF
Paul Angus – Backup & Recovery in CloudStack
PPTX
CloudStack News, Berlin 16 june 2016
PDF
CSEUG introduction
PPTX
What’s New in CloudStack 4.15 - CloudStack European User Group Virtual, May 2021
PPTX
CloudStack Container Service
CloudStack upgrade best practices - Dag Sonstebo
CCCNA17 Dynamic Roles in CloudStack
Dynamic roles in cloudstack
CloudStack and NFV
CloudStack UI
CloudStack EU user group - Trillian
Paul Angus - CloudStack Backup and Recovery Framework
CloudStack and testing
Using the KVMhypervisor in CloudStack
Giles Sirett: Introduction and CloudStack news
New stuff in CloudStack!
CloudStack usage service
Introduction and CloudStack news
Boris Stoyanov - some new features in Apache cloudStack
Monkey man
Paul Angus – Backup & Recovery in CloudStack
CloudStack News, Berlin 16 june 2016
CSEUG introduction
What’s New in CloudStack 4.15 - CloudStack European User Group Virtual, May 2021
CloudStack Container Service
Ad

Similar to TechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices (20)

PPTX
Ansible & CloudStack - Configuration Management
PPTX
Building cloud stack at scale
PDF
Practical Cloud & Workflow Orchestration
PDF
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
PDF
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
PPTX
Ansible: How to Get More Sleep and Require Less Coffee
PPTX
Configuration Management is Old and Boring
PPTX
Configuration Management and Deployment
PPTX
Configuration Management: What, Why, and How?
PDF
I Got 99 Problems and a Bash DSL Ain't One of Them
PPTX
Ansible.pptx
PPTX
Uncover the mysteries of infrastructure as code (iac)!
PDF
Hybrid Cloud Orchestration: How SuperChoice Does It
PDF
Web 2.0 Performance and Reliability: How to Run Large Web Apps
ODP
Automating MySQL operations with Puppet
PDF
Ansible.pdf
ODP
Softlayer devops
PPTX
'Intro to Infrastructure as Code' - DevOps Belfast
PDF
Puppet automated config_mgmt
PDF
Using ansible to manage cloud platform by Accelerite
Ansible & CloudStack - Configuration Management
Building cloud stack at scale
Practical Cloud & Workflow Orchestration
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Ansible: How to Get More Sleep and Require Less Coffee
Configuration Management is Old and Boring
Configuration Management and Deployment
Configuration Management: What, Why, and How?
I Got 99 Problems and a Bash DSL Ain't One of Them
Ansible.pptx
Uncover the mysteries of infrastructure as code (iac)!
Hybrid Cloud Orchestration: How SuperChoice Does It
Web 2.0 Performance and Reliability: How to Run Large Web Apps
Automating MySQL operations with Puppet
Ansible.pdf
Softlayer devops
'Intro to Infrastructure as Code' - DevOps Belfast
Puppet automated config_mgmt
Using ansible to manage cloud platform by Accelerite
Ad

Recently uploaded (20)

PPTX
Machine Learning_overview_presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Machine Learning_overview_presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
MIND Revenue Release Quarter 2 2025 Press Release
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25-Week II
Programs and apps: productivity, graphics, security and other tools
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Digital-Transformation-Roadmap-for-Companies.pptx

TechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices

  • 2. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A b o u t M e • Cloud Architect @ ShapeBlue • Background: • Cloud and virtualization architect with 19 years experience from the service provider, financial and manufacturing industries. • Specialize in: • Cloud infrastructure architecture and engineering. • Virtualization - VMware vSphere, Citrix XenServer, KVM. • Automation and configuration management.
  • 3. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A b o u t S h a p e B l u e “ShapeBlue are expert builders of public & private clouds. They are the leading global Apache CloudStack integrator & consultancy”
  • 4. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue S h a p e B l u e c u s t o m e r s
  • 5. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Configuration management
  • 6. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue W h a t i s c o n f i g u r a t i o n m a n a g e m e n t ? • Wikipedia: “Configuration management (CM) is a systems engineering process for establishing and maintaining consistency of a product's performance, functional, and physical attributes with its requirements, design, and operational information throughout its life.” • Originated in the US military in the 1950’s, has been adopted by a number of fields since then – among these ITIL. • Is becoming an important building block in the devops and cloud era.
  • 7. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Ve r y g o o d . . s o h o w d o e s i t a c t u a l l y w o r k i n o u r w o r l d ? • From our point of view Configuration Management needs to ensure idempotency across your infrastructure…. • An idempotent element of a set does not change in value when multiplied by itself…... • Mathematical operation which can be applied multiple times without changing the result beyond the initial application….. • Or - for the non-mathematicians: • If it ain’t broke, don’t fix it.... • Run it a 1000 times, outcome must be the same....
  • 8. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Ve r y g o o d . . s o h o w d o e s i t a c t u a l l y w o r k i n o u r w o r l d ? Config management toolset needs to: • maintain the state of your infrastructure • be highly automated • be consistent • centralise configuration data and procedures • replace your manual processes
  • 9. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue W h y d o I n e e d i t ? We’re moving… • into the devops / cloud era - bimodal IT adds extra overhead • from kitten-centric to chicken-centric infrastructure • from old-school enterprise IT to maintaining our commodity data and considering workloads as disposable • towards everything-as-a-service • towards consistent Infrastructure-As-Code Benefits: • Reduction in cost – less effort, less manpower • Increase in speed – faster execution of your procedures • Reduction of risk (remove errors and security violations)
  • 10. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue S o – h o w d o e s C o n f i g M a n a g e m e n t f i t i n t o t h i s ? • Provides: • High degree of automation • Consistent procedures • Requires: • Change in company culture – from techies to change management team and up to CTO office • Change in technology staff skillsets • A new approach to testing, auditing and authorization
  • 11. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Best practices… or how do I get started....
  • 12. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A p p r o a c h • Start small, build gradually. • Rome wasn’t built in a day…..don’t try to take on the world in the first week. • Start off with the small tasks: • Configure your NTP settings • Add the latest DNS servers settings • Standardize your SSH login policies. • Then move on to the big tasks: • Patch those 25k servers. • Build a Continuous Integration workflow which does nightly software builds and rolls these out to your environments automagically.
  • 13. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Ve r s i o n c o n t r o l • Version control is no longer just for developers….. • It is a key component for • Collaboration • Traceability • Quality control • A starting point for your Continuous Integration workflows…. • If you don’t know it – time to learn it!
  • 14. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue M a k e s u r e e v e r y o n e i s o n b o a r d a n d p l a n y o u r a p p r o a c h … . • Configuration management requires a change in culture - make sure your team buys into it. • Plan your procedures and make your code reusable.
  • 15. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue C h o o s e t h e r i g h t t o o l s f o r t h e j o b
  • 16. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue C h o o s e t h e r i g h t t o o l s f o r t h e j o b Things to consider: • Command line or GUI? • Agentless? • Platform support? • Runbook language skills required? • Opensource or proprietary?
  • 17. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A s e l e c t i o n f r o m t h e o p e n s o u r c e t o o l b o x … Agentless Platform support Runbooks Ansible Yes Win / Lin / Unix / OSX YAML English Chef No Win / Lin / Unix / OSX Ruby Puppet No Win / Lin / Unix / OSX Ruby Salt Both Win / Lin / most Unix / OSXs YAML English Hashicorp . . .
  • 18. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Tr e n d s
  • 19. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Ansible
  • 20. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue W h y d i d I c h o o s e A n s i b l e ? • I tried Puppet and did not like: • Ruby runbooks • Rolling out clients and assigning certificates • I needed something simpler and more robust… • Ansible ticked all the boxes: • Simple and agentless. • All configuration done over SSH or PowerShell using username + password or SSH keys. • Human readable configuration, near plain English. • Support for: • all Operating Systems • Cloud and systems providers like AWS, Azure, CloudStack, Digitial Ocean, Docker, Google, OpenStack, Rackspace, Vmware… • Push or pull configuration • Ad-hoc tasks or bigger playbooks
  • 21. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue G e t t i n g s t a r t e d w i t h A n s i b l e • Build Ansible control machine: • Linux or OSX • No major spec requirements • Install Ansible • Configure version control: • E.g. configure your Github repo • Get started: • Create some playbooks, with tasks and roles, as well as a static inventory. • On your control machine pull down your repo and run your playbooks: • # git pull • # ansible-playbook –i inventoryfile playbookname.yml
  • 22. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A n s i b l e p l a y b o o k – h e l l o w o r l d - i n s t a l l A p a c h e deployapache.yml: --- - hosts: webservers vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: Update all packages yum: name: '*' state: latest - name: ensure apache is at the latest version yum: name: httpd state: latest - name: write the apache config file template: src: /srv/httpd.j2 dest: /etc/httpd.conf notify: - restart apache - name: ensure apache is running service: name: httpd state: started handlers: - name: restart apache service: name: httpd state: restarted myinventory: --- [webfarm:children] webservers mysqlservers [mysqlservers] mysqllhost1 Mysqllhost1 [webservers] apachehost1 apachehost2 #ansible-playbook –i myinventory deployapache.yml
  • 23. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A n s i b l e b u i l d i n g b l o c k s Playbooks Host Inventories Hosts Groups Variables (hosts or groups) Tasks Modules Roles Tasks Modules Templates jinja2
  • 24. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue H o s t i n v e n t o r i e s • Static • Dynamic scripts, e.g. • DYI…. • Ansible Tower • LDAP • Cobbler • AWS EC2 • OpenStack • BSD Jails • DigitalOcean • Google Compute Engine • Linode • OpenShift • Ovirt • SpaceWalk • Vagrant • Zabbix myinventory: --- [webfarm:children] webservers mysqlservers [mysqlservers] mysqllhost1 Mysqllhost1 [webservers] apachehost1 apachehost2
  • 25. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A n s i b l e v a r i a b l e s • Can be defined in: • In the inventory. • In the Ansible playbook. • In include files for hosts or groups. Inventory: [webservers] apachehost1 http_port=80 apachehost2 http_port=8080 Playbook: - hosts: webservers vars: http_port: 80 Include file: --- http_port: “80”
  • 26. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A n s i b l e v a r i a b l e s • Facts: • Information automatically gathered from the system (not user defined): • You can also write your own – just ensure the output is valid JSON! # ansible kvmlab5-kvm1 -m setup -i hosts_kvmlab5ds-49kvmlab5-kvm1 | SUCCESS => { "ansible_facts": { "ansible_all_ipv4_addresses": [ "10.2.2.38", "192.168.122.1", "169.254.0.1” ], "ansible_architecture": "x86_64", "ansible_bios_date": "09/17/2015", …..
  • 27. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue A n s i b l e t a s k s a n d r o l e s • Tasks: - name: ensure yum cache is cleared shell: command="yum clean all” - name: Install MySQL yum: name=mysql-server state=present when: ansible_distribution_major_version == "7" - name: Copy DNS settings template template: src=templates/resolveconf.j2 dest=/etc/resolv.conf • Roles: re-usable collections of tasks – e.g. ”apache”, “mysql”, etc.
  • 28. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Te m p l a t e s • Templates: • used to populate configuration files, etc. • Written in the Jinja2 python templating language. • Resolveconf.j2: Variables: dns_servers: - 8.8.8.8 - 8.8.4.4 dns_search: “mylab.local” resolveconf.j2: {% for ns in dns_servers %} nameserver {{ ns }} {% endfor %} search {{ dns_search }} /etc/resolve.conf: nameserver 8.8.8.8 nameserver 8.8.4.4 search mylab.local
  • 29. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Our use case
  • 30. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue B a c k g r o u n d • ShapeBlue: • Apache CloudStack consultancy, designing and developing IaaS solutions for our customers. • Also develop features and provide bugfixes – both for the open source community as well as our own commercial clients. • Problem: • Development used to be done in everyone's home labs – using VMware workstation / Fusion / XenServer /KVM / VirtualBox / etc. • Long build time - 2-5 hours per lab – built per FR or PR. • ”It worked in my lab…...” • We needed an automated, consistent and efficient mechanism to build development and test environments.
  • 31. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue S o l u t i o n • Solution: • Trillian project – a fast, flexible, and consistent environment build framework for building nested CloudStack clouds in our own CloudStack lab – with any configuration of application servers, operating systems, hypervisor choice, storage options and networking we want. • All built using Ansible – 8000 lines of code. • Each environment build require ~2 mins of user input, environments are built in ~20 minutes. • Full Continuous Integration workflow: PRs or commits to Github Github build bot – Blue Orangutan Jenkins – schedules build and testing jobs Trillian environment build Jenkins automated test runs Results fed back to Github Trillian automatic decommision
  • 32. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue R e s u l t • Productivity increased 100x! • 1500 environments and 6000 VMs built over the last 5 months • Time saving > 4000 man hours. • Overall great success… • But – lesson learnt – you can quickly become a victim of your own success. Ensure you have the resources and stability for sustainable growth.
  • 33. C l i c k t o e d i t The Cloud Specialists ShapeBlue.com @ShapeBlue Questions?