SlideShare una empresa de Scribd logo
1 de 62
Descargar para leer sin conexión
. 
AAuuggeeaass 
SSwwiissss--kknniiffee rreessoouurrcceess ffoorr yyoouurr ppuuppppeett ttrreeee 
Julien Pivotto 
Belgian Puppet User Group 
Holiday is over Meetup!!! - November 12th, 2014
. 
wwhhooaammii 
JJuulliieenn PPiivvoottttoo 
• Open-Source consultant at inuits.eu 
• FOSS defender since 2004 
• DevOps believer and evangelist 
• Puppet User since 2011 
• @roidelapluie on twitter/github
. 
. 
ınuits.eu
. 
. 
SSyyssaaddmmiinn 110011 
CC BY-SA 2.0 https://www.flickr.com/photos/arthur-caranta/2926332140
. 
SSeettttiinngg uupp aa sseerrvviiccee 
• Install the package 
• Change the configuration 
• Start the daemon
. 
3 steps. 
What can go wrong?
. 
PPaacckkaaggiinngg 
• Where is the package? 
• Which version do we need? 
• Does it conflict with something else?
. 
. 
DDeeppeennddeenncciieess HHeellll 
CC BY-SA 2.0 https://www.flickr.com/photos/coconinonationalforest/4587053982
. 
CCoonnffiigguurraattiioonn 
• Where is the file? 
• How many files? 
• Configuration is in the database? 
• The file is *huge*
. 
SSttaarrttiinngg tthhee sseerrvviiccee 
• Does not start 
▶ Bad config file 
▶ Stale lock file 
▶ Data corruption 
• High Availability 
• Replication
. 
LLeett''ss ttaallkk aabboouutt PPuuppppeett aanndd ffiilleess 
• Classical approach: File[] resource 
• Advanced approach: Concat[] define 
• Broken approach: Exec[sed] resource 
• Surgical approach: Augeas[] resource
. 
HHiiddddeenn wwaayyss ttoommaannaaggee ffiilleess 
• Ssh_authorized_key[] 
• Nagios_* 
• To purge or not to purge
. 
. 
TThhee FFiillee[[]] rreessoouurrccee 
CC BY 2.0 https://www.flickr.com/photos/80497449@N04/10567875696/
. 
FFiillee 
• Built-in puppet resource 
• Most used 
• Works with a lot of usecases 
• Text files, binary files
. 
. 
file{"${::icinga::confdir_server}/cgi.cfg": 
ensure => present, 
content => template('icinga/redhat/cgi.cfg.erb'), 
owner => $::icinga::server_user, 
group => $::icinga::server_group, 
require => Class['icinga::config'], 
notify => [ 
Service[$::icinga::service_client], 
Service[$::icinga::service_server], 
Exec['fix_collected_permissions'] 
], 
} 
.
. 
CCoonntteenntt ooff aa ffiillee 
• content => String, template(), file() 
• source => puppet:///, /local/file
. 
FFiillee[[]] bbeehhaavviioouurr 
• Array as "source": Puppet will pick the first 
available one 
• Multiple arguments to template(): Puppet 
will concatenate them all 
• File[/foo/bar] will autorequire File[/foo]
. 
DDoowwnnssiiddee ooff FFiillee[[]] 
• You can only have at one "content" 
• That resource describe the whole file 
• Works in almost every situation
. 
. 
concat 
Public Domain http://commons.wikimedia.org/wiki/File:Adhesive_tapes_clear.JPG
. 
CCoonnccaatt 
• A "reference" puppet module: 
puppetlabs/concat 
• https://github.com/puppetlabs/puppetlabs-concat 
• Provides definitions to manage file 
• Alternative modules: 
▶ onyxpoint/pupmod-concat 
▶ theforeman/puppet-concat (fork of onyxpoint)
. 
CCoonnccaatt?? 
• Concat takes a bunch of snippets 
• Assemble them info a file 
• Each snippet is a define 
• The final file is a define
. 
. 
concat { '/tmp/file': 
ensure => present, 
} 
concat::fragment { 'tmpfile': 
target => '/tmp/file', 
content => 'test contents', 
order => '01' 
} 
.
. 
BBaassee aanndd ffrraaggmmeennttss 
• Concat[] defines owner, ensure, mode of the 
file 
• Concat::Fragment[] defines the contents of 
the file 
• One Concat[] has multiple 
Concat::Fragment[]
. 
AAddvvaannttaaggeess ooff ccoonnccaatt 
• More flexibility 
▶ if 
▶ virtual resource 
▶ exported resources 
▶ create_resources 
• Mix templates and files
. 
DDiissaaddvvaannttaaggeess ooff ccoonnccaatt 
• External Puppet module 
• Concat[] is the whole file 
• Performances
. 
. 
Exec{sed: onlyif => grep} 
CC BY-SA 3.0 http://commons.wikimedia.org/wiki/File:Ca%C3%AFn_par_Henri_Vidal.jpg
. 
. 
https://github.com/search?o=desc&q=exec+sed+onlyif+grep+language%3APuppet
. 
eexxeecc[[sseedd]] iiss bbrr00kkeenn 
• Which options to pass to sed and grep? 
• You should use as few Exec[] as possible 
• grep .... 
• Escape, regexes…
. 
AAnnootthheerr aalltteerrnnaattiivvee:: ccoonnff..dd 
• Some services support conf.d directories 
• But it is hard to change existing parameters 
• In which order are the files read? 
• Don't forget to purge
. 
. 
Augeas 
CC BY-SA 3.0 http://commons.wikimedia.org/wiki/File:Students_assisting_surgery.JPG
. 
AAuuggeeaass 
• Configuration editing tool 
• First release in 2007 
• API coded in C 
• Command-line tools 
• bindings for different languages
. 
CCoonnffiigguurraattiioonn eeddiittiinngg ttooooll 
• Parsing the configuration files 
• Turning them into a tree 
• Edit the tree & save the configuration
. 
. 
$ cat /etc/nsswitch.conf 
# /etc/nsswitch.conf 
## 
Example configuration 
# 
passwd: db files 
group: db files 
initgroups: db [SUCCESS=continue] files 
shadow: db files 
gshadow: files 
.
. 
. 
augtool> ls /files/etc/nsswitch.conf/ 
#comment[1] = /etc/nsswitch.conf 
#comment[2] = Example configuration 
database[1]/ = passwd 
database[2]/ = group 
database[3]/ = initgroups 
database[4]/ = shadow 
database[5]/ = gshadow 
.
. 
. 
augtool> ls /files/etc/nsswitch.conf/database[1]/ 
service[1] = db 
service[2] = files 
.
. 
NNaattiivvee ffoorrmmaatt -->> ttrreeee 
• Augeas understand comments 
• Augeas does not care about empty lines 
• The cli tool (augtool) has autocomplete 
• It recognize a lot of formats
. 
. 
augtool> set /files/etc/nsswitch.conf/database[1]/ 
service[last()+1] ldap 
augtool> save 
Saved 1 file(s) 
.
. 
. 
$ cat /etc/nsswitch.conf 
# /etc/nsswitch.conf 
## 
Example configuration 
# 
passwd: db files ldap 
group: db files 
initgroups: db [SUCCESS=continue] files 
shadow: db files 
gshadow: files 
.
. 
. 
augtool> match /files/etc/nsswitch.conf/*/* ldap 
/files/etc/nsswitch.conf/database[1]/service[3] 
augtool> print /files/etc/nsswitch.conf/database[1] 
/files/etc/nsswitch.conf/database[1] = "passwd" 
/files/etc/nsswitch.conf/database[1]/service[1] = "db" 
/files/etc/nsswitch.conf/database[1]/service[2] = "files" 
/files/etc/nsswitch.conf/database[1]/service[3] = "ldap" 
.
. 
. 
augtool> rm /files/etc/nsswitch.conf/database[1]/service[3] 
rm : /files/etc/nsswitch.conf/database[1]/service[3] 1 
augtool> print /files/etc/nsswitch.conf/database[1] 
/files/etc/nsswitch.conf/database[1] = "passwd" 
/files/etc/nsswitch.conf/database[1]/service[1] = "db" 
/files/etc/nsswitch.conf/database[1]/service[2] = "files" 
augtool> save 
Saved 1 file(s) 
.
. 
OOnnee AAPPII ttoo eeddiitt tthheemmaallll 
• Can talk XML, ini, named, nginx, … 
• Only change what is needed 
• Ensure the syntax is right
. 
AAuuggeeaass LLeennsseess 
• Lenses are files that explain how to edit files 
• It contains paths and syntax 
• There are a lot of them available 
• You can write your own lenses
. 
”This brings the total number of lenses to 
178. […] It’s depressing to think that 
Linux/Unix systems have managed to grow 
this many special snowflake formats.” 
David Lutterkort, main developer 
about Augeas 1.3.0
. 
117788 lleennsseess 
activemq_conf activemq_xml aliases aptconf 
apt_update_manager backuppchosts bbhosts bootconf build 
carbon cgrules channels cobblermodules cobblersettings collectd 
crypttab cyrus_imapd darkice debctrl desktop device_map dhcpd 
dnsmasq dovecot dpkg dput ethers exports fai_diskconfig fonts 
fuse gdm grub gshadow hostname inetd inputrc interfaces iproute2 
iptables jaas jmxaccess keepalived known_hosts koji krb5 ldif limits 
login_defs logrotate mcollective memcached mke2fs 
mongodbserver mysql nagioscfg nagiosobjects netmasks nginx ntp 
ntpd odbc openshift_config openshift_http openvpn pam passwd 
pbuilder postfix_main postfix_transport postfix_virtual 
puppet_auth qpid rabbitmq resolv rmt securetty sep services shells 
shellvars_list sip_conf slapd smbusers squid sshd stunnel 
subversion sudoers sysconfig systemd thttpd up2date vfstab
. 
AA sshhoorrtt lleennssee 
. 
module Hostname = 
autoload xfm 
(* View: lns *) 
let lns = [ label "hostname" . store Rx.word . Util.eol ] 
(* View: filter *) 
let filter = incl "/etc/hostname" 
. incl "/etc/mailname" 
let xfm = transform lns filter 
.
. 
PPuuppppeett <<33 aauuggeeaass 
• Native "augeas" resource 
• Support for pluginsync 
• Helpers available
. 
PPuuppppeett eexxaammppllee 
. 
augeas { $name: 
context => "/files${fstab::variables::fstab_file}", 
changes => [ 
"rm ${fstab_match_line}", 
], 
onlyif => "match ${fstab_match_line} size > 0" 
} 
.
. 
RReeaall uusseeccaasseess 
• Change grub options 
• Modify /etc/hosts 
• Modify XML's (puppetlabs-tomcat) 
• Configure Jenkins
. 
PPlluuggiinnssyynncc 
• Puppet has pluginsync support for Augeas 
• Drop your lenses in your modules 
• lib/augeas/lenses 
• Use the "lens" parameter of the augeas 
resource
. 
PPuuppppeett eexxaammppllee 
. 
augeas{"jboss_conf": 
. 
context => "/files/etc/jbossas", 
changes => [ 
"set jbossas.conf/JBOSS_IP $ipaddress", 
"set jbossas.conf/JAVA_HOME /usr", 
], 
lens => "Jboss.aug", 
}
. 
AAuuggeeaass ccoommmmaannddss 
set rm mv clear insert …
. 
AAuuggeeaass ccoommppaarraattoorrss ((oonnllyyiiff)) 
match get
. 
AAuuggeeaasspprroovviiddeerrss 
• Helpers around augeas 
• Puppet modules 
• No augeas knowledge needed
. 
aappaacchhee 
. 
apache_setenv { "SPECIAL_PATH": 
ensure => present, 
value => "/foo/bin", 
} 
.
. 
kkeerrnneell__ppaarraammeetteerr 
. 
kernel_parameter { "quiet": 
ensure => present, 
bootmode => "normal", 
} 
.
. 
Conclusion
. 
DDiissaaddvvaannttaaggeess 
• Learning required 
• Library to install 
• Writing lenses is hard
. 
AAddvvaannttaaggeess 
• Augeas is a mature tool 
• Preserves comments in files 
• It fails (if needed) 
• Only changes what is needed 
• A lot of lenses available 
• Puppet integration 
• Helpers available
. 
FFiinnaall nnoottee 
Most of the time, File[] resources are the way 
to go. Augeas can help when you need to 
change files generated by an application or 
that you can not manage entirely.
. 
RReeaaddiinnggss 
• http://augeas.net/ 
• http://augeasproviders.com/ 
• https://docs.puppetlabs.com/
. 
TThhaannkk yyoouu 
Any question? 
Thanks to @raphink
. 
CCoonnttaacctt 
Julien Pivotto 
julien@inuits.eu 
@roidelapluie 
INUITS bvba 
Belgium 
+32 473 441 636 
https://inuits.eu

Más contenido relacionado

La actualidad más candente

DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)Soshi Nemoto
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopWalter Heck
 
“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.Graham Dumpleton
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleRoman Rodomansky
 
Puppet for SysAdmins
Puppet for SysAdminsPuppet for SysAdmins
Puppet for SysAdminsPuppet
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Łukasz Proszek
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Puppet
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012Carlos Sanchez
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Chu-Siang Lai
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetWalter Heck
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppWalter Heck
 
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2Yros
 
Automated reproducible images on openstack using vagrant and packer
Automated reproducible images on openstack using vagrant and packerAutomated reproducible images on openstack using vagrant and packer
Automated reproducible images on openstack using vagrant and packerJan Collijs
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 

La actualidad más candente (20)

DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
 
Puppet for SysAdmins
Puppet for SysAdminsPuppet for SysAdmins
Puppet for SysAdmins
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
 
Automated reproducible images on openstack using vagrant and packer
Automated reproducible images on openstack using vagrant and packerAutomated reproducible images on openstack using vagrant and packer
Automated reproducible images on openstack using vagrant and packer
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 

Similar a Augeas, swiss knife resources for your puppet tree

LXC Containers and AUFs
LXC Containers and AUFsLXC Containers and AUFs
LXC Containers and AUFsDocker, Inc.
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with PuppetJoe Ray
 
Webinar - Managing Files with Puppet
Webinar - Managing Files with PuppetWebinar - Managing Files with Puppet
Webinar - Managing Files with PuppetOlinData
 
24HOP Introduction to Linux for SQL Server DBAs
24HOP Introduction to Linux for SQL Server DBAs24HOP Introduction to Linux for SQL Server DBAs
24HOP Introduction to Linux for SQL Server DBAsKellyn Pot'Vin-Gorman
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
An introduction to Rex - FLOSS UK DevOps York 2015
An introduction to Rex - FLOSS UK DevOps York 2015An introduction to Rex - FLOSS UK DevOps York 2015
An introduction to Rex - FLOSS UK DevOps York 2015Andy Beverley
 
Bacula Overview
Bacula OverviewBacula Overview
Bacula Overviewsambismo
 
Topic 3-1_More_Linux_Commands.pptx
Topic 3-1_More_Linux_Commands.pptxTopic 3-1_More_Linux_Commands.pptx
Topic 3-1_More_Linux_Commands.pptxdulala3
 
Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...
Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...
Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...Puppet
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachAlessandro Franceschi
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Puppet
 
Gentoo Linux, or Why in the World You Should Compile Everything
Gentoo Linux, or Why in the World You Should Compile EverythingGentoo Linux, or Why in the World You Should Compile Everything
Gentoo Linux, or Why in the World You Should Compile EverythingDonnie Berkholz
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk GötzNETWAYS
 
Hadoop 20111117
Hadoop 20111117Hadoop 20111117
Hadoop 20111117exsuns
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Studyhernanibf
 

Similar a Augeas, swiss knife resources for your puppet tree (20)

LXC Containers and AUFs
LXC Containers and AUFsLXC Containers and AUFs
LXC Containers and AUFs
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with Puppet
 
#WeSpeakLinux Session
#WeSpeakLinux Session#WeSpeakLinux Session
#WeSpeakLinux Session
 
Webinar - Managing Files with Puppet
Webinar - Managing Files with PuppetWebinar - Managing Files with Puppet
Webinar - Managing Files with Puppet
 
Linux Fundamentals
Linux FundamentalsLinux Fundamentals
Linux Fundamentals
 
Puppet quick start guide
Puppet quick start guidePuppet quick start guide
Puppet quick start guide
 
24HOP Introduction to Linux for SQL Server DBAs
24HOP Introduction to Linux for SQL Server DBAs24HOP Introduction to Linux for SQL Server DBAs
24HOP Introduction to Linux for SQL Server DBAs
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
An introduction to Rex - FLOSS UK DevOps York 2015
An introduction to Rex - FLOSS UK DevOps York 2015An introduction to Rex - FLOSS UK DevOps York 2015
An introduction to Rex - FLOSS UK DevOps York 2015
 
Edubooktraining
EdubooktrainingEdubooktraining
Edubooktraining
 
Bacula Overview
Bacula OverviewBacula Overview
Bacula Overview
 
Topic 3-1_More_Linux_Commands.pptx
Topic 3-1_More_Linux_Commands.pptxTopic 3-1_More_Linux_Commands.pptx
Topic 3-1_More_Linux_Commands.pptx
 
Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...
Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...
Puppet Modules: An Holistic Approach - Alessandro Franceschi of Lab42 - Puppe...
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
 
Gentoo Linux, or Why in the World You Should Compile Everything
Gentoo Linux, or Why in the World You Should Compile EverythingGentoo Linux, or Why in the World You Should Compile Everything
Gentoo Linux, or Why in the World You Should Compile Everything
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
Hadoop 20111117
Hadoop 20111117Hadoop 20111117
Hadoop 20111117
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
 

Más de Julien Pivotto

What's New in Prometheus and Its Ecosystem
What's New in Prometheus and Its EcosystemWhat's New in Prometheus and Its Ecosystem
What's New in Prometheus and Its EcosystemJulien Pivotto
 
Prometheus: What is is, what is new, what is coming
Prometheus: What is is, what is new, what is comingPrometheus: What is is, what is new, what is coming
Prometheus: What is is, what is new, what is comingJulien Pivotto
 
What's new in Prometheus?
What's new in Prometheus?What's new in Prometheus?
What's new in Prometheus?Julien Pivotto
 
Introduction to Grafana Loki
Introduction to Grafana LokiIntroduction to Grafana Loki
Introduction to Grafana LokiJulien Pivotto
 
Why you should revisit mgmt
Why you should revisit mgmtWhy you should revisit mgmt
Why you should revisit mgmtJulien Pivotto
 
Observing the HashiCorp Ecosystem From Prometheus
Observing the HashiCorp Ecosystem From PrometheusObserving the HashiCorp Ecosystem From Prometheus
Observing the HashiCorp Ecosystem From PrometheusJulien Pivotto
 
Monitoring in a fast-changing world with Prometheus
Monitoring in a fast-changing world with PrometheusMonitoring in a fast-changing world with Prometheus
Monitoring in a fast-changing world with PrometheusJulien Pivotto
 
5 tips for Prometheus Service Discovery
5 tips for Prometheus Service Discovery5 tips for Prometheus Service Discovery
5 tips for Prometheus Service DiscoveryJulien Pivotto
 
Prometheus and TLS - an Introduction
Prometheus and TLS - an IntroductionPrometheus and TLS - an Introduction
Prometheus and TLS - an IntroductionJulien Pivotto
 
Powerful graphs in Grafana
Powerful graphs in GrafanaPowerful graphs in Grafana
Powerful graphs in GrafanaJulien Pivotto
 
HAProxy as Egress Controller
HAProxy as Egress ControllerHAProxy as Egress Controller
HAProxy as Egress ControllerJulien Pivotto
 
Improved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and AlertmanagerImproved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and AlertmanagerJulien Pivotto
 
SIngle Sign On with Keycloak
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with KeycloakJulien Pivotto
 
Monitoring as an entry point for collaboration
Monitoring as an entry point for collaborationMonitoring as an entry point for collaboration
Monitoring as an entry point for collaborationJulien Pivotto
 
Incident Resolution as Code
Incident Resolution as CodeIncident Resolution as Code
Incident Resolution as CodeJulien Pivotto
 
Monitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusMonitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusJulien Pivotto
 
Monitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusMonitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusJulien Pivotto
 
An introduction to Ansible
An introduction to AnsibleAn introduction to Ansible
An introduction to AnsibleJulien Pivotto
 

Más de Julien Pivotto (20)

The O11y Toolkit
The O11y ToolkitThe O11y Toolkit
The O11y Toolkit
 
What's New in Prometheus and Its Ecosystem
What's New in Prometheus and Its EcosystemWhat's New in Prometheus and Its Ecosystem
What's New in Prometheus and Its Ecosystem
 
Prometheus: What is is, what is new, what is coming
Prometheus: What is is, what is new, what is comingPrometheus: What is is, what is new, what is coming
Prometheus: What is is, what is new, what is coming
 
What's new in Prometheus?
What's new in Prometheus?What's new in Prometheus?
What's new in Prometheus?
 
Introduction to Grafana Loki
Introduction to Grafana LokiIntroduction to Grafana Loki
Introduction to Grafana Loki
 
Why you should revisit mgmt
Why you should revisit mgmtWhy you should revisit mgmt
Why you should revisit mgmt
 
Observing the HashiCorp Ecosystem From Prometheus
Observing the HashiCorp Ecosystem From PrometheusObserving the HashiCorp Ecosystem From Prometheus
Observing the HashiCorp Ecosystem From Prometheus
 
Monitoring in a fast-changing world with Prometheus
Monitoring in a fast-changing world with PrometheusMonitoring in a fast-changing world with Prometheus
Monitoring in a fast-changing world with Prometheus
 
5 tips for Prometheus Service Discovery
5 tips for Prometheus Service Discovery5 tips for Prometheus Service Discovery
5 tips for Prometheus Service Discovery
 
Prometheus and TLS - an Introduction
Prometheus and TLS - an IntroductionPrometheus and TLS - an Introduction
Prometheus and TLS - an Introduction
 
Powerful graphs in Grafana
Powerful graphs in GrafanaPowerful graphs in Grafana
Powerful graphs in Grafana
 
YAML Magic
YAML MagicYAML Magic
YAML Magic
 
HAProxy as Egress Controller
HAProxy as Egress ControllerHAProxy as Egress Controller
HAProxy as Egress Controller
 
Improved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and AlertmanagerImproved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and Alertmanager
 
SIngle Sign On with Keycloak
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with Keycloak
 
Monitoring as an entry point for collaboration
Monitoring as an entry point for collaborationMonitoring as an entry point for collaboration
Monitoring as an entry point for collaboration
 
Incident Resolution as Code
Incident Resolution as CodeIncident Resolution as Code
Incident Resolution as Code
 
Monitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusMonitor your CentOS stack with Prometheus
Monitor your CentOS stack with Prometheus
 
Monitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusMonitor your CentOS stack with Prometheus
Monitor your CentOS stack with Prometheus
 
An introduction to Ansible
An introduction to AnsibleAn introduction to Ansible
An introduction to Ansible
 

Último

The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Último (20)

The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

Augeas, swiss knife resources for your puppet tree

  • 1. . AAuuggeeaass SSwwiissss--kknniiffee rreessoouurrcceess ffoorr yyoouurr ppuuppppeett ttrreeee Julien Pivotto Belgian Puppet User Group Holiday is over Meetup!!! - November 12th, 2014
  • 2. . wwhhooaammii JJuulliieenn PPiivvoottttoo • Open-Source consultant at inuits.eu • FOSS defender since 2004 • DevOps believer and evangelist • Puppet User since 2011 • @roidelapluie on twitter/github
  • 4. . . SSyyssaaddmmiinn 110011 CC BY-SA 2.0 https://www.flickr.com/photos/arthur-caranta/2926332140
  • 5. . SSeettttiinngg uupp aa sseerrvviiccee • Install the package • Change the configuration • Start the daemon
  • 6. . 3 steps. What can go wrong?
  • 7. . PPaacckkaaggiinngg • Where is the package? • Which version do we need? • Does it conflict with something else?
  • 8. . . DDeeppeennddeenncciieess HHeellll CC BY-SA 2.0 https://www.flickr.com/photos/coconinonationalforest/4587053982
  • 9. . CCoonnffiigguurraattiioonn • Where is the file? • How many files? • Configuration is in the database? • The file is *huge*
  • 10. . SSttaarrttiinngg tthhee sseerrvviiccee • Does not start ▶ Bad config file ▶ Stale lock file ▶ Data corruption • High Availability • Replication
  • 11. . LLeett''ss ttaallkk aabboouutt PPuuppppeett aanndd ffiilleess • Classical approach: File[] resource • Advanced approach: Concat[] define • Broken approach: Exec[sed] resource • Surgical approach: Augeas[] resource
  • 12. . HHiiddddeenn wwaayyss ttoommaannaaggee ffiilleess • Ssh_authorized_key[] • Nagios_* • To purge or not to purge
  • 13. . . TThhee FFiillee[[]] rreessoouurrccee CC BY 2.0 https://www.flickr.com/photos/80497449@N04/10567875696/
  • 14. . FFiillee • Built-in puppet resource • Most used • Works with a lot of usecases • Text files, binary files
  • 15. . . file{"${::icinga::confdir_server}/cgi.cfg": ensure => present, content => template('icinga/redhat/cgi.cfg.erb'), owner => $::icinga::server_user, group => $::icinga::server_group, require => Class['icinga::config'], notify => [ Service[$::icinga::service_client], Service[$::icinga::service_server], Exec['fix_collected_permissions'] ], } .
  • 16. . CCoonntteenntt ooff aa ffiillee • content => String, template(), file() • source => puppet:///, /local/file
  • 17. . FFiillee[[]] bbeehhaavviioouurr • Array as "source": Puppet will pick the first available one • Multiple arguments to template(): Puppet will concatenate them all • File[/foo/bar] will autorequire File[/foo]
  • 18. . DDoowwnnssiiddee ooff FFiillee[[]] • You can only have at one "content" • That resource describe the whole file • Works in almost every situation
  • 19. . . concat Public Domain http://commons.wikimedia.org/wiki/File:Adhesive_tapes_clear.JPG
  • 20. . CCoonnccaatt • A "reference" puppet module: puppetlabs/concat • https://github.com/puppetlabs/puppetlabs-concat • Provides definitions to manage file • Alternative modules: ▶ onyxpoint/pupmod-concat ▶ theforeman/puppet-concat (fork of onyxpoint)
  • 21. . CCoonnccaatt?? • Concat takes a bunch of snippets • Assemble them info a file • Each snippet is a define • The final file is a define
  • 22. . . concat { '/tmp/file': ensure => present, } concat::fragment { 'tmpfile': target => '/tmp/file', content => 'test contents', order => '01' } .
  • 23. . BBaassee aanndd ffrraaggmmeennttss • Concat[] defines owner, ensure, mode of the file • Concat::Fragment[] defines the contents of the file • One Concat[] has multiple Concat::Fragment[]
  • 24. . AAddvvaannttaaggeess ooff ccoonnccaatt • More flexibility ▶ if ▶ virtual resource ▶ exported resources ▶ create_resources • Mix templates and files
  • 25. . DDiissaaddvvaannttaaggeess ooff ccoonnccaatt • External Puppet module • Concat[] is the whole file • Performances
  • 26. . . Exec{sed: onlyif => grep} CC BY-SA 3.0 http://commons.wikimedia.org/wiki/File:Ca%C3%AFn_par_Henri_Vidal.jpg
  • 28. . eexxeecc[[sseedd]] iiss bbrr00kkeenn • Which options to pass to sed and grep? • You should use as few Exec[] as possible • grep .... • Escape, regexes…
  • 29. . AAnnootthheerr aalltteerrnnaattiivvee:: ccoonnff..dd • Some services support conf.d directories • But it is hard to change existing parameters • In which order are the files read? • Don't forget to purge
  • 30. . . Augeas CC BY-SA 3.0 http://commons.wikimedia.org/wiki/File:Students_assisting_surgery.JPG
  • 31. . AAuuggeeaass • Configuration editing tool • First release in 2007 • API coded in C • Command-line tools • bindings for different languages
  • 32. . CCoonnffiigguurraattiioonn eeddiittiinngg ttooooll • Parsing the configuration files • Turning them into a tree • Edit the tree & save the configuration
  • 33. . . $ cat /etc/nsswitch.conf # /etc/nsswitch.conf ## Example configuration # passwd: db files group: db files initgroups: db [SUCCESS=continue] files shadow: db files gshadow: files .
  • 34. . . augtool> ls /files/etc/nsswitch.conf/ #comment[1] = /etc/nsswitch.conf #comment[2] = Example configuration database[1]/ = passwd database[2]/ = group database[3]/ = initgroups database[4]/ = shadow database[5]/ = gshadow .
  • 35. . . augtool> ls /files/etc/nsswitch.conf/database[1]/ service[1] = db service[2] = files .
  • 36. . NNaattiivvee ffoorrmmaatt -->> ttrreeee • Augeas understand comments • Augeas does not care about empty lines • The cli tool (augtool) has autocomplete • It recognize a lot of formats
  • 37. . . augtool> set /files/etc/nsswitch.conf/database[1]/ service[last()+1] ldap augtool> save Saved 1 file(s) .
  • 38. . . $ cat /etc/nsswitch.conf # /etc/nsswitch.conf ## Example configuration # passwd: db files ldap group: db files initgroups: db [SUCCESS=continue] files shadow: db files gshadow: files .
  • 39. . . augtool> match /files/etc/nsswitch.conf/*/* ldap /files/etc/nsswitch.conf/database[1]/service[3] augtool> print /files/etc/nsswitch.conf/database[1] /files/etc/nsswitch.conf/database[1] = "passwd" /files/etc/nsswitch.conf/database[1]/service[1] = "db" /files/etc/nsswitch.conf/database[1]/service[2] = "files" /files/etc/nsswitch.conf/database[1]/service[3] = "ldap" .
  • 40. . . augtool> rm /files/etc/nsswitch.conf/database[1]/service[3] rm : /files/etc/nsswitch.conf/database[1]/service[3] 1 augtool> print /files/etc/nsswitch.conf/database[1] /files/etc/nsswitch.conf/database[1] = "passwd" /files/etc/nsswitch.conf/database[1]/service[1] = "db" /files/etc/nsswitch.conf/database[1]/service[2] = "files" augtool> save Saved 1 file(s) .
  • 41. . OOnnee AAPPII ttoo eeddiitt tthheemmaallll • Can talk XML, ini, named, nginx, … • Only change what is needed • Ensure the syntax is right
  • 42. . AAuuggeeaass LLeennsseess • Lenses are files that explain how to edit files • It contains paths and syntax • There are a lot of them available • You can write your own lenses
  • 43. . ”This brings the total number of lenses to 178. […] It’s depressing to think that Linux/Unix systems have managed to grow this many special snowflake formats.” David Lutterkort, main developer about Augeas 1.3.0
  • 44. . 117788 lleennsseess activemq_conf activemq_xml aliases aptconf apt_update_manager backuppchosts bbhosts bootconf build carbon cgrules channels cobblermodules cobblersettings collectd crypttab cyrus_imapd darkice debctrl desktop device_map dhcpd dnsmasq dovecot dpkg dput ethers exports fai_diskconfig fonts fuse gdm grub gshadow hostname inetd inputrc interfaces iproute2 iptables jaas jmxaccess keepalived known_hosts koji krb5 ldif limits login_defs logrotate mcollective memcached mke2fs mongodbserver mysql nagioscfg nagiosobjects netmasks nginx ntp ntpd odbc openshift_config openshift_http openvpn pam passwd pbuilder postfix_main postfix_transport postfix_virtual puppet_auth qpid rabbitmq resolv rmt securetty sep services shells shellvars_list sip_conf slapd smbusers squid sshd stunnel subversion sudoers sysconfig systemd thttpd up2date vfstab
  • 45. . AA sshhoorrtt lleennssee . module Hostname = autoload xfm (* View: lns *) let lns = [ label "hostname" . store Rx.word . Util.eol ] (* View: filter *) let filter = incl "/etc/hostname" . incl "/etc/mailname" let xfm = transform lns filter .
  • 46. . PPuuppppeett <<33 aauuggeeaass • Native "augeas" resource • Support for pluginsync • Helpers available
  • 47. . PPuuppppeett eexxaammppllee . augeas { $name: context => "/files${fstab::variables::fstab_file}", changes => [ "rm ${fstab_match_line}", ], onlyif => "match ${fstab_match_line} size > 0" } .
  • 48. . RReeaall uusseeccaasseess • Change grub options • Modify /etc/hosts • Modify XML's (puppetlabs-tomcat) • Configure Jenkins
  • 49. . PPlluuggiinnssyynncc • Puppet has pluginsync support for Augeas • Drop your lenses in your modules • lib/augeas/lenses • Use the "lens" parameter of the augeas resource
  • 50. . PPuuppppeett eexxaammppllee . augeas{"jboss_conf": . context => "/files/etc/jbossas", changes => [ "set jbossas.conf/JBOSS_IP $ipaddress", "set jbossas.conf/JAVA_HOME /usr", ], lens => "Jboss.aug", }
  • 51. . AAuuggeeaass ccoommmmaannddss set rm mv clear insert …
  • 52. . AAuuggeeaass ccoommppaarraattoorrss ((oonnllyyiiff)) match get
  • 53. . AAuuggeeaasspprroovviiddeerrss • Helpers around augeas • Puppet modules • No augeas knowledge needed
  • 54. . aappaacchhee . apache_setenv { "SPECIAL_PATH": ensure => present, value => "/foo/bin", } .
  • 55. . kkeerrnneell__ppaarraammeetteerr . kernel_parameter { "quiet": ensure => present, bootmode => "normal", } .
  • 57. . DDiissaaddvvaannttaaggeess • Learning required • Library to install • Writing lenses is hard
  • 58. . AAddvvaannttaaggeess • Augeas is a mature tool • Preserves comments in files • It fails (if needed) • Only changes what is needed • A lot of lenses available • Puppet integration • Helpers available
  • 59. . FFiinnaall nnoottee Most of the time, File[] resources are the way to go. Augeas can help when you need to change files generated by an application or that you can not manage entirely.
  • 60. . RReeaaddiinnggss • http://augeas.net/ • http://augeasproviders.com/ • https://docs.puppetlabs.com/
  • 61. . TThhaannkk yyoouu Any question? Thanks to @raphink
  • 62. . CCoonnttaacctt Julien Pivotto julien@inuits.eu @roidelapluie INUITS bvba Belgium +32 473 441 636 https://inuits.eu