Automating complex infrastructures with Puppet

Kris Buytaert
Kris BuytaertDevops, Linux and Open Source Expert at Inuits
Puppetizing Complex
    Applications
   with sipXecs as an example

      Kris Buytaert
Kris Buytaert
●   I used to be a Dev, Then Became an Op
●   Senior Linux and Open Source Consultant
    @inuits.be
●   „Infrastructure Architect“
●   Building Clouds since before the Cloud
●   Surviving the 10th floor test
●   Co-Author of some books
●   Guest Editor at some sites
Today


●   About SIPX
●   About Puppet
●   Deploying SipX
●   ...
Introduction 2 Puppet
Not quite a Muppet...

●   Puppet is...
●   OSS
●   A DSL language
●   Written in Ruby
●   Client/server oriented
●   Contains abstraction layers
●   Repeatable processes
Master of Puppets
●   Puppet master
    •   CA authority
    •   Modules
    •   Node descriptions
    •   Compare, compile, apply
●   Master is not a requirement !
Puppet Clients

●   Puppet client nodes
    •   Daemon
    •   Cron jobs
    •   External orchestration:
        •   for i in $hosts; do ssh $i “puppetd --test”; done
        •   mCollective, Func, …
Facts
●   Facts
      # facter

      memoryfree => 387.21 MB
      memorysize => 492.75 MB
      swapfree => 481.00 MB
      swapsize => 481.00 MB

      domain => dev.inuits.be
      fqdn => node3.dev.inuits.be
      hostname => node3
      interfaces => eth0
      ipaddress => 172.16.142.141
      macaddress => 00:0c:29:42:0b:8a
      netmask => 255.255.255.0
Modules
●   Dedicated per service
●   Reusable
●   Called from the manifests
●   Live in /etc/puppet/modules/
Module Structure
●   Files
●   Templates
    •   Dynamic content
    •   Variables
        <IfModule mpm_worker_module>
               StartServers        <%= StartServers %>
               MaxClients          <%= MaxClients   %>
               MinSpareThreads     <%= MinSpare     %>
               MaxSpareThreads          <%= MaxSpare     %>
               ThreadsPerChild     <%= ThreadsChild %>
               MaxRequestsPerChild   <%= RequestsChild   %>
        </IfModule>
●   Manifests
Modules
●   Files
●   Templates
●   Manifests
    •   DSL
    •   Classes
    •   Elements
Node definitions
●   Nodes.pp
    class defaults {
         $search = "inuits.be"
         $nameservers = ['208.67.220.220', '208.67.222.222']

         include dns::resolv
         include ssh::keys
         include ssh::server
    }

    node "ns1.dev.inuits.be" {
         include defaults
         include dns::powerdns::server
         include dns::powerdns::resolver
    }

    node “web1.dev.inuits.be” {
         include defaults
         include apache2
         include mysql
    }
Ralsh
●   Simplifies writing manifests
●   Will generate parts of the manifest for you
●   Based on your running config
●   Limited functionality
    master1.dev.inuits.be:~# ralsh user root
    user { 'root':
      uid => '0',
      gid => '0',
      comment => 'root',
      ensure => 'present',
      password => 'f34wi94$PmlI0CxQLb9HD',
      shell => '/bin/bash',
      home => '/root'
    }

    master1.dev.inuits.be:~# ralsh service apache2
    service { 'apache2':
      ensure => 'running',
      enable => 'true'
    }
Puppetizing your Infra
●   Define common parts
●   Define unique parts
●   Write your manifests
●   Use modules
    •   Puppet Forge
    •   GitHub
    •   Your own modules
SipXecs
What is sipXecs ?
●   sipX ECS (Enterprise Communications Server)
●   Open Source voice over IP telephony server
●   Implementation of the Session Initiation Protocol (SIP)
●   IP based communications system (IP PBX)
●   Not unlike Asterisk
●   Development started in 1999
●   GNU Lesser General Public License (LGPL)
●   Commercial offering from eZuce Inc.
●   Designed around FreeSWITCH
●   Modular and highly scalable system
We don't know VOIP
●   External VOIP consultancy
    •   Hardware selection
    •   Codecs etc
    •   Scale out
●   Irc.freenode.org #sipx




●   s/don/didn/t
●   Don't buy the book
Installing sipxecs
●   Prebuilt ISO
●   Kickstart
●   Install scripts placed in .bashrc
●   Ncurses based
●   Lots of python scripts
●   Heavy GUI usage
Why not Just ?
●   Backup and Restore ?
    •   CDR Integration etc
●   Image ?


●   Productization
    •   Think 20-100 setups
    •   For different customers
    •   Different networks, different domains
So, that Python Script ?
●   Configures your network
●   Configures your dhcpd
●   Configures your dns
●   Configures your ntpd
●   Configures your tftp
●   Generates SSL stuff for you




                There's puppet modules for that !
SipXconfig
●   Is enabled by writing
“enabled” to /var/sipxdata/process-state/ConfigServer
●   The configuration and management server (sipXconfig)
    provides Web administration and user portals, Web services
    APIs, as well as all the abstraction logic to make using
    sipXecs as simple as it is. It provides centralized
    management of all the aspects of sipXecs, including
    installation, configuration, backup & restore, upgrade,
    troubleshooting and cluster management.
●   “Pushes” configs to other nodes
●   Should be rewritten in Puppet or a like.
Configuring sipXecs
●   A couple of files


●   Some of them even obsoleted
●   Putting the SSL stuff in the right location
Everything is a funky SSL
problem
●   Sipx generates keys at install time
    •   Ca + keypairs per node
●   2nd node needs those keys
●   Copy to puppetmaster and transfer back to other nodes ?


●   Or generate on puppetmaster and redistribute ?


        => Generated on Puppetmaster
Adding a second node
●   <> clustering
●   <> high availability ( please don't start crying)


●   Create an entry in the management interface
●   Then repeat manual installation using ncurses


●   Or just do a wget to register it with the primary
class voip::sipx {
     sipx::netconfig {
                "sipx":
                ipaddress => $ip_address,
                netmask => $netmask;
           }
       if $nodename == 'sipx-a' {
           sipx::configserver{ "sipx": }
           sipx::staticcertdbca{ "$hostname": }
           sipx::staticcertdbnodes{ "SIPX-A.${platformdomainextension}":
                           clientname => "SIPX-A"; }
           sipx::staticcertdbnodes{ "SIPX-B.${platformdomainextension}":
                           clientname => "SIPX-B"; }
           include sipx::runmaster
      }
     else {
           include sipx::runslave
           sipx::register{ "$nodename":
                 clientname =>"${nodename}.${platformdomainextension}",
                 password =>"yourpw",}
      }
     sipx::supervisor { "$hostname":
                sipx_supervisor => "sipx-a.$platformdomainextension";
           }
     sipx::staticssl{ "$hostname": }
}
More complexity
                                       Or regular puppet ordering


●   Sipx requires PgSQL
●   You want PgSQL on an isolated LV
●   PgSQL configuration has to be done after it initialized a DB
●   SipX insist on starting PgSQL for you
class voip::storage {
  file {
       "/var/lib/pgsql":
                  ensure => directory;
 lvm::volume { "pgsql":
             vg => "systemvg",
             pv => "/dev/cciss/c0d0p2",
             fstype => "ext3",
                  size => "20G",
                  ensure => present,
 }
 mount { "/var/lib/pgsql":
       atboot => true,
       device => "/dev/systemvg/pgsql",
       ensure => mounted,
       fstype => "ext3",
       options => "defaults",
       require => [Logical_volume['pgsql'],File['/var/lib/pgsql']],
 }
}
class voip::pgsql {
        include postgres
        postgres::initdb { "sipx": }
        postgres::config{ "sipx":
                       listen => "*",
       postgres::hba { "sipx":
             allowedrules => [
                         "host SIPXCDR all   ${clientip}/32 trust",
                       ],
             }
}
include voip::storage

include voip::pgsql

include voip::sipx

   Class["voip::storage"] -> Class["voip::pgsql"] -> Class["voip::sipx"]
More complexity
                                  Or manipulating content of files


●   Bug in SIPX writes wrong listen adress for Freeswitch


●   XML Gibberish
●   Sipxconfig generates parts of the config files from unknown
    sources
Augeas
With Augtool

augtool > set /augeas/load/Xml/incl[3] /tmp/blah.xml
augtool > set /augeas/load/Xml/lens Xml.lns
augtool > load
augtool >print /files/tmp/blah.xml/profile/settings/param[17]/
/files/tmp/blah.xml/profile/settings/param[17] = "#empty"
/files/tmp/blah.xml/profile/settings/param[17]/#attribute
/files/tmp/blah.xml/profile/settings/param[17]/#attribute/name = "sip-ip"
/files/tmp/blah.xml/profile/settings/param[17]/#attribute/value = "10.255.202.90"
augtool> print /files/tmp/blah.xml/profile/settings/param[18]/
/files/tmp/blah.xml/profile/settings/param[18] = "#empty"
/files/tmp/blah.xml/profile/settings/param[18]/#attribute
/files/tmp/blah.xml/profile/settings/param[18]/#attribute/name = "ext-rtp-ip"
/files/tmp/blah.xml/profile/settings/param[18]/#attribute/value = "auto-nat"
augtool> print /files/tmp/blah.xml/profile/settings/param[16]/
/files/tmp/blah.xml/profile/settings/param[16] = "#empty"
/files/tmp/blah.xml/profile/settings/param[16]/#attribute
/files/tmp/blah.xml/profile/settings/param[16]/#attribute/name = "rtp-ip"
/files/tmp/blah.xml/profile/settings/param[16]/#attribute/value = "10.255.202.90"
Augeas
augtool> get
/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[17]/#attribut
e/value
/
files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[17]/#attribute
/value = 10.255.202.90
augtool> set
/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[16]/#attribut
e/value 10.0.0.2
Augeas & Puppet
augeas{"sipxprofile" :
    changes => [
    "set /augeas/load/Xml/incl[last()+1]/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml",
    "set /files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[16]/#attribute/value 10.0.0.2",
    "set /files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[17]/#attribute/value 10.0.0.2",
    ],
    }




augeas{"sipxprofile" :
    lens => "Xml.lns",
    incl => "/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml",
    context => "/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml",
    changes => [
      "set profile/settings/param[16]/#attribute/value $ipaddress",
      "set profile/settings/param[17]/#attribute/value $ipaddress",
    ],
    onlyif => "get profile/settings/param[16]/#attribute/value != $ipaddress",
}
Manual config of the
services via the gui is still
        required :(
I want to
●   Automatically create my admin pw
●   Automatically add that second node
●   Automatically disable/ enable functions in the sipX server
    •   e.g conferencing, openfire
●   Add users/phones


●   There's an API !
●   Which only implements limited functionality , and no
    configuration
Screen scraping ?
(03:28:30 PM) lazyboy: y, you just need a form processing library, one that can read a form
values and allow you to post back your changes

(03:30:04 PM) lazyboy: the problem w/this method as you know is that it is constantly
breaking

(03:30:41 PM) sdog: yep .. whan you change the gui .. it will break ....

(03:30:45 PM) lazyboy: maybe we need a serverside abstraction layer, that does the
screenscraping and exports out a clean REST API

(03:31:13 PM) lazyboy: overtime, APIs go straight thru

(03:36:18 PM) lazyboy: so it's possible some of what you want to do is available w/not a lot
of screen scraping.
Abusing Test Frameworks to
  configure services on a
          webgui
Cucumber
●   Looks extremely easy
    •   “Hey our manager could write these test”
●   Isn't
    •   Heavily under documented
    •   Best docs are in the RSpec book
    •   Online examples are mostly broken
●   Requires to write a lot of code
Apache Jmeter
●   Test tool
●   Load generation tool
●   Lets you record session by
    using a proxy
●   Only recent versions support
    SSL
Selenium
●   Firefox plugin
●   Replays your actions
    •   No need to write code
●   Can export to perl, php,
    ruby ..
    •   Which requires the a
        Selenium Remote Control
        Server
    •   Which launches Firefox
●   SSL Fun ahead
Alternatives
●   Sahi
    •   Similar to selenium
    •   Requires proxy
●   www::mechanize
●   Mechanize rubygem
●   Webtest
●   Your idea ?
I want an API
Conclusions
●   No good solution yet :(
●   Talk to your upstream supplier
    •   Vendor / project
●   Be patient
●   Show the good example
●   All bugs produced during this experience are on
        https://github.com/KrisBuytaert
Contact
Kris Buytaert
Kris.Buytaert@inuits.be

Further Reading
@krisbuytaert
http://www.krisbuytaert.be/blog/
http://www.inuits.be/



                       Inuits          Esquimaux
                       't Hemeltje     Kheops Business
                       Gemeentepark 2  Center
                       2930 Brasschaat Avenque Georges
                       891.514.231     Lemaître 54
                                       6041 Gosselies
                       +32 473 441 636 889.780.406
1 of 43

Recommended

Automating Complex Setups with Puppet by
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
1.2K views39 slides
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps by
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOpsОмские ИТ-субботники
875 views39 slides
Varnish - PLNOG 4 by
Varnish - PLNOG 4Varnish - PLNOG 4
Varnish - PLNOG 4Leszek Urbanski
3.6K views82 slides
Ansible, best practices by
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
13.1K views44 slides
Best practices for ansible by
Best practices for ansibleBest practices for ansible
Best practices for ansibleGeorge Shuklin
6.8K views95 slides
IT Automation with Ansible by
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
15.7K views27 slides

More Related Content

What's hot

Learn basic ansible using docker by
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
6.9K views19 slides
Varnish http accelerator by
Varnish http acceleratorVarnish http accelerator
Varnish http acceleratorno no
3K views47 slides
Automation with Ansible and Containers by
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and ContainersRodolfo Carvalho
453 views23 slides
Making Your Capistrano Recipe Book by
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
6.8K views18 slides
Kubernetes #4 volume &amp; stateful set by
Kubernetes #4   volume &amp; stateful setKubernetes #4   volume &amp; stateful set
Kubernetes #4 volume &amp; stateful setTerry Cho
2.3K views31 slides
Getting Started with Docker by
Getting Started with DockerGetting Started with Docker
Getting Started with DockerGeeta Vinnakota
791 views39 slides

What's hot(20)

Learn basic ansible using docker by Larry Cai
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
Larry Cai6.9K views
Varnish http accelerator by no no
Varnish http acceleratorVarnish http accelerator
Varnish http accelerator
no no3K views
Automation with Ansible and Containers by Rodolfo Carvalho
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
Rodolfo Carvalho453 views
Making Your Capistrano Recipe Book by Tim Riley
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
Tim Riley6.8K views
Kubernetes #4 volume &amp; stateful set by Terry Cho
Kubernetes #4   volume &amp; stateful setKubernetes #4   volume &amp; stateful set
Kubernetes #4 volume &amp; stateful set
Terry Cho2.3K views
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker by Sematext Group, Inc.
Running High Performance and Fault Tolerant Elasticsearch Clusters on DockerRunning High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Sematext Group, Inc. 38.1K views
MySQL NDB 8.0 clusters in your laptop with dbdeployer by Giuseppe Maxia
MySQL NDB 8.0 clusters in your laptop with dbdeployerMySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployer
Giuseppe Maxia498 views
Nginx Internals by Joshua Zhu
Nginx InternalsNginx Internals
Nginx Internals
Joshua Zhu59.7K views
Red hat lvm cheatsheet by Prakash Ghosh
Red hat   lvm cheatsheetRed hat   lvm cheatsheet
Red hat lvm cheatsheet
Prakash Ghosh3.7K views
Content Caching with NGINX and NGINX Plus by Kevin Jones
Content Caching with NGINX and NGINX PlusContent Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX Plus
Kevin Jones1.5K views
Ansible for beginners by Kuo-Le Mei
Ansible for beginnersAnsible for beginners
Ansible for beginners
Kuo-Le Mei4.9K views
nginx: writing your first module by redivy
nginx: writing your first modulenginx: writing your first module
nginx: writing your first module
redivy2.8K views
Hadoop meet Rex(How to construct hadoop cluster with rex) by Jun Hong Kim
Hadoop meet Rex(How to construct hadoop cluster with rex)Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)
Jun Hong Kim2.7K views
Apache Traffic Server & Lua by Kit Chan
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & Lua
Kit Chan770 views
Infrastructure Deployment with Docker & Ansible by Robert Reiz
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
Robert Reiz24.9K views

Similar to Automating complex infrastructures with Puppet

Beyond Puppet by
Beyond PuppetBeyond Puppet
Beyond PuppetKris Buytaert
3.4K views34 slides
Ansible is the simplest way to automate. MoldCamp, 2015 by
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
4.4K views46 slides
Postgres the hardway by
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
275 views41 slides
Capistrano deploy Magento project in an efficient way by
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
4.8K views30 slides
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview by
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
2K views53 slides
Dependencies Managers in C/C++. Using stdcpp 2014 by
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
4.4K views44 slides

Similar to Automating complex infrastructures with Puppet(20)

Ansible is the simplest way to automate. MoldCamp, 2015 by Alex S
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
Alex S4.4K views
Postgres the hardway by Dave Pitts
Postgres the hardwayPostgres the hardway
Postgres the hardway
Dave Pitts275 views
Capistrano deploy Magento project in an efficient way by Sylvain Rayé
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
Sylvain Rayé4.8K views
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview by Leo Lorieri
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
Leo Lorieri2K views
Dependencies Managers in C/C++. Using stdcpp 2014 by biicode
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode4.4K views
Puppet at Opera Sofware - PuppetCamp Oslo 2013 by Cosimo Streppone
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Cosimo Streppone1.7K views
nix-processmgmt: An experimental Nix-based process manager-agnostic framework by Sander van der Burg
nix-processmgmt: An experimental Nix-based process manager-agnostic frameworknix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
Sander van der Burg1.8K views
Practical Chef and Capistrano for Your Rails App by SmartLogic
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
SmartLogic10.7K views
Virtualization and automation of library software/machines + Puppet by Omar Reygaert
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
Omar Reygaert1.2K views
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App... by Nagios
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios809 views
High Availability Content Caching with NGINX by Kevin Jones
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
Kevin Jones2.5K views
Minimal OpenStack LinuxCon NA 2015 by Sean Dague
Minimal OpenStack LinuxCon NA 2015Minimal OpenStack LinuxCon NA 2015
Minimal OpenStack LinuxCon NA 2015
Sean Dague319 views
OSMC 2011 | Case Study - Icinga at Hyves.nl by Jeffrey Lensen by NETWAYS
OSMC 2011 | Case Study - Icinga at Hyves.nl by Jeffrey LensenOSMC 2011 | Case Study - Icinga at Hyves.nl by Jeffrey Lensen
OSMC 2011 | Case Study - Icinga at Hyves.nl by Jeffrey Lensen
NETWAYS37 views
#OktoCampus - Workshop : An introduction to Ansible by Cédric Delgehier
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
Cédric Delgehier435 views
Cutting through the fog of cloud by Kyle Rames
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
Kyle Rames1.5K views
Deploying Perl apps on dotCloud by daoswald
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
daoswald2.5K views
Developing with-devstack by Deepak Garg
Developing with-devstackDeveloping with-devstack
Developing with-devstack
Deepak Garg2.4K views

More from Kris Buytaert

Years of (not) learning , from devops to devoops by
Years of (not) learning , from devops to devoopsYears of (not) learning , from devops to devoops
Years of (not) learning , from devops to devoopsKris Buytaert
65 views44 slides
Observability will not fix your Broken Monitoring ,Ignite by
Observability will not fix your Broken Monitoring ,IgniteObservability will not fix your Broken Monitoring ,Ignite
Observability will not fix your Broken Monitoring ,IgniteKris Buytaert
167 views20 slides
Infrastructure as Code Patterns by
Infrastructure as Code PatternsInfrastructure as Code Patterns
Infrastructure as Code PatternsKris Buytaert
117 views53 slides
From devoops to devops 13 years of (not) learning by
From devoops to devops 13 years of (not) learningFrom devoops to devops 13 years of (not) learning
From devoops to devops 13 years of (not) learningKris Buytaert
185 views40 slides
Pipeline all the Dashboards as Code by
Pipeline all the Dashboards as CodePipeline all the Dashboards as Code
Pipeline all the Dashboards as CodeKris Buytaert
644 views20 slides
Help , My Datacenter is on fire by
Help , My Datacenter is on fireHelp , My Datacenter is on fire
Help , My Datacenter is on fireKris Buytaert
542 views38 slides

More from Kris Buytaert(20)

Years of (not) learning , from devops to devoops by Kris Buytaert
Years of (not) learning , from devops to devoopsYears of (not) learning , from devops to devoops
Years of (not) learning , from devops to devoops
Kris Buytaert65 views
Observability will not fix your Broken Monitoring ,Ignite by Kris Buytaert
Observability will not fix your Broken Monitoring ,IgniteObservability will not fix your Broken Monitoring ,Ignite
Observability will not fix your Broken Monitoring ,Ignite
Kris Buytaert167 views
Infrastructure as Code Patterns by Kris Buytaert
Infrastructure as Code PatternsInfrastructure as Code Patterns
Infrastructure as Code Patterns
Kris Buytaert117 views
From devoops to devops 13 years of (not) learning by Kris Buytaert
From devoops to devops 13 years of (not) learningFrom devoops to devops 13 years of (not) learning
From devoops to devops 13 years of (not) learning
Kris Buytaert185 views
Pipeline all the Dashboards as Code by Kris Buytaert
Pipeline all the Dashboards as CodePipeline all the Dashboards as Code
Pipeline all the Dashboards as Code
Kris Buytaert644 views
Help , My Datacenter is on fire by Kris Buytaert
Help , My Datacenter is on fireHelp , My Datacenter is on fire
Help , My Datacenter is on fire
Kris Buytaert542 views
Devops is Dead, Long live Devops by Kris Buytaert
Devops is Dead, Long live DevopsDevops is Dead, Long live Devops
Devops is Dead, Long live Devops
Kris Buytaert289 views
10 years of #devopsdays, but what have we really learned ? by Kris Buytaert
10 years of #devopsdays, but what have we really learned ? 10 years of #devopsdays, but what have we really learned ?
10 years of #devopsdays, but what have we really learned ?
Kris Buytaert594 views
Continuous Infrastructure First by Kris Buytaert
Continuous Infrastructure FirstContinuous Infrastructure First
Continuous Infrastructure First
Kris Buytaert568 views
Is there a Future for devops ? by Kris Buytaert
Is there a Future for devops   ? Is there a Future for devops   ?
Is there a Future for devops ?
Kris Buytaert478 views
10 Years of #devopsdays weirdness by Kris Buytaert
10 Years of #devopsdays weirdness10 Years of #devopsdays weirdness
10 Years of #devopsdays weirdness
Kris Buytaert400 views
ADDO 2019: Looking back at over 10 years of Devops by Kris Buytaert
ADDO 2019:    Looking back at over 10 years of DevopsADDO 2019:    Looking back at over 10 years of Devops
ADDO 2019: Looking back at over 10 years of Devops
Kris Buytaert578 views
Continuous Infrastructure First Ignite Edition by Kris Buytaert
Continuous Infrastructure First  Ignite EditionContinuous Infrastructure First  Ignite Edition
Continuous Infrastructure First Ignite Edition
Kris Buytaert476 views
Continuous Infrastructure First by Kris Buytaert
Continuous Infrastructure FirstContinuous Infrastructure First
Continuous Infrastructure First
Kris Buytaert521 views
Open Source Monitoring in 2019 by Kris Buytaert
Open Source Monitoring in 2019 Open Source Monitoring in 2019
Open Source Monitoring in 2019
Kris Buytaert1.5K views
Devops is a Security Requirement by Kris Buytaert
Devops is a Security RequirementDevops is a Security Requirement
Devops is a Security Requirement
Kris Buytaert699 views

Recently uploaded

Transcript: The Details of Description Techniques tips and tangents on altern... by
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...BookNet Canada
119 views15 slides
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV by
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTVSplunk
86 views20 slides
"Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad... by
"Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad..."Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad...
"Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad...Fwdays
40 views30 slides
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi by
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi
"AI Startup Growth from Idea to 1M ARR", Oleksandr UspenskyiFwdays
26 views9 slides
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure by
Astera Labs:  Intelligent Connectivity for Cloud and AI InfrastructureAstera Labs:  Intelligent Connectivity for Cloud and AI Infrastructure
Astera Labs: Intelligent Connectivity for Cloud and AI InfrastructureCXL Forum
125 views16 slides
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ... by
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ..."Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...Fwdays
33 views39 slides

Recently uploaded(20)

Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada119 views
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV by Splunk
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
Splunk86 views
"Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad... by Fwdays
"Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad..."Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad...
"Ukrainian Mobile Banking Scaling in Practice. From 0 to 100 and beyond", Vad...
Fwdays40 views
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi by Fwdays
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi
Fwdays26 views
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure by CXL Forum
Astera Labs:  Intelligent Connectivity for Cloud and AI InfrastructureAstera Labs:  Intelligent Connectivity for Cloud and AI Infrastructure
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure
CXL Forum125 views
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ... by Fwdays
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ..."Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
Fwdays33 views
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... by NUS-ISS
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
NUS-ISS32 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada110 views
"How we switched to Kanban and how it integrates with product planning", Vady... by Fwdays
"How we switched to Kanban and how it integrates with product planning", Vady..."How we switched to Kanban and how it integrates with product planning", Vady...
"How we switched to Kanban and how it integrates with product planning", Vady...
Fwdays61 views
The Importance of Cybersecurity for Digital Transformation by NUS-ISS
The Importance of Cybersecurity for Digital TransformationThe Importance of Cybersecurity for Digital Transformation
The Importance of Cybersecurity for Digital Transformation
NUS-ISS25 views
CXL at OCP by CXL Forum
CXL at OCPCXL at OCP
CXL at OCP
CXL Forum208 views
MemVerge: Memory Viewer Software by CXL Forum
MemVerge: Memory Viewer SoftwareMemVerge: Memory Viewer Software
MemVerge: Memory Viewer Software
CXL Forum118 views
JCon Live 2023 - Lice coding some integration problems by Bernd Ruecker
JCon Live 2023 - Lice coding some integration problemsJCon Live 2023 - Lice coding some integration problems
JCon Live 2023 - Lice coding some integration problems
Bernd Ruecker67 views
Future of Learning - Khoong Chan Meng by NUS-ISS
Future of Learning - Khoong Chan MengFuture of Learning - Khoong Chan Meng
Future of Learning - Khoong Chan Meng
NUS-ISS31 views
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur by Fwdays
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur
Fwdays40 views
[2023] Putting the R! in R&D.pdf by Eleanor McHugh
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh38 views
.conf Go 2023 - Data analysis as a routine by Splunk
.conf Go 2023 - Data analysis as a routine.conf Go 2023 - Data analysis as a routine
.conf Go 2023 - Data analysis as a routine
Splunk90 views
Microchip: CXL Use Cases and Enabling Ecosystem by CXL Forum
Microchip: CXL Use Cases and Enabling EcosystemMicrochip: CXL Use Cases and Enabling Ecosystem
Microchip: CXL Use Cases and Enabling Ecosystem
CXL Forum129 views
AI: mind, matter, meaning, metaphors, being, becoming, life values by Twain Liu 刘秋艳
AI: mind, matter, meaning, metaphors, being, becoming, life valuesAI: mind, matter, meaning, metaphors, being, becoming, life values
AI: mind, matter, meaning, metaphors, being, becoming, life values

Automating complex infrastructures with Puppet

  • 1. Puppetizing Complex Applications with sipXecs as an example Kris Buytaert
  • 2. Kris Buytaert ● I used to be a Dev, Then Became an Op ● Senior Linux and Open Source Consultant @inuits.be ● „Infrastructure Architect“ ● Building Clouds since before the Cloud ● Surviving the 10th floor test ● Co-Author of some books ● Guest Editor at some sites
  • 3. Today ● About SIPX ● About Puppet ● Deploying SipX ● ...
  • 5. Not quite a Muppet... ● Puppet is... ● OSS ● A DSL language ● Written in Ruby ● Client/server oriented ● Contains abstraction layers ● Repeatable processes
  • 6. Master of Puppets ● Puppet master • CA authority • Modules • Node descriptions • Compare, compile, apply ● Master is not a requirement !
  • 7. Puppet Clients ● Puppet client nodes • Daemon • Cron jobs • External orchestration: • for i in $hosts; do ssh $i “puppetd --test”; done • mCollective, Func, …
  • 8. Facts ● Facts # facter memoryfree => 387.21 MB memorysize => 492.75 MB swapfree => 481.00 MB swapsize => 481.00 MB domain => dev.inuits.be fqdn => node3.dev.inuits.be hostname => node3 interfaces => eth0 ipaddress => 172.16.142.141 macaddress => 00:0c:29:42:0b:8a netmask => 255.255.255.0
  • 9. Modules ● Dedicated per service ● Reusable ● Called from the manifests ● Live in /etc/puppet/modules/
  • 10. Module Structure ● Files ● Templates • Dynamic content • Variables <IfModule mpm_worker_module> StartServers <%= StartServers %> MaxClients <%= MaxClients %> MinSpareThreads <%= MinSpare %> MaxSpareThreads <%= MaxSpare %> ThreadsPerChild <%= ThreadsChild %> MaxRequestsPerChild <%= RequestsChild %> </IfModule> ● Manifests
  • 11. Modules ● Files ● Templates ● Manifests • DSL • Classes • Elements
  • 12. Node definitions ● Nodes.pp class defaults { $search = "inuits.be" $nameservers = ['208.67.220.220', '208.67.222.222'] include dns::resolv include ssh::keys include ssh::server } node "ns1.dev.inuits.be" { include defaults include dns::powerdns::server include dns::powerdns::resolver } node “web1.dev.inuits.be” { include defaults include apache2 include mysql }
  • 13. Ralsh ● Simplifies writing manifests ● Will generate parts of the manifest for you ● Based on your running config ● Limited functionality master1.dev.inuits.be:~# ralsh user root user { 'root': uid => '0', gid => '0', comment => 'root', ensure => 'present', password => 'f34wi94$PmlI0CxQLb9HD', shell => '/bin/bash', home => '/root' } master1.dev.inuits.be:~# ralsh service apache2 service { 'apache2': ensure => 'running', enable => 'true' }
  • 14. Puppetizing your Infra ● Define common parts ● Define unique parts ● Write your manifests ● Use modules • Puppet Forge • GitHub • Your own modules
  • 16. What is sipXecs ? ● sipX ECS (Enterprise Communications Server) ● Open Source voice over IP telephony server ● Implementation of the Session Initiation Protocol (SIP) ● IP based communications system (IP PBX) ● Not unlike Asterisk ● Development started in 1999 ● GNU Lesser General Public License (LGPL) ● Commercial offering from eZuce Inc. ● Designed around FreeSWITCH ● Modular and highly scalable system
  • 17. We don't know VOIP ● External VOIP consultancy • Hardware selection • Codecs etc • Scale out ● Irc.freenode.org #sipx ● s/don/didn/t ● Don't buy the book
  • 18. Installing sipxecs ● Prebuilt ISO ● Kickstart ● Install scripts placed in .bashrc ● Ncurses based ● Lots of python scripts ● Heavy GUI usage
  • 19. Why not Just ? ● Backup and Restore ? • CDR Integration etc ● Image ? ● Productization • Think 20-100 setups • For different customers • Different networks, different domains
  • 20. So, that Python Script ? ● Configures your network ● Configures your dhcpd ● Configures your dns ● Configures your ntpd ● Configures your tftp ● Generates SSL stuff for you There's puppet modules for that !
  • 21. SipXconfig ● Is enabled by writing “enabled” to /var/sipxdata/process-state/ConfigServer ● The configuration and management server (sipXconfig) provides Web administration and user portals, Web services APIs, as well as all the abstraction logic to make using sipXecs as simple as it is. It provides centralized management of all the aspects of sipXecs, including installation, configuration, backup & restore, upgrade, troubleshooting and cluster management. ● “Pushes” configs to other nodes ● Should be rewritten in Puppet or a like.
  • 22. Configuring sipXecs ● A couple of files ● Some of them even obsoleted ● Putting the SSL stuff in the right location
  • 23. Everything is a funky SSL problem ● Sipx generates keys at install time • Ca + keypairs per node ● 2nd node needs those keys ● Copy to puppetmaster and transfer back to other nodes ? ● Or generate on puppetmaster and redistribute ? => Generated on Puppetmaster
  • 24. Adding a second node ● <> clustering ● <> high availability ( please don't start crying) ● Create an entry in the management interface ● Then repeat manual installation using ncurses ● Or just do a wget to register it with the primary
  • 25. class voip::sipx { sipx::netconfig { "sipx": ipaddress => $ip_address, netmask => $netmask; } if $nodename == 'sipx-a' { sipx::configserver{ "sipx": } sipx::staticcertdbca{ "$hostname": } sipx::staticcertdbnodes{ "SIPX-A.${platformdomainextension}": clientname => "SIPX-A"; } sipx::staticcertdbnodes{ "SIPX-B.${platformdomainextension}": clientname => "SIPX-B"; } include sipx::runmaster } else { include sipx::runslave sipx::register{ "$nodename": clientname =>"${nodename}.${platformdomainextension}", password =>"yourpw",} } sipx::supervisor { "$hostname": sipx_supervisor => "sipx-a.$platformdomainextension"; } sipx::staticssl{ "$hostname": } }
  • 26. More complexity Or regular puppet ordering ● Sipx requires PgSQL ● You want PgSQL on an isolated LV ● PgSQL configuration has to be done after it initialized a DB ● SipX insist on starting PgSQL for you
  • 27. class voip::storage { file { "/var/lib/pgsql": ensure => directory; lvm::volume { "pgsql": vg => "systemvg", pv => "/dev/cciss/c0d0p2", fstype => "ext3", size => "20G", ensure => present, } mount { "/var/lib/pgsql": atboot => true, device => "/dev/systemvg/pgsql", ensure => mounted, fstype => "ext3", options => "defaults", require => [Logical_volume['pgsql'],File['/var/lib/pgsql']], } } class voip::pgsql { include postgres postgres::initdb { "sipx": } postgres::config{ "sipx": listen => "*", postgres::hba { "sipx": allowedrules => [ "host SIPXCDR all ${clientip}/32 trust", ], } }
  • 28. include voip::storage include voip::pgsql include voip::sipx Class["voip::storage"] -> Class["voip::pgsql"] -> Class["voip::sipx"]
  • 29. More complexity Or manipulating content of files ● Bug in SIPX writes wrong listen adress for Freeswitch ● XML Gibberish ● Sipxconfig generates parts of the config files from unknown sources
  • 30. Augeas With Augtool augtool > set /augeas/load/Xml/incl[3] /tmp/blah.xml augtool > set /augeas/load/Xml/lens Xml.lns augtool > load augtool >print /files/tmp/blah.xml/profile/settings/param[17]/ /files/tmp/blah.xml/profile/settings/param[17] = "#empty" /files/tmp/blah.xml/profile/settings/param[17]/#attribute /files/tmp/blah.xml/profile/settings/param[17]/#attribute/name = "sip-ip" /files/tmp/blah.xml/profile/settings/param[17]/#attribute/value = "10.255.202.90" augtool> print /files/tmp/blah.xml/profile/settings/param[18]/ /files/tmp/blah.xml/profile/settings/param[18] = "#empty" /files/tmp/blah.xml/profile/settings/param[18]/#attribute /files/tmp/blah.xml/profile/settings/param[18]/#attribute/name = "ext-rtp-ip" /files/tmp/blah.xml/profile/settings/param[18]/#attribute/value = "auto-nat" augtool> print /files/tmp/blah.xml/profile/settings/param[16]/ /files/tmp/blah.xml/profile/settings/param[16] = "#empty" /files/tmp/blah.xml/profile/settings/param[16]/#attribute /files/tmp/blah.xml/profile/settings/param[16]/#attribute/name = "rtp-ip" /files/tmp/blah.xml/profile/settings/param[16]/#attribute/value = "10.255.202.90"
  • 32. Augeas & Puppet augeas{"sipxprofile" : changes => [ "set /augeas/load/Xml/incl[last()+1]/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml", "set /files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[16]/#attribute/value 10.0.0.2", "set /files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[17]/#attribute/value 10.0.0.2", ], } augeas{"sipxprofile" : lens => "Xml.lns", incl => "/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml", context => "/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml", changes => [ "set profile/settings/param[16]/#attribute/value $ipaddress", "set profile/settings/param[17]/#attribute/value $ipaddress", ], onlyif => "get profile/settings/param[16]/#attribute/value != $ipaddress", }
  • 33. Manual config of the services via the gui is still required :(
  • 34. I want to ● Automatically create my admin pw ● Automatically add that second node ● Automatically disable/ enable functions in the sipX server • e.g conferencing, openfire ● Add users/phones ● There's an API ! ● Which only implements limited functionality , and no configuration
  • 35. Screen scraping ? (03:28:30 PM) lazyboy: y, you just need a form processing library, one that can read a form values and allow you to post back your changes (03:30:04 PM) lazyboy: the problem w/this method as you know is that it is constantly breaking (03:30:41 PM) sdog: yep .. whan you change the gui .. it will break .... (03:30:45 PM) lazyboy: maybe we need a serverside abstraction layer, that does the screenscraping and exports out a clean REST API (03:31:13 PM) lazyboy: overtime, APIs go straight thru (03:36:18 PM) lazyboy: so it's possible some of what you want to do is available w/not a lot of screen scraping.
  • 36. Abusing Test Frameworks to configure services on a webgui
  • 37. Cucumber ● Looks extremely easy • “Hey our manager could write these test” ● Isn't • Heavily under documented • Best docs are in the RSpec book • Online examples are mostly broken ● Requires to write a lot of code
  • 38. Apache Jmeter ● Test tool ● Load generation tool ● Lets you record session by using a proxy ● Only recent versions support SSL
  • 39. Selenium ● Firefox plugin ● Replays your actions • No need to write code ● Can export to perl, php, ruby .. • Which requires the a Selenium Remote Control Server • Which launches Firefox ● SSL Fun ahead
  • 40. Alternatives ● Sahi • Similar to selenium • Requires proxy ● www::mechanize ● Mechanize rubygem ● Webtest ● Your idea ?
  • 41. I want an API
  • 42. Conclusions ● No good solution yet :( ● Talk to your upstream supplier • Vendor / project ● Be patient ● Show the good example ● All bugs produced during this experience are on https://github.com/KrisBuytaert
  • 43. Contact Kris Buytaert Kris.Buytaert@inuits.be Further Reading @krisbuytaert http://www.krisbuytaert.be/blog/ http://www.inuits.be/ Inuits Esquimaux 't Hemeltje Kheops Business Gemeentepark 2 Center 2930 Brasschaat Avenque Georges 891.514.231 Lemaître 54 6041 Gosselies +32 473 441 636 889.780.406