SlideShare a Scribd company logo
Automatic Configuration 
Management for Kamailio 
and Asterisk 
or “How I Stopped Worrying About Deployments” 
Giacomo Vacca 
Senior Network Applications Developer
labs.truphone.com 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
2
@giavac – Giacomo Vacca 
• Doing VoIP 10+ years 
• Leads Network Apps Dev 
• All sorts of OS apps in RTC 
• WebRTC, Devops enthusiast 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 3
Embracing Config Management 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 4
Penetration of cfg mgmt in trulabs 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 5
github/trulabs and Puppet usage 
• 44 custom modules 
• 2 public modules 
• ~10 3rd party modules 
• ~2000 commits 
• ~4000 lines of code 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 6
• Quicker to build and configure a new VM 
• Quicker to setup applications 
• Easier triage/debugging 
• Simpler Change Requests 
• Higher team satisfaction  
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
7 
Visible improvements
• Open Source configuration management 
• Defines the final status (‘what’, not ‘how’) 
• Idempotent 
puppetlabs.com (I’m not affiliated) 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
8 
So, what’s Puppet?
• Puppet code is contained in MANIFESTS 
• Puppet functionalities are organized in 
MODULES 
• “Compiled” manifests are CATALOGUES 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
9 
Puppet - terminology
• As many environments as you want 
–Each environment defines a Site 
•A Site defines a group of Nodes 
– Every host is a Node 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
10 
Puppet - architecture
Master/Slave vs Standalone 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 11
https://forge.puppetlabs.com/trulabs/kamailio 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
12 
A Puppet module for Kamailio
• Tested on debian wheezy; works on Ubuntu 
• Several levels of control 
–Manage Kamailio as a service 
–Choose package version 
–TLS/WebSockets enabled/disabled 
• Used on Production 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
13 
trulabs-kamailio
From empty VM to running app 
apt-get update && apt-get install -y puppet 
puppet module install trulabs-kamailio 
puppet apply –v  
/etc/puppet/modules/kamailio/tests/init.pp  
--show_diff --noop 
# You can check with: 
dpkg -l | grep kamailio 
netstat –nap | grep 506. 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 14
trulabs-kamailio - structure 
• manifests 
– config.pp 
– init.pp 
– install.pp 
– params.pp 
– repo.pp and repo/ 
– service.pp 
• templates 
– etc_default_kamailio.erb 
– kamailio-local.cfg.erb 
– kamailio.cfg.erb 
– tls.cfg.erb 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 15
e.g.: Kamailio for WebSockets 
class kamailio_ws::install () inherits kamailio_ws { 
class { '::kamailio': 
service_manage => true, 
service_enable => true, 
service_ensure => 'running', 
manage_repo => true, 
with_tls => true, 
with_websockets => true, 
with_ephem_auth => true, 
manage_config => false, 
} 
} 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 16
• Firewall 
– Open up UDP+TCP, 5060, 5061 
– Open TCP 5666 for Nagios client 
• TCP keepalive 
• SSL certs: 
– Ensure existing and with correct permissions 
• Swap memory: 
– Ensure created and with correct size 
• monit, fail2ban, basic tools: Install and configure 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
17 
kamailio_ws – node setup
https://forge.puppetlabs.com/trulabs/asterisk 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
18 
A Puppet module for Asterisk
• Pre-requisites 
–DAHDI (installed as kernel module) 
– apt repos 
• Packages 
– Core 
– Sounds 
– Business logic (from own repo) 
• Configuration files 
– Including optional TLS + certs, ODBC settings 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
19 
Asterisk – module components
node 'default' { 
class { '::asterisk': 
service_manage => true, 
service_enable => true, 
service_ensure => 'running', 
tcpenable => 'yes', 
} 
} 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
20 
Asterisk – minimal configuration
- asterisk, asterisk-modules, asterisk-config 
- asterisk-voicemail 
- asterisk-code-sound-en 
- asterisk-code-sound-en-gsm 
- asterisk-moh-opsound-gsm 
Debian Wheezy: 1.8.13.1~dfsg1-3+deb7u3 
Ubuntu Trusty: 1:11.7.0~dfsg-1ubuntu1 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
21 
Asterisk – packages installed
- UDP 5060 
- TCP 5060 
- Because we used ‘tcp_enable => true’ 
- Change listening port by adding a port in: 
- udpbindaddr (e.g. 0.0.0.0:5070) 
- tcpbindaddr (e.g. 0.0.0.0:5070) 
- RTP ports range (rtpstart – rtpend) 
- Enable TLS with tlsenable => ‘yes’ 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
22 
Asterisk – ports
“But I want my config files” 
manage_config => false 
file { '/etc/asterisk/extensions.conf': 
source => 'puppet:///modules/my_ast/extensions.conf', 
notify => Exec['asterisk-dialplan-reload'], 
} 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 23
“But I want my custom package” 
package_ensure => “my_version”, 
(needs proper apt sources set up) 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 24
Asterisk – setup on a new VM 
apt-get update && apt-get install -y puppet 
## This will also pull puppetlabs-stdlib 
puppet module install trulabs-asterisk 
puppet apply -v /etc/puppet/modules/asterisk/tests/init.pp  
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 25 
--show_diff --noop 
dpkg –l | grep asterisk 
netstat –nap | grep 506. 
asterisk –x ‘core show version’
Protecting asterisk 
firewall { '101 allow to UDP 5060 from kam': 
dport => ‘5060', 
proto => 'udp', 
action => 'accept', 
destination => $::ipaddress_eth0, 
source => $kamailio_ip, 
} -> 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 26
• Why Puppet (and not Chef, Ansible, etc)? 
• How do you test your Puppet modules? 
• Will this work on Ubuntu? 
• Can I automate Puppet runs with Jenkins? 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
27 
FAQ
Puppet & Docker – the future? 
• From VMs to Containers 
• Build Docker images with Puppet 
–Speed up image creation! 
• Deploy Docker containers with Puppet 
–Manage your containers with Puppet 
• Problem with Asterisk: mapping port ranges between host and 
container… hopefully fixed soon! 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 28
• Highly recommended: use Configuration 
Management 
•(The actual tool doesn’t matter much) 
• Develop a common language between dev 
and ops/sysadmin 
• Infrastructure As Code for your Asterisk 
deployments 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
29 
Takeaways
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
Q&A 
Giacomo Vacca 
@giavac 
labs@truphone.com 
https://labs.truphone.com/about/ 
30
Additional slides 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 
31
Popularity of Config Mgmt tools 
Source: http://www.slideshare.net/ZeroTurnaround/traditional-it-ops-vs-dev-ops-devops-days-ignite-talk-by-oliver-white 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 32
Puppet vs Chef – debian* 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 33 
Source: http://popcon.debian.org/
Puppet vs Chef – github 
© 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 34 
Source: github.com at 2014/10/03

More Related Content

PPTX
BonFIRE: features, sites and tools
ODP
sshuttle VPN (2011-04)
PDF
CoreOS: Control Your Fleet
PDF
Automatic Kamailio Deployments With Puppet
PPT
Nuxeo5 - Continuous Integration
PPTX
Quick Start Guide using Virtuozzo 7 (β) on AWS EC2
PDF
青云CoreOS虚拟机部署kubernetes
PDF
5. hands on - building local development environment with Open Mano
BonFIRE: features, sites and tools
sshuttle VPN (2011-04)
CoreOS: Control Your Fleet
Automatic Kamailio Deployments With Puppet
Nuxeo5 - Continuous Integration
Quick Start Guide using Virtuozzo 7 (β) on AWS EC2
青云CoreOS虚拟机部署kubernetes
5. hands on - building local development environment with Open Mano

What's hot (19)

DOCX
Installing lemp with ssl and varnish on Debian 9
PDF
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...
PDF
Install and Configure Ubuntu for Hadoop Installation for beginners
PDF
6. hands on - open mano demonstration in remote pool of servers
PDF
OpenCSW - What is the project about?
PDF
Fabric-让部署变得简单
PDF
Your Inner Sysadmin - LonestarPHP 2015
PDF
4. open mano set up and usage
PPTX
PDF
Bpug mcollective 20140624
PDF
CoreOS intro
PDF
Web scale infrastructures with kubernetes and flannel
PPT
Running hadoop on ubuntu linux
PDF
Fail2ban
PDF
Docker orchestration using core os and ansible - Ansible IL 2015
PDF
Build Your Own CaaS (Container as a Service)
PDF
CoreOS @Codetalks Hamburg
PDF
Docker Container: isolation and security
PDF
Understand the iptables step by step
Installing lemp with ssl and varnish on Debian 9
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...
Install and Configure Ubuntu for Hadoop Installation for beginners
6. hands on - open mano demonstration in remote pool of servers
OpenCSW - What is the project about?
Fabric-让部署变得简单
Your Inner Sysadmin - LonestarPHP 2015
4. open mano set up and usage
Bpug mcollective 20140624
CoreOS intro
Web scale infrastructures with kubernetes and flannel
Running hadoop on ubuntu linux
Fail2ban
Docker orchestration using core os and ansible - Ansible IL 2015
Build Your Own CaaS (Container as a Service)
CoreOS @Codetalks Hamburg
Docker Container: isolation and security
Understand the iptables step by step
Ad

Viewers also liked (20)

PDF
Jc valero ponencias 1-2-4 informe sectorial accesibilidad pom en clm
PDF
Shared learning in the digital age #kmb in 140 characters or less
PPTX
How to Build Your Brand with UC
KEY
French action topic 8
DOC
Applications lab
PDF
360º leadership
DOC
Combined evaluation
PDF
Agency1 full keynote_22_07_13
PDF
NapoleonCat.com - InternetBeta2013
PDF
Social Footprint. Czerwiec 2014
PPTX
Java koodimise stiilijuhised
PDF
Raport aktywności na facebooku Czerwiec 2011
PDF
Kisi kisi uas
PDF
6 Ways a New Phone System can make your Life Easier
PDF
Rhive 0.0 3
PPT
Lecture 12
DOCX
Newspaper Ideas
PPTX
PDF
What's new in Rational Team Concert 3.0
Jc valero ponencias 1-2-4 informe sectorial accesibilidad pom en clm
Shared learning in the digital age #kmb in 140 characters or less
How to Build Your Brand with UC
French action topic 8
Applications lab
360º leadership
Combined evaluation
Agency1 full keynote_22_07_13
NapoleonCat.com - InternetBeta2013
Social Footprint. Czerwiec 2014
Java koodimise stiilijuhised
Raport aktywności na facebooku Czerwiec 2011
Kisi kisi uas
6 Ways a New Phone System can make your Life Easier
Rhive 0.0 3
Lecture 12
Newspaper Ideas
What's new in Rational Team Concert 3.0
Ad

Similar to Automatic Configuration Management for Kamailio and Asterisk in the era of Puppet (20)

PDF
March 2014 CMUG Minutes
PDF
Pivotal: Operationalizing 1000 Node Hadoop Cluster - Analytics Workbench
 
PDF
FreeSWITCH on Docker
PDF
FreeSWITCH on Docker
PPTX
Managing Oracle Solaris Systems with Puppet
PDF
Python on Cloud Foundry
PPTX
Foreman-and-Puppet-for-Openstack-Audo-Deployment
ODP
Foreman in your datacenter
PDF
Manage your switches like servers
PDF
OpenNebula, the foreman and CentOS play nice, too
PDF
Puppet Primer, Robbie Jerrom, Solution Architect VMware
PDF
V mware
PPTX
Structor - Automated Building of Virtual Hadoop Clusters
PDF
[KubeCon NA 2020] containerd: Rootless Containers 2020
PDF
One-Man Ops
PPT
Scalable Systems Management with Puppet
PPT
Scalable systems management with puppet
PDF
Puppet Camp Presentation 15
PDF
Developer Cloud Solution with OpenStack
PDF
NFD9 - Matt Peterson, Data Center Operations
March 2014 CMUG Minutes
Pivotal: Operationalizing 1000 Node Hadoop Cluster - Analytics Workbench
 
FreeSWITCH on Docker
FreeSWITCH on Docker
Managing Oracle Solaris Systems with Puppet
Python on Cloud Foundry
Foreman-and-Puppet-for-Openstack-Audo-Deployment
Foreman in your datacenter
Manage your switches like servers
OpenNebula, the foreman and CentOS play nice, too
Puppet Primer, Robbie Jerrom, Solution Architect VMware
V mware
Structor - Automated Building of Virtual Hadoop Clusters
[KubeCon NA 2020] containerd: Rootless Containers 2020
One-Man Ops
Scalable Systems Management with Puppet
Scalable systems management with puppet
Puppet Camp Presentation 15
Developer Cloud Solution with OpenStack
NFD9 - Matt Peterson, Data Center Operations

More from Digium (20)

PPTX
AstriCon 2017 Recap
PDF
MegaFreight - South Africa’s largest independent freight forwarder
PDF
Becker School District
PPTX
Danny Windham, Digium CEO, Keynote address - ITEXPO East 2015, Miamii
PPTX
AstriCon 2014 keynote: Russell Bryant
PDF
Distribution, redundancy and high availability using OpenSIPS
PDF
Getting the best out of WebRTC
PPTX
Making your Asterisk System Secure
PDF
Scaling FastAGI Applications with Go
PDF
WebRTC: The Big Debate, Shut Up and Build Something
PPT
Connecting Non-SIP IP Camera to Your PBX
PDF
The Past and Future of VoIP
PDF
Developing an ivr payment system with asterisk (astricon 2014 las vegas nevada)
PDF
More than a phone system. A better way to communicate.
PDF
Real Success Stories from IT Heroes
PDF
Smart Deductions for Small Business
PDF
Security Strategies for UC
PDF
Switchvox - The Best Value in Unified Communications
PDF
Five Essential Benefits Driving UC Adoption by SMBs
PPTX
Top 10 Reasons SMBs Choose Switchvox
AstriCon 2017 Recap
MegaFreight - South Africa’s largest independent freight forwarder
Becker School District
Danny Windham, Digium CEO, Keynote address - ITEXPO East 2015, Miamii
AstriCon 2014 keynote: Russell Bryant
Distribution, redundancy and high availability using OpenSIPS
Getting the best out of WebRTC
Making your Asterisk System Secure
Scaling FastAGI Applications with Go
WebRTC: The Big Debate, Shut Up and Build Something
Connecting Non-SIP IP Camera to Your PBX
The Past and Future of VoIP
Developing an ivr payment system with asterisk (astricon 2014 las vegas nevada)
More than a phone system. A better way to communicate.
Real Success Stories from IT Heroes
Smart Deductions for Small Business
Security Strategies for UC
Switchvox - The Best Value in Unified Communications
Five Essential Benefits Driving UC Adoption by SMBs
Top 10 Reasons SMBs Choose Switchvox

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation theory and applications.pdf
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Programs and apps: productivity, graphics, security and other tools
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Spectroscopy.pptx food analysis technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation theory and applications.pdf
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Programs and apps: productivity, graphics, security and other tools
The AUB Centre for AI in Media Proposal.docx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MIND Revenue Release Quarter 2 2025 Press Release
Network Security Unit 5.pdf for BCA BBA.
sap open course for s4hana steps from ECC to s4
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Advanced methodologies resolving dimensionality complications for autism neur...
Spectroscopy.pptx food analysis technology

Automatic Configuration Management for Kamailio and Asterisk in the era of Puppet

  • 1. Automatic Configuration Management for Kamailio and Asterisk or “How I Stopped Worrying About Deployments” Giacomo Vacca Senior Network Applications Developer
  • 2. labs.truphone.com © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 2
  • 3. @giavac – Giacomo Vacca • Doing VoIP 10+ years • Leads Network Apps Dev • All sorts of OS apps in RTC • WebRTC, Devops enthusiast © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 3
  • 4. Embracing Config Management © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 4
  • 5. Penetration of cfg mgmt in trulabs © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 5
  • 6. github/trulabs and Puppet usage • 44 custom modules • 2 public modules • ~10 3rd party modules • ~2000 commits • ~4000 lines of code © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 6
  • 7. • Quicker to build and configure a new VM • Quicker to setup applications • Easier triage/debugging • Simpler Change Requests • Higher team satisfaction  © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 7 Visible improvements
  • 8. • Open Source configuration management • Defines the final status (‘what’, not ‘how’) • Idempotent puppetlabs.com (I’m not affiliated) © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 8 So, what’s Puppet?
  • 9. • Puppet code is contained in MANIFESTS • Puppet functionalities are organized in MODULES • “Compiled” manifests are CATALOGUES © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 9 Puppet - terminology
  • 10. • As many environments as you want –Each environment defines a Site •A Site defines a group of Nodes – Every host is a Node © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 10 Puppet - architecture
  • 11. Master/Slave vs Standalone © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 11
  • 12. https://forge.puppetlabs.com/trulabs/kamailio © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 12 A Puppet module for Kamailio
  • 13. • Tested on debian wheezy; works on Ubuntu • Several levels of control –Manage Kamailio as a service –Choose package version –TLS/WebSockets enabled/disabled • Used on Production © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 13 trulabs-kamailio
  • 14. From empty VM to running app apt-get update && apt-get install -y puppet puppet module install trulabs-kamailio puppet apply –v /etc/puppet/modules/kamailio/tests/init.pp --show_diff --noop # You can check with: dpkg -l | grep kamailio netstat –nap | grep 506. © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 14
  • 15. trulabs-kamailio - structure • manifests – config.pp – init.pp – install.pp – params.pp – repo.pp and repo/ – service.pp • templates – etc_default_kamailio.erb – kamailio-local.cfg.erb – kamailio.cfg.erb – tls.cfg.erb © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 15
  • 16. e.g.: Kamailio for WebSockets class kamailio_ws::install () inherits kamailio_ws { class { '::kamailio': service_manage => true, service_enable => true, service_ensure => 'running', manage_repo => true, with_tls => true, with_websockets => true, with_ephem_auth => true, manage_config => false, } } © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 16
  • 17. • Firewall – Open up UDP+TCP, 5060, 5061 – Open TCP 5666 for Nagios client • TCP keepalive • SSL certs: – Ensure existing and with correct permissions • Swap memory: – Ensure created and with correct size • monit, fail2ban, basic tools: Install and configure © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 17 kamailio_ws – node setup
  • 18. https://forge.puppetlabs.com/trulabs/asterisk © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 18 A Puppet module for Asterisk
  • 19. • Pre-requisites –DAHDI (installed as kernel module) – apt repos • Packages – Core – Sounds – Business logic (from own repo) • Configuration files – Including optional TLS + certs, ODBC settings © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 19 Asterisk – module components
  • 20. node 'default' { class { '::asterisk': service_manage => true, service_enable => true, service_ensure => 'running', tcpenable => 'yes', } } © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 20 Asterisk – minimal configuration
  • 21. - asterisk, asterisk-modules, asterisk-config - asterisk-voicemail - asterisk-code-sound-en - asterisk-code-sound-en-gsm - asterisk-moh-opsound-gsm Debian Wheezy: 1.8.13.1~dfsg1-3+deb7u3 Ubuntu Trusty: 1:11.7.0~dfsg-1ubuntu1 © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 21 Asterisk – packages installed
  • 22. - UDP 5060 - TCP 5060 - Because we used ‘tcp_enable => true’ - Change listening port by adding a port in: - udpbindaddr (e.g. 0.0.0.0:5070) - tcpbindaddr (e.g. 0.0.0.0:5070) - RTP ports range (rtpstart – rtpend) - Enable TLS with tlsenable => ‘yes’ © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 22 Asterisk – ports
  • 23. “But I want my config files” manage_config => false file { '/etc/asterisk/extensions.conf': source => 'puppet:///modules/my_ast/extensions.conf', notify => Exec['asterisk-dialplan-reload'], } © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 23
  • 24. “But I want my custom package” package_ensure => “my_version”, (needs proper apt sources set up) © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 24
  • 25. Asterisk – setup on a new VM apt-get update && apt-get install -y puppet ## This will also pull puppetlabs-stdlib puppet module install trulabs-asterisk puppet apply -v /etc/puppet/modules/asterisk/tests/init.pp © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 25 --show_diff --noop dpkg –l | grep asterisk netstat –nap | grep 506. asterisk –x ‘core show version’
  • 26. Protecting asterisk firewall { '101 allow to UDP 5060 from kam': dport => ‘5060', proto => 'udp', action => 'accept', destination => $::ipaddress_eth0, source => $kamailio_ip, } -> © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 26
  • 27. • Why Puppet (and not Chef, Ansible, etc)? • How do you test your Puppet modules? • Will this work on Ubuntu? • Can I automate Puppet runs with Jenkins? © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 27 FAQ
  • 28. Puppet & Docker – the future? • From VMs to Containers • Build Docker images with Puppet –Speed up image creation! • Deploy Docker containers with Puppet –Manage your containers with Puppet • Problem with Asterisk: mapping port ranges between host and container… hopefully fixed soon! © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 28
  • 29. • Highly recommended: use Configuration Management •(The actual tool doesn’t matter much) • Develop a common language between dev and ops/sysadmin • Infrastructure As Code for your Asterisk deployments © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 29 Takeaways
  • 30. © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. Q&A Giacomo Vacca @giavac labs@truphone.com https://labs.truphone.com/about/ 30
  • 31. Additional slides © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 31
  • 32. Popularity of Config Mgmt tools Source: http://www.slideshare.net/ZeroTurnaround/traditional-it-ops-vs-dev-ops-devops-days-ignite-talk-by-oliver-white © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 32
  • 33. Puppet vs Chef – debian* © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 33 Source: http://popcon.debian.org/
  • 34. Puppet vs Chef – github © 2014 Truphone 10 November 2014 Limited. All Rights Reserved. 34 Source: github.com at 2014/10/03

Editor's Notes

  • #2: This presentation is about a practical example of automating the configuration of Linux-based RTC platforms, with particular emphasis on Kamailio and Asterisk. QUESTIONS TO AUDIENCE: Who’s being deploying Asterisk in any sort of automated fashion? Using Puppet? Using something else, like Chef, Ansible, Salt? Even if you’re already doing it, say for example with Chef, I hope this presentation will be useful to challenge or corroborate your process.
  • #3: Truphone is a Global Mobile Network Operator: you can use Truphone in more than 200 countries, and in 66 countries like you do in your home country. Truphone Labs takes care mainly of the Truphone App. MISSION: “a phone in your mobile device”. iOS, Android, BB apps. Platform: Open Source applications and libraries. (and of course Asterisk plays – and has played since day 1– an important part in this)
  • #4: I’ve been working with VoIP-related technologies for the last decade. DEV background.
  • #5: THIS PRESENTATION IS ALSO ABOUT A PERSONAL PATH TOWARDS DEVOPS. I think the typical path to embrace configuration management is coming from a sysadmin role and willing to simplify your life. I come from a different direction: deploying applications and doing system integration, and willing to automate anything that’s possible: “Infrastructure as code”. Also wanted to: Have more time for dev, less for ops-related stuff Share a common language with Ops Get configuration documentation FOR FREE! Play with something new!
  • #6: In 2012 I started challenging that only infrastructure and not apps configuration were automatically managed. Was Master/Slave. I started to move applications configuration into Puppet, incrementally. I reckon THE HARDEST PART IS GOING FROM 0% TO ABOUT 50%, then it’s all downhill. Now we have almost 100% of the apps deployed with Puppet, including pre-requisites, firewall, monitoring, etc.
  • #7: Wheezy: puppet 2.7 Trusty: puppet 3.4
  • #8: VISIBLE IMPROVEMENTS I’m afraid I don’t have terribly accurate numbers, but the order of magnitude – the important thing here – is about right. Build and configure a new VM From weeks to < 5’ Incl. pre-req libs, f/w, swap, Nagios, TCP ka, etc Configure an application of a new VM From hours to minutes From .deb + manual config to all automated Easier Triage/debugging Fewer cfg-related defects, quicker assessment From 3-ways diff to git tools Simpler Change Requests Require fewer iterations before approval Fewer surprises when simulating the deployment Easier to rollback (but fewer rollbacks needed) Higher team satisfaction Efforts shifted from deployment time to deployment preparation Increased confidence Deployments are now considered “cheap” and “low-risk”
  • #9: Puppet has a “community version” or “enterprise version” (as Chef and most of the others)
  • #12: Possibly an overlooked feature/potentiality of Puppet is that it does not mandate a Master! Master/Slave Need to build/configure master (SPOF) Need to secure master/slave connections More secure Standalone (our choice – so far!) No need to have a master at all Easier to extend Need care in handling sensitive data
  • #15: This configuration will pull kamailio deb packages from sipwise repo (which is the official kamailio debian repo).
  • #16: A very common structure for a Puppet module. Templates are based on the default configuration provided inside the official debian packages. You can change the templates depending on your needs.
  • #17: Practical example: build a kamailio instance with WebSockets support. Let’s call it kamailio_ws. See the relevant configuration elements here: with_websockets set to TRUE. Here we’re telling Puppet that the installation phase requires the instantiation of a trulabs-kamailio class with those configuration properties. Puppet will do the job for us.
  • #18: The surrounding conditions for such a host would be: Firewall TCP keepalive settings SSL certificates checks Swap memory configuration Monit Nagios fail2ban Other tools You can build the node with trulabs-kamailio and other 3rd party modules (e.g. puppetlabs-firewall), depending on your needs.
  • #20: Finally, let’s move to Asterisk. If we think about the main components involved in an installation: pre-requisites: apt sources, DAHDI if needed. Packages to be installed: core, sounds, perhaps your own packages from your repos Configuration files (sip.conf, rtp.conf, etc) to set up TLS, ODBC, etc
  • #21: A minimal configuration is the following. See we have the option to enable and manage directly asterisk as a service. We can also enable listening on TCP (default: disabled). This happens by interacting with the configuration files templates.
  • #22: For example, if I apply the previous node definition to a debian wheezy machine, these packages are installed. (this is just the action of installing ‘asterisk’, which will pull the other packages automatically). This happens because the default value for the asterisk package is “latest”. You can set whatever version you want (as long as it’s reachable with the current apt source configuration).
  • #23: Other things that are happening: asterisk is configured to listen on UDP 5060 and TCP 5060. This can be changed by specifying udpbindaddr and tcpbindaddr attributes when instantiating the class.
  • #24: If you want to manage Asterisk’s configuration files outside of the basic trulabs module, You can do so by asking the module not to manage the configuration, and by Managing the desired configuration file(s) directly in Puppeteeze.
  • #25: In analogy with “But I want my config files”, you can specify a custom version. You need to set up apt sources properly.
  • #26: In analogy with what seen with kamailio, here’s the minimum amount of instructions needed to have an asterisk app up and running. You can try this easily inside a docker container.
  • #27: You can add this to your asterisk node definition, so that you protect access (iptables) to UDP 5060 from kamailio only. The arrow in this slide shows an interesting thing: a FACT. Facts are pre-set variables that you can use in your manifests. They make it possible for you to refer to local properties automatically. On the other hand, $kamailio_ip is a variable that you can set, and will determine, in this example, the f/w configuration.