SlideShare a Scribd company logo
1 of 25
HUBERT Mickaël / Allo-Media 2020
HUBERT Mickaël
Ansible, voyage au centre de l’automatisation
1
HUBERT Mickaël / Allo-Media 2020
Ansible, c’est quoi ?
Créé en 2012 par Michael DeHaan
Racheté par Red Hat en 2015
Développé en Python
Agentless architecture
C’est une solution pour les feignants !
● Déploiements
● Exécution de tâches
● Gestion de configurations
Le tout sur plusieurs environnements en parallèle
2
www.ansible.com
HUBERT Mickaël / Allo-Media 2020
Plus de 1400 modules
disponibles
regroupés en grandes
familles
● Cloud modules
● Clustering modules
● Commands modules
● Crypto modules
● Database modules
● Files modules
● Identity modules
● Inventory modules
● Messaging modules
● Monitoring modules
● Net Tools modules
● Network modules
● Notification modules
● Packaging modules
● Remote Management modules
● Source Control modules
● Storage modules
● System modules
● Utilities modules
● Web Infrastructure modules
● Windows modules
3
HUBERT Mickaël / Allo-Media 2020
Plus de 1400 modules
disponibles
regroupés en grandes
familles
● Cloud modules
● Clustering modules
● Commands modules
● Crypto modules
● Database modules
● Files modules
● Identity modules
● Inventory modules
● Messaging modules
● Monitoring modules
● Net Tools modules
● Network modules
● Notification modules
● Packaging modules
● Remote Management modules
● Source Control modules
● Storage modules
● System modules
● Utilities modules
● Web Infrastructure modules
● Windows modules
4
HUBERT Mickaël / Allo-Media 2020
Plus de 1400 modules
disponibles
regroupés en grandes
familles
● Cloud modules
● Clustering modules
● Commands modules
● Crypto modules
● Database modules
● Files modules
● Identity modules
● Inventory modules
● Messaging modules
● Monitoring modules
● Net Tools modules
● Network modules
● Notification modules
● Packaging modules
● Remote Management modules
● Source Control modules
● Storage modules
● System modules
● Utilities modules
● Web Infrastructure modules
● Windows modules
5
HUBERT Mickaël / Allo-Media 2020
Comment l’installer et l’utiliser
Retour si OK:
192.168.1.1 | success >> {
"changed": false,
"ping": "pong"
}
$ sudo pip install ansible
$ ssh-keygen
$ ssh-copy-id -i ~/.ssh/id_rsa.pub ansible@192.168.1.1
$ sudo vim /etc/ansible/hosts
192.168.1.1
$ ansible all -m ping -u ansible
6
HUBERT Mickaël / Allo-Media 2020
Vocabulaire
● inventory : C’est l’inventaire des serveurs que l’on souhaite provisionner
● fact : L’ensemble des informations que Ansible va être capable de récupérer sur le host (IP, OS, version
d’OS, etc …)
● var : L’ensemble des variables que l’on va utiliser dans nos actions avec Ansible
● template : C’est un template de fichier au format Jinja2 (comparable à Twig en PHP)
● module : Les fameux 1400 modules composant Ansible
● task : Utilisation d’un module que l’on va exécuter
● role : Regroupement d’un ensemble de tasks, variables, templates
● playbook : Regroupement d’un ensemble de roles ou tasks
7
HUBERT Mickaël / Allo-Media 2020
Diagramme
WEB 1
WEB 2
WEB 3
WEB 4
Variables
Inventaires
Tâches
La machine hébergeant Ansible
- Un serveur commun aux admins
- Votre laptop
Templates / files
8
HUBERT Mickaël / Allo-Media 2020
Ansible directories best practices
inventories/
production/
hosts # inventory file for production servers
group_vars/
group1.yml # here we assign variables to
particular groups
group2.yml
host_vars/
hostname1.yml # here we assign variables to
particular systems
hostname2.yml
site.yml
roles/
common/
webtier/
monitoring/
fooapp/
sources: https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html
9
HUBERT Mickaël / Allo-Media 2020
Roles directories best practices
site.yml
roles/
common/
tasks/
handlers/
files/
templates/
vars/
defaults/
meta/
test/
webservers/
tasks/
defaults/
# contains the main list of tasks to be executed by the role.
# contains handlers, which may be used by this role or even anywhere outside this role.
# default variables for the role.
# other variables for the role.
# contains files which can be deployed via this role.
# contains templates which can be deployed via this role.
sources: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-directory-structure
# role / author description.
# how to test your role (not in Ansible best practices).
10
HUBERT Mickaël / Allo-Media 2020
Structure de fichiers chez Allo-Media
- ansible-voip - inventories
- dev
- preprod
- prod
- group_vars
- hosts
hosts file
[scr-servers]
am-scr-001
am-scr-002
[rtp-servers]
am-rtp-001
am-rtp-002
[isbc-servers]
am-isbc-001
am-isbc-002
[asbc-servers]
am-asbc-001
…..
group_vars directory
- all.crypt
- all_asbc.yml
- all_mrcp.yml
- all_scr.yml
- all_rtp.yml
- am-isbc-001.crypt
- am-isbc-002.crypt
- am-rtp-001.crypt
- am-rtp-002.crypt
...
11
HUBERT Mickaël / Allo-Media 2020
Structure de fichiers chez Allo-Media
inventories/prod/group_vars/all_asbc.yml
asbc_conf_path: /usr/local/freeswitch
asbc_customers_conf_path: /conf/dialplan/customers_config
asbc_graylog2_host: 10.1.0.42
asbc_graylog2_port: 12201
asbc_freeswitch_version: v1.8
asbc_from_internal_domain: am-isbc-002.allo-media.tech
asbc_user: freeswitch
asbc_group: freeswitch
asbc_scr_gateways_list:
- { name: "GWSCR1", host: "10.1.15.141" }
- { name: "GWSCR2", host: "10.1.15.142" }
asbc_proxies_gateways_list:
- { name: "GWPROXY1", host: "10.1.15.153" }
12
HUBERT Mickaël / Allo-Media 2020
Structure de fichiers chez Allo-Media
inventories/prod/group_vars/all_asbc.yml
asbc_conf_path: /usr/local/freeswitch
asbc_customers_conf_path: /conf/dialplan/customers_config
asbc_graylog2_host: 10.1.0.42
asbc_graylog2_port: 12201
asbc_freeswitch_version: v1.8
asbc_from_internal_domain: am-isbc-002.allo-media.tech
asbc_user: freeswitch
asbc_group: freeswitch
asbc_scr_gateways_list:
- { name: "GWSCR1", host: "10.1.15.141" }
- { name: "GWSCR2", host: "10.1.15.142" }
asbc_proxies_gateways_list:
- { name: "GWPROXY1", host: "10.1.15.153" }
13
HUBERT Mickaël / Allo-Media 2020
Structure de fichiers chez Allo-Media
- ansible-voip - roles - asbc_config - tasks
- templates
tasks directory
- main.yml
templates directory
- internal.xml.j2
14
HUBERT Mickaël / Allo-Media 2020
Task
roles/asbc_config/tasks/main.yml
- name: copy FS configurations files
template:
src: "{{ item.src }}"
dest: "{{ asbc_conf_path }}/{{ item.path | regex_replace('.j2','')
}}"
owner: "{{ asbc_user }}"
group: "{{ asbc_group }}"
mode: "0440"
with_filetree: templates/
when: item.state == 'file'
tags:
- never
- fs-config
asbc_conf_path: /usr/local/freeswitch
internal.xml.j2
15
HUBERT Mickaël / Allo-Media 2020
Template Jinja2
roles/asbc_config/templates/internal.xml.j2
#jinja2: lstrip_blocks: "True"
<?xml version="1.0" encoding="UTF-8"?>
<profile name="INTERNAL">
<settings>
...........
</settings>
<gateways>
{% for gateway in asbc_scr_gateways_list + asbc_proxies_gateways_list
%}
<gateway name="{{ gateway.name }}">
<param name="from-domain" value="{{ asbc_from_internal_domain }}"/>
<param name="proxy" value="{{ gateway.host }}"/>
<param name="register" value="false"/>
<param name="retry-seconds" value="30"/>
<param name="ping" value="25"/>
</gateway>
{% endfor %}
</gateways>
</profile>
asbc_scr_gateways_list:
- { name: "GWSCR1", host: "10.1.15.141" }
- { name: "GWSCR2", host: "10.1.15.142" }
asbc_proxies_gateways_list:
- { name: "GWPROXY1", host: "10.1.15.153" }
asbc_from_internal_domain: am-isbc-002.allo-media.tech
16
HUBERT Mickaël / Allo-Media 2020
Résultat
/usr/local/freeswitch/conf/internal.xml
<gateways>
<gateway name="GWSCR1">
<param name="from-domain" value="am-isbc-002.allo-media.tech"/>
<param name="caller-id-in-from" value="true"/>
<param name="proxy" value="10.1.15.141"/>
<param name="register" value="false"/>
<param name="retry-seconds" value="30"/>
<param name="ping" value="25"/>
</gateway>
<gateway name="GWSCR2">
<param name="from-domain" value="am-isbc-002.allo-media.tech"/>
<param name="caller-id-in-from" value="true"/>
<param name="proxy" value="10.1.15.142"/>
<param name="register" value="false"/>
<param name="retry-seconds" value="30"/>
<param name="ping" value="25"/>
</gateway>
....
</gateways>
{{ gateway.name }} {{ asbc_from_internal_domain }}
{{ gateway.host }}
17
HUBERT Mickaël / Allo-Media 2020
Playbook
asbc-install_config.yml file
---
- name: ASBC installation + configuration deployment for asbc servers
hosts: asbc-servers
gather_facts: yes
become: yes
vars_files:
- inventories/{{ deploy_env }}/group_vars/all_asbc.yml
- inventories/{{ deploy_env }}/group_vars/{{ inventory_hostname
}}.crypt
roles:
- { role: fs_install, tags: [never,install] }
- { role: asbc_config, tags: [always] }
18
HUBERT Mickaël / Allo-Media 2020
Y’a plus qu’à
$ cd /home/moi/ansible-voip/
$ ansible-playbook 
asbc-install_config.yml 
-i inventories/prod/hosts 
-v 
-e deploy_env=prod 
-t install
19
- inventories/{{ deploy_env }}/group_vars/all_asbc.yml
- inventories/{{ deploy_env }}/group_vars/{{ inventory_hostname }}.crypt
HUBERT Mickaël / Allo-Media 2020
Comment tester son truc ?
main.yml
---
- name: Freeswitch installation by sources compilation
hosts: all
become: yes
pre_tasks:
- name: Verify Ansible version requirements.
....
roles:
- ../../fs_install
Avec Vagrant
- ansible-voip - roles - fs_install - tasks
- templates
- test
20
HUBERT Mickaël / Allo-Media 2020
Comment tester son truc ?
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
# freeswitch
config.vm.define "freeswitch-dev" do |freeswitch|
freeswitch.vm.hostname = "freeswitch-dev"
freeswitch.vm.network :private_network, ip: "10.99.0.224"
freeswitch.vm.network :private_network, ip: "10.99.1.224"
end
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 1024]
vb.customize ["modifyvm", :id, "--cpus", 2]
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "main.yml"
end
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.name = "freeswitch-dev"
end
end
# vagrant up
ou
# vagrant provision
21
HUBERT Mickaël / Allo-Media 2020
Créer son propre rôle
et le partager à la communauté
https://galaxy.ansible.com https://github.com/Mickaelh51/ar-opensips-from-sources
22
HUBERT Mickaël / Allo-Media 2020
Comparatif avec d’autres solutions
sources: https://www.edureka.co/blog/chef-vs-puppet-vs-ansible-vs-saltstack
23
HUBERT Mickaël / Allo-Media 2020
Pour aller un peu plus loin
Dynamic inventory:
https://github.com/Mickaelh51/ansible-dyninv-mysql
GitCrypt:
$ sudo apt-get install -y git-crypt
$ git-crypt keygen /path/to/keyfile
$ cd repo
$ git-crypt init /path/to/keyfile
$ echo "*.crypt filter=git-crypt diff=git-crypt" > .gitattributes
$ git commit
$ git push
24
HUBERT Mickaël / Allo-Media 2020
Fin
Twitter: @mikedunord
Email: mickael@winlux.fr
Github: https://github.com/mickaelh51
25

More Related Content

What's hot

Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stackBram Vogelaar
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansiblebcoca
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareCosimo Streppone
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUNCong Zhang
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaJon Moore
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetWalter Heck
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pmRyosuke IWANAGA
 
20141011 mastering mysqlnd
20141011 mastering mysqlnd20141011 mastering mysqlnd
20141011 mastering mysqlnddo_aki
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesBram Vogelaar
 
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
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetWalter Heck
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Observability with Consul Connect
Observability with Consul ConnectObservability with Consul Connect
Observability with Consul ConnectBram Vogelaar
 
Puppet at janrain
Puppet at janrainPuppet at janrain
Puppet at janrainPuppet
 
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
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stackBram Vogelaar
 
Hadoop Admin role & Hive Data Warehouse support
Hadoop Admin role & Hive Data Warehouse supportHadoop Admin role & Hive Data Warehouse support
Hadoop Admin role & Hive Data Warehouse supportmdcdwh
 

What's hot (20)

Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera Software
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
 
20141011 mastering mysqlnd
20141011 mastering mysqlnd20141011 mastering mysqlnd
20141011 mastering mysqlnd
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet Profiles
 
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
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
EC2
EC2EC2
EC2
 
Observability with Consul Connect
Observability with Consul ConnectObservability with Consul Connect
Observability with Consul Connect
 
Puppet at janrain
Puppet at janrainPuppet at janrain
Puppet at janrain
 
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
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Augeas @RMLL 2012
Augeas @RMLL 2012Augeas @RMLL 2012
Augeas @RMLL 2012
 
Hadoop Admin role & Hive Data Warehouse support
Hadoop Admin role & Hive Data Warehouse supportHadoop Admin role & Hive Data Warehouse support
Hadoop Admin role & Hive Data Warehouse support
 

Similar to Ansible, voyage au centre de l'automatisation

Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoiceDave Barcelo
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetNicolas Brousse
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
Puppet and the HashiCorp Suite
Puppet and the HashiCorp SuitePuppet and the HashiCorp Suite
Puppet and the HashiCorp SuiteBram Vogelaar
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...Nicolas Brousse
 
Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Giacomo Vacca
 
[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
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop AutomationRui Lapa
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsMichael Zhang
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)M Malai
 
Ansible is Our Wishbone
Ansible is Our WishboneAnsible is Our Wishbone
Ansible is Our WishboneMydbops
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloudpetriojala123
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at BazaarvoicePuppet
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined DatacenterNETWAYS
 

Similar to Ansible, voyage au centre de l'automatisation (20)

Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with Puppet
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
Puppet and the HashiCorp Suite
Puppet and the HashiCorp SuitePuppet and the HashiCorp Suite
Puppet and the HashiCorp Suite
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
 
Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017
 
[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
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop Automation
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
 
Ansible is Our Wishbone
Ansible is Our WishboneAnsible is Our Wishbone
Ansible is Our Wishbone
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloud
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at Bazaarvoice
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined Datacenter
 

Recently uploaded

Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...SUHANI PANDEY
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls DubaiEscorts Call Girls
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...SUHANI PANDEY
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Sheetaleventcompany
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 

Recently uploaded (20)

Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 

Ansible, voyage au centre de l'automatisation

  • 1. HUBERT Mickaël / Allo-Media 2020 HUBERT Mickaël Ansible, voyage au centre de l’automatisation 1
  • 2. HUBERT Mickaël / Allo-Media 2020 Ansible, c’est quoi ? Créé en 2012 par Michael DeHaan Racheté par Red Hat en 2015 Développé en Python Agentless architecture C’est une solution pour les feignants ! ● Déploiements ● Exécution de tâches ● Gestion de configurations Le tout sur plusieurs environnements en parallèle 2 www.ansible.com
  • 3. HUBERT Mickaël / Allo-Media 2020 Plus de 1400 modules disponibles regroupés en grandes familles ● Cloud modules ● Clustering modules ● Commands modules ● Crypto modules ● Database modules ● Files modules ● Identity modules ● Inventory modules ● Messaging modules ● Monitoring modules ● Net Tools modules ● Network modules ● Notification modules ● Packaging modules ● Remote Management modules ● Source Control modules ● Storage modules ● System modules ● Utilities modules ● Web Infrastructure modules ● Windows modules 3
  • 4. HUBERT Mickaël / Allo-Media 2020 Plus de 1400 modules disponibles regroupés en grandes familles ● Cloud modules ● Clustering modules ● Commands modules ● Crypto modules ● Database modules ● Files modules ● Identity modules ● Inventory modules ● Messaging modules ● Monitoring modules ● Net Tools modules ● Network modules ● Notification modules ● Packaging modules ● Remote Management modules ● Source Control modules ● Storage modules ● System modules ● Utilities modules ● Web Infrastructure modules ● Windows modules 4
  • 5. HUBERT Mickaël / Allo-Media 2020 Plus de 1400 modules disponibles regroupés en grandes familles ● Cloud modules ● Clustering modules ● Commands modules ● Crypto modules ● Database modules ● Files modules ● Identity modules ● Inventory modules ● Messaging modules ● Monitoring modules ● Net Tools modules ● Network modules ● Notification modules ● Packaging modules ● Remote Management modules ● Source Control modules ● Storage modules ● System modules ● Utilities modules ● Web Infrastructure modules ● Windows modules 5
  • 6. HUBERT Mickaël / Allo-Media 2020 Comment l’installer et l’utiliser Retour si OK: 192.168.1.1 | success >> { "changed": false, "ping": "pong" } $ sudo pip install ansible $ ssh-keygen $ ssh-copy-id -i ~/.ssh/id_rsa.pub ansible@192.168.1.1 $ sudo vim /etc/ansible/hosts 192.168.1.1 $ ansible all -m ping -u ansible 6
  • 7. HUBERT Mickaël / Allo-Media 2020 Vocabulaire ● inventory : C’est l’inventaire des serveurs que l’on souhaite provisionner ● fact : L’ensemble des informations que Ansible va être capable de récupérer sur le host (IP, OS, version d’OS, etc …) ● var : L’ensemble des variables que l’on va utiliser dans nos actions avec Ansible ● template : C’est un template de fichier au format Jinja2 (comparable à Twig en PHP) ● module : Les fameux 1400 modules composant Ansible ● task : Utilisation d’un module que l’on va exécuter ● role : Regroupement d’un ensemble de tasks, variables, templates ● playbook : Regroupement d’un ensemble de roles ou tasks 7
  • 8. HUBERT Mickaël / Allo-Media 2020 Diagramme WEB 1 WEB 2 WEB 3 WEB 4 Variables Inventaires Tâches La machine hébergeant Ansible - Un serveur commun aux admins - Votre laptop Templates / files 8
  • 9. HUBERT Mickaël / Allo-Media 2020 Ansible directories best practices inventories/ production/ hosts # inventory file for production servers group_vars/ group1.yml # here we assign variables to particular groups group2.yml host_vars/ hostname1.yml # here we assign variables to particular systems hostname2.yml site.yml roles/ common/ webtier/ monitoring/ fooapp/ sources: https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html 9
  • 10. HUBERT Mickaël / Allo-Media 2020 Roles directories best practices site.yml roles/ common/ tasks/ handlers/ files/ templates/ vars/ defaults/ meta/ test/ webservers/ tasks/ defaults/ # contains the main list of tasks to be executed by the role. # contains handlers, which may be used by this role or even anywhere outside this role. # default variables for the role. # other variables for the role. # contains files which can be deployed via this role. # contains templates which can be deployed via this role. sources: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-directory-structure # role / author description. # how to test your role (not in Ansible best practices). 10
  • 11. HUBERT Mickaël / Allo-Media 2020 Structure de fichiers chez Allo-Media - ansible-voip - inventories - dev - preprod - prod - group_vars - hosts hosts file [scr-servers] am-scr-001 am-scr-002 [rtp-servers] am-rtp-001 am-rtp-002 [isbc-servers] am-isbc-001 am-isbc-002 [asbc-servers] am-asbc-001 ….. group_vars directory - all.crypt - all_asbc.yml - all_mrcp.yml - all_scr.yml - all_rtp.yml - am-isbc-001.crypt - am-isbc-002.crypt - am-rtp-001.crypt - am-rtp-002.crypt ... 11
  • 12. HUBERT Mickaël / Allo-Media 2020 Structure de fichiers chez Allo-Media inventories/prod/group_vars/all_asbc.yml asbc_conf_path: /usr/local/freeswitch asbc_customers_conf_path: /conf/dialplan/customers_config asbc_graylog2_host: 10.1.0.42 asbc_graylog2_port: 12201 asbc_freeswitch_version: v1.8 asbc_from_internal_domain: am-isbc-002.allo-media.tech asbc_user: freeswitch asbc_group: freeswitch asbc_scr_gateways_list: - { name: "GWSCR1", host: "10.1.15.141" } - { name: "GWSCR2", host: "10.1.15.142" } asbc_proxies_gateways_list: - { name: "GWPROXY1", host: "10.1.15.153" } 12
  • 13. HUBERT Mickaël / Allo-Media 2020 Structure de fichiers chez Allo-Media inventories/prod/group_vars/all_asbc.yml asbc_conf_path: /usr/local/freeswitch asbc_customers_conf_path: /conf/dialplan/customers_config asbc_graylog2_host: 10.1.0.42 asbc_graylog2_port: 12201 asbc_freeswitch_version: v1.8 asbc_from_internal_domain: am-isbc-002.allo-media.tech asbc_user: freeswitch asbc_group: freeswitch asbc_scr_gateways_list: - { name: "GWSCR1", host: "10.1.15.141" } - { name: "GWSCR2", host: "10.1.15.142" } asbc_proxies_gateways_list: - { name: "GWPROXY1", host: "10.1.15.153" } 13
  • 14. HUBERT Mickaël / Allo-Media 2020 Structure de fichiers chez Allo-Media - ansible-voip - roles - asbc_config - tasks - templates tasks directory - main.yml templates directory - internal.xml.j2 14
  • 15. HUBERT Mickaël / Allo-Media 2020 Task roles/asbc_config/tasks/main.yml - name: copy FS configurations files template: src: "{{ item.src }}" dest: "{{ asbc_conf_path }}/{{ item.path | regex_replace('.j2','') }}" owner: "{{ asbc_user }}" group: "{{ asbc_group }}" mode: "0440" with_filetree: templates/ when: item.state == 'file' tags: - never - fs-config asbc_conf_path: /usr/local/freeswitch internal.xml.j2 15
  • 16. HUBERT Mickaël / Allo-Media 2020 Template Jinja2 roles/asbc_config/templates/internal.xml.j2 #jinja2: lstrip_blocks: "True" <?xml version="1.0" encoding="UTF-8"?> <profile name="INTERNAL"> <settings> ........... </settings> <gateways> {% for gateway in asbc_scr_gateways_list + asbc_proxies_gateways_list %} <gateway name="{{ gateway.name }}"> <param name="from-domain" value="{{ asbc_from_internal_domain }}"/> <param name="proxy" value="{{ gateway.host }}"/> <param name="register" value="false"/> <param name="retry-seconds" value="30"/> <param name="ping" value="25"/> </gateway> {% endfor %} </gateways> </profile> asbc_scr_gateways_list: - { name: "GWSCR1", host: "10.1.15.141" } - { name: "GWSCR2", host: "10.1.15.142" } asbc_proxies_gateways_list: - { name: "GWPROXY1", host: "10.1.15.153" } asbc_from_internal_domain: am-isbc-002.allo-media.tech 16
  • 17. HUBERT Mickaël / Allo-Media 2020 Résultat /usr/local/freeswitch/conf/internal.xml <gateways> <gateway name="GWSCR1"> <param name="from-domain" value="am-isbc-002.allo-media.tech"/> <param name="caller-id-in-from" value="true"/> <param name="proxy" value="10.1.15.141"/> <param name="register" value="false"/> <param name="retry-seconds" value="30"/> <param name="ping" value="25"/> </gateway> <gateway name="GWSCR2"> <param name="from-domain" value="am-isbc-002.allo-media.tech"/> <param name="caller-id-in-from" value="true"/> <param name="proxy" value="10.1.15.142"/> <param name="register" value="false"/> <param name="retry-seconds" value="30"/> <param name="ping" value="25"/> </gateway> .... </gateways> {{ gateway.name }} {{ asbc_from_internal_domain }} {{ gateway.host }} 17
  • 18. HUBERT Mickaël / Allo-Media 2020 Playbook asbc-install_config.yml file --- - name: ASBC installation + configuration deployment for asbc servers hosts: asbc-servers gather_facts: yes become: yes vars_files: - inventories/{{ deploy_env }}/group_vars/all_asbc.yml - inventories/{{ deploy_env }}/group_vars/{{ inventory_hostname }}.crypt roles: - { role: fs_install, tags: [never,install] } - { role: asbc_config, tags: [always] } 18
  • 19. HUBERT Mickaël / Allo-Media 2020 Y’a plus qu’à $ cd /home/moi/ansible-voip/ $ ansible-playbook asbc-install_config.yml -i inventories/prod/hosts -v -e deploy_env=prod -t install 19 - inventories/{{ deploy_env }}/group_vars/all_asbc.yml - inventories/{{ deploy_env }}/group_vars/{{ inventory_hostname }}.crypt
  • 20. HUBERT Mickaël / Allo-Media 2020 Comment tester son truc ? main.yml --- - name: Freeswitch installation by sources compilation hosts: all become: yes pre_tasks: - name: Verify Ansible version requirements. .... roles: - ../../fs_install Avec Vagrant - ansible-voip - roles - fs_install - tasks - templates - test 20
  • 21. HUBERT Mickaël / Allo-Media 2020 Comment tester son truc ? Vagrantfile # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "debian/stretch64" # freeswitch config.vm.define "freeswitch-dev" do |freeswitch| freeswitch.vm.hostname = "freeswitch-dev" freeswitch.vm.network :private_network, ip: "10.99.0.224" freeswitch.vm.network :private_network, ip: "10.99.1.224" end config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", 1024] vb.customize ["modifyvm", :id, "--cpus", 2] end config.vm.provision "ansible" do |ansible| ansible.playbook = "main.yml" end config.vm.provider "virtualbox" do |vb| vb.gui = false vb.name = "freeswitch-dev" end end # vagrant up ou # vagrant provision 21
  • 22. HUBERT Mickaël / Allo-Media 2020 Créer son propre rôle et le partager à la communauté https://galaxy.ansible.com https://github.com/Mickaelh51/ar-opensips-from-sources 22
  • 23. HUBERT Mickaël / Allo-Media 2020 Comparatif avec d’autres solutions sources: https://www.edureka.co/blog/chef-vs-puppet-vs-ansible-vs-saltstack 23
  • 24. HUBERT Mickaël / Allo-Media 2020 Pour aller un peu plus loin Dynamic inventory: https://github.com/Mickaelh51/ansible-dyninv-mysql GitCrypt: $ sudo apt-get install -y git-crypt $ git-crypt keygen /path/to/keyfile $ cd repo $ git-crypt init /path/to/keyfile $ echo "*.crypt filter=git-crypt diff=git-crypt" > .gitattributes $ git commit $ git push 24
  • 25. HUBERT Mickaël / Allo-Media 2020 Fin Twitter: @mikedunord Email: mickael@winlux.fr Github: https://github.com/mickaelh51 25