SlideShare une entreprise Scribd logo
1  sur  21
Usages autour d’Ansible sur
le Cloud public ou privé
Ikoula
Création : 1998
8 000 VM en
production
Effectif : 47 employés
5 000 serveurs
physiques
8 datacenters dans le
monde
Un peu d’histoire
Le Cloud by Ikoula – privé, public,
hybride
 Orchestration CloudStack
 Pilote le stockage
 Pilote les composants réseaux et
sécurité
 Pilote la virtualisation
 Pilote la bibliothèque d’images
et ISO.
 Interfaces
 Web: Interface de gestion via
navigateur internet
 Ligne de commande: Gérer votre
PaaS via un shell
 API: Intégrer les webservices de
l’API cloudstack à votre système
Le Cloud by Ikoula– interopérabilité
et API
Pourquoi Ansible ?
 Outil de configuration rapide
 Simple à prendre en main
 Modulaire
 Sans agent
 Pas besoin d’un orchestrateur central
 Interopérable avec Windows
Pour quels besoins ?
 Faciliter la configuration de nouveaux serveurs
 Aider à la maintenance : patch, modification de
configuration, mises à jours, gestion de droits, etc.
 Gestion par groupe de serveurs
Inventaire
 Déclarer ses hôtes
[z1frxenmutu]
fr-z1-mutu01-xen[01:02] ansible_connection=ssh ansible_ssh_port=22
fr-z1-mutu02-xen01 ansible_connection=ssh ansible_ssh_port=22
fr-z1-mutu03-xen[01:03] ansible_connection=ssh ansible_ssh_port=22
 Lister les hôtes d’un groupe
user@ansadmin~$ ansible z1frxenmutu --list-hosts
fr-z1-mutu01-xen01
fr-z1-mutu01-xen02
fr-z1-mutu02-xen01
fr-z1-mutu03-xen01
fr-z1-mutu03-xen02
fr-z1-mutu03-xen03
Ansible pour la mise en production
Exemple :
installer 4 serveurs PostgreSQL
Ajout d’un repo dans Debian
user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m apt_repository -a
"repo='deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' state=present“
PgHotStandbyUpstream | success >> {
"changed": true,
"repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main",
"state": "present"
}
PgMaster | success >> {
"changed": true,
"repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main",
"state": "present"
}
PgStandbyDownstream | success >> {
"changed": true,
"repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main",
"state": "present"
}
PgWitness | success >> {
"changed": true,
"repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main",
"state": "present"
}
Ajouter la clé du repo
user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m apt_key -a
"url=https://www.postgresql.org/media/keys/ACCC4CF8.asc state=present“
PgMaster | success >> {
"changed": true
}
PgStandbyDownstream | success >> {
"changed": true
}
PgWitness | success >> {
"changed": true
}
PgHotStandbyUpstream | success >> {
"changed": true
}
InstallerPostgreSQL
user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m apt -a
"name=postgresql state=latest"
PgHotStandbyUpstream | success >> {
"changed": true,
"stderr": "",
"stdout": "Reading package lists...nBuilding dependency tree...nReading
state information...nThe following extra packages will be installed:n libpq5
libxslt1.1 pgdg-keyring postgresql-9.4 postgresql-client-9.4n postgresql-
client-common postgresql-common postgresql-contrib-9.4 ssl-certnSuggested
packages:n postgresql-doc oidentd ident-server locales-all postgresql-doc-
9.4n libdbd-pg-perl openssl-blacklistnThe following NEW packages will be
installed:n (…)
Setting up postgresql (9.4+169.pgdg80+1) ...rnSetting up postgresql-contrib-
9.4 (9.4.4-1.pgdg80+1) ...rnProcessing triggers for libc-bin (2.19-18+deb8u1)
...rnProcessing triggers for systemd (215-17+deb8u2) ...rn"
}
PgMaster | success >> {
"changed": true,
(…)
Vérifier l’état du service
user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m shell -a
"systemctl status postgresql“
PgMaster | success | rc=0 >>
* postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
Active: active (exited) since Wed 2015-09-30 15:35:22 CEST; 2min 16s ago
Main PID: 47224 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/postgresql.service
PgHotStandbyUpstream | success | rc=0 >>
* postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
Active: active (exited) since Wed 2015-09-30 15:35:13 CEST; 2min 26s ago
Main PID: 47134 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/postgresql.service
(…)
Ansible pour la maintenance
 Cas 1 : modification d’une configuration en place
 Cas 2 : déploiement d’un script de supervision
 Cas 3 : application de patches
Modification IP du serveur syslog
{{ hostuuid }} > variable définie dans le fichier d’inventaire
user@ansadmin:~$ ansible xenall -u root -m shell -a "xe host-param-set uuid={{
hostuuid }} logging:syslog_destination=192.168.1.250"
user@ansadmin:~$ ansible xenall -u root -m shell -a "xe host-syslog-reconfigure
host-uuid={{ hostuuid }}"
Copie d’un script de supervision
mode > droits à appliquer au fichier ; owner / group > les propriétaires
user@ansadmin:~$ ansible xenall -u root -m copy -a
"src=/home/administrator/cloudstack/files/monitoring_wrapper.sh
dest=/home/zabbix/scripts/monitoring_wrapper.sh mode=500 owner=zabbix
group=zabbix"
fr-z1-mutu03-xen01 | success >> {
"changed": true,
"checksum": "f58c96289522ab9418d420dc356ee412d1ae261e",
"dest": "/home/zabbix/scripts/monitoring_wrapper.sh",
"gid": 500,
"group": "zabbix",
"md5sum": "1c02718baa2c4d5193a430789d51e033",
"mode": "0500",
"owner": "zabbix",
"size": 4951,
"src": "/tmp/ansible/ansible-tmp-1440771441.05-37417552365678/source",
"state": "file",
"uid": 500
}
Gestion de patchs
{{ hostuuid }} & {{ pwd }} > variables définies dans l’inventaire
user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "hostname && xe -u root
-pw {{ pwd }} patch-list hosts:contains={{ hostuuid }} params=name-label | sort"
| awk '{print $NF}' | grep -v "^$”
>>
fr-z3-mutu01-xen01
XS65E001
(…)
XS65ESP1005
>>
nl-z2-basic-mutu01-xen01
XS65E001
(…)
XS65ESP1005
>>
de-z1-adv-mutu01-xen02
XS65E001
(…)
XS65ESP1005
>>
Appliquer un patch
Pour uploader et appliquer le patch « XS65ESP1008.xsupdate » sur tous les
Xenserver en version 6.5 SP1
user@ansadmin:~$ ansible xenall65sp1 -u root -m copy -a
"src=/home/administrator/cloudstack/patchs/XS65ESP1008.xsupdate
dest=/root/XS65ESP1008.xsupdate"
user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "xe patch-upload -s {{
my_host_alias }} -u root -pw {{ pwd }} file-name=/root/XS65ESP1008.xsupdate"
user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "xe -s {{ my_host_alias
}} -u root -pw {{ pwd }} patch-pool-apply uuid=d91b3557-f1bf-4083-bd6f-
80a19d983775"
user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "rm -f
/root/XS65ESP1008.xsupdate"
Ansible, outil d’admin indispensable
Avantages :
 Simple d’utilisation
 Riche en modules Core et Extra
 Pas d’agent nécessaire
 Gestion de rôles (les “playbooks”)
A venir :
 le module« cloudstack » récemment arrivé dans
les modules Core de Ansible 2.0
Ressources
 Documentation Ansible
http://docs.ansible.com/ansible/index.html
 Ressources Ikoula
 https://github.com/ikoula
 Scripts Ansible
 https://www.ikoula-blog.com/
 Tutoriaux, cas pratiques, etc.
 https://fr.ikoula.wiki/
 Base de connaissances
Gardez le contact !
@ikoula ou @ikoula_EN
ikoula Hosting Services
ikoula
ikoula
Auteur : Nicolas Trauwaen

Contenu connexe

Tendances

Meetup Drupal Lyon - Sécuriser un site drupal
Meetup Drupal Lyon - Sécuriser un site drupalMeetup Drupal Lyon - Sécuriser un site drupal
Meetup Drupal Lyon - Sécuriser un site drupal
Aurelien Navarre
 
Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...
Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...
Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...
Severalnines
 
Réu technodejs
Réu technodejsRéu technodejs
Réu technodejs
naholyr
 
Industrialiser la gestion des fichiers multimedia #dcparis13
Industrialiser la gestion des fichiers multimedia #dcparis13Industrialiser la gestion des fichiers multimedia #dcparis13
Industrialiser la gestion des fichiers multimedia #dcparis13
Aurelien Navarre
 

Tendances (19)

201211 drupagora hostingdrupal
201211 drupagora hostingdrupal201211 drupagora hostingdrupal
201211 drupagora hostingdrupal
 
Meetup Drupal Lyon - Sécuriser un site drupal
Meetup Drupal Lyon - Sécuriser un site drupalMeetup Drupal Lyon - Sécuriser un site drupal
Meetup Drupal Lyon - Sécuriser un site drupal
 
Sécurité MySQL
Sécurité MySQLSécurité MySQL
Sécurité MySQL
 
nodejs vs vertx
nodejs vs vertxnodejs vs vertx
nodejs vs vertx
 
PostgreSQL sous linux
PostgreSQL sous linuxPostgreSQL sous linux
PostgreSQL sous linux
 
Meet-Up SQLI Lyon 09-2015 - Varnish
Meet-Up SQLI Lyon 09-2015 - VarnishMeet-Up SQLI Lyon 09-2015 - Varnish
Meet-Up SQLI Lyon 09-2015 - Varnish
 
Zabbix, garder un oeil toujours ouvert
Zabbix, garder un oeil toujours ouvertZabbix, garder un oeil toujours ouvert
Zabbix, garder un oeil toujours ouvert
 
Python + ansible = ♥
Python + ansible = ♥Python + ansible = ♥
Python + ansible = ♥
 
Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...
Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...
Performance de Percona XtraDB Cluster / Galera Cluster: Monitoring & Gestion ...
 
Microbox : Ma toolbox microservices - Julien Roy
Microbox : Ma toolbox microservices - Julien RoyMicrobox : Ma toolbox microservices - Julien Roy
Microbox : Ma toolbox microservices - Julien Roy
 
Réu technodejs
Réu technodejsRéu technodejs
Réu technodejs
 
Initiation à Express js
Initiation à Express jsInitiation à Express js
Initiation à Express js
 
JSS2014 – Haute disponibilité dans Azure
JSS2014 – Haute disponibilité dans AzureJSS2014 – Haute disponibilité dans Azure
JSS2014 – Haute disponibilité dans Azure
 
Installer et configurer MariaDB
Installer et configurer MariaDBInstaller et configurer MariaDB
Installer et configurer MariaDB
 
Tout comprendre de Nuxeo Drive - Nuxeo Tour 2014 - workshop
Tout comprendre de Nuxeo Drive - Nuxeo Tour 2014 - workshopTout comprendre de Nuxeo Drive - Nuxeo Tour 2014 - workshop
Tout comprendre de Nuxeo Drive - Nuxeo Tour 2014 - workshop
 
Chiffrer et sécuriser MariaDB
Chiffrer et sécuriser MariaDBChiffrer et sécuriser MariaDB
Chiffrer et sécuriser MariaDB
 
Sécuriser & chiffrer Mariadb - JDLL 2017
Sécuriser & chiffrer Mariadb - JDLL 2017Sécuriser & chiffrer Mariadb - JDLL 2017
Sécuriser & chiffrer Mariadb - JDLL 2017
 
Techdays 2014 - Le fermier azure (2ème partie)
Techdays 2014 - Le fermier azure (2ème partie)Techdays 2014 - Le fermier azure (2ème partie)
Techdays 2014 - Le fermier azure (2ème partie)
 
Industrialiser la gestion des fichiers multimedia #dcparis13
Industrialiser la gestion des fichiers multimedia #dcparis13Industrialiser la gestion des fichiers multimedia #dcparis13
Industrialiser la gestion des fichiers multimedia #dcparis13
 

Similaire à Usages autour d’Ansible chez ikoula

GWT : under the hood
GWT : under the hoodGWT : under the hood
GWT : under the hood
svuillet
 
[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco
[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco
[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco
PASCAL Jean Marie
 
Spark Streaming
Spark StreamingSpark Streaming
Spark Streaming
PALO IT
 
Comment automatiser les commandes PowerShell pour optimiser la performance d'...
Comment automatiser les commandes PowerShell pour optimiser la performance d'...Comment automatiser les commandes PowerShell pour optimiser la performance d'...
Comment automatiser les commandes PowerShell pour optimiser la performance d'...
Microsoft Décideurs IT
 

Similaire à Usages autour d’Ansible chez ikoula (20)

05 - creation-playbook-ansible-stack-lamp.pdf
05 - creation-playbook-ansible-stack-lamp.pdf05 - creation-playbook-ansible-stack-lamp.pdf
05 - creation-playbook-ansible-stack-lamp.pdf
 
05 - creation-playbook-ansible-stack-lamp.pdf
05 - creation-playbook-ansible-stack-lamp.pdf05 - creation-playbook-ansible-stack-lamp.pdf
05 - creation-playbook-ansible-stack-lamp.pdf
 
GWT : under the hood
GWT : under the hoodGWT : under the hood
GWT : under the hood
 
Vert.x 3
Vert.x 3Vert.x 3
Vert.x 3
 
Machines Virtuelles dans Azure quoi de neuf ?
Machines Virtuelles dans Azure quoi de neuf ?Machines Virtuelles dans Azure quoi de neuf ?
Machines Virtuelles dans Azure quoi de neuf ?
 
Machines Virtuelles dans Azure quoi de neuf ?
Machines Virtuelles dans Azure quoi de neuf ?Machines Virtuelles dans Azure quoi de neuf ?
Machines Virtuelles dans Azure quoi de neuf ?
 
Synthese
SyntheseSynthese
Synthese
 
Chef - Paris BlockCamp - Nov 09
Chef - Paris BlockCamp - Nov 09Chef - Paris BlockCamp - Nov 09
Chef - Paris BlockCamp - Nov 09
 
Retour d'expérience sur PowerShell
Retour d'expérience sur PowerShellRetour d'expérience sur PowerShell
Retour d'expérience sur PowerShell
 
REX Ansible
REX AnsibleREX Ansible
REX Ansible
 
Aperçu de RequireJS
Aperçu de RequireJSAperçu de RequireJS
Aperçu de RequireJS
 
Webinar Smile : Comment industrialiser votre SI avec Ansible ?
Webinar Smile : Comment industrialiser votre SI avec Ansible ?Webinar Smile : Comment industrialiser votre SI avec Ansible ?
Webinar Smile : Comment industrialiser votre SI avec Ansible ?
 
[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco
[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco
[DRAFT] Utiliser VmWare pour l'installation d'un Alfresco
 
Mise en place de Nagios3 pas à pas
Mise en place de Nagios3 pas à pas Mise en place de Nagios3 pas à pas
Mise en place de Nagios3 pas à pas
 
Spark Streaming
Spark StreamingSpark Streaming
Spark Streaming
 
Comment automatiser les commandes PowerShell pour optimiser la performance d'...
Comment automatiser les commandes PowerShell pour optimiser la performance d'...Comment automatiser les commandes PowerShell pour optimiser la performance d'...
Comment automatiser les commandes PowerShell pour optimiser la performance d'...
 
Installation Et Configuration De Monkey Spider
Installation Et Configuration De Monkey SpiderInstallation Et Configuration De Monkey Spider
Installation Et Configuration De Monkey Spider
 
Infrastructure as code drupal
Infrastructure as code drupalInfrastructure as code drupal
Infrastructure as code drupal
 
Performance et optimisation de PrestaShop
Performance et optimisation de PrestaShopPerformance et optimisation de PrestaShop
Performance et optimisation de PrestaShop
 
php2 : formulaire-session-PDO
php2 : formulaire-session-PDOphp2 : formulaire-session-PDO
php2 : formulaire-session-PDO
 

Usages autour d’Ansible chez ikoula

  • 1. Usages autour d’Ansible sur le Cloud public ou privé
  • 2. Ikoula Création : 1998 8 000 VM en production Effectif : 47 employés 5 000 serveurs physiques 8 datacenters dans le monde
  • 4. Le Cloud by Ikoula – privé, public, hybride
  • 5.  Orchestration CloudStack  Pilote le stockage  Pilote les composants réseaux et sécurité  Pilote la virtualisation  Pilote la bibliothèque d’images et ISO.  Interfaces  Web: Interface de gestion via navigateur internet  Ligne de commande: Gérer votre PaaS via un shell  API: Intégrer les webservices de l’API cloudstack à votre système Le Cloud by Ikoula– interopérabilité et API
  • 6. Pourquoi Ansible ?  Outil de configuration rapide  Simple à prendre en main  Modulaire  Sans agent  Pas besoin d’un orchestrateur central  Interopérable avec Windows
  • 7. Pour quels besoins ?  Faciliter la configuration de nouveaux serveurs  Aider à la maintenance : patch, modification de configuration, mises à jours, gestion de droits, etc.  Gestion par groupe de serveurs
  • 8. Inventaire  Déclarer ses hôtes [z1frxenmutu] fr-z1-mutu01-xen[01:02] ansible_connection=ssh ansible_ssh_port=22 fr-z1-mutu02-xen01 ansible_connection=ssh ansible_ssh_port=22 fr-z1-mutu03-xen[01:03] ansible_connection=ssh ansible_ssh_port=22  Lister les hôtes d’un groupe user@ansadmin~$ ansible z1frxenmutu --list-hosts fr-z1-mutu01-xen01 fr-z1-mutu01-xen02 fr-z1-mutu02-xen01 fr-z1-mutu03-xen01 fr-z1-mutu03-xen02 fr-z1-mutu03-xen03
  • 9. Ansible pour la mise en production Exemple : installer 4 serveurs PostgreSQL
  • 10. Ajout d’un repo dans Debian user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m apt_repository -a "repo='deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' state=present“ PgHotStandbyUpstream | success >> { "changed": true, "repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main", "state": "present" } PgMaster | success >> { "changed": true, "repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main", "state": "present" } PgStandbyDownstream | success >> { "changed": true, "repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main", "state": "present" } PgWitness | success >> { "changed": true, "repo": "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main", "state": "present" }
  • 11. Ajouter la clé du repo user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m apt_key -a "url=https://www.postgresql.org/media/keys/ACCC4CF8.asc state=present“ PgMaster | success >> { "changed": true } PgStandbyDownstream | success >> { "changed": true } PgWitness | success >> { "changed": true } PgHotStandbyUpstream | success >> { "changed": true }
  • 12. InstallerPostgreSQL user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m apt -a "name=postgresql state=latest" PgHotStandbyUpstream | success >> { "changed": true, "stderr": "", "stdout": "Reading package lists...nBuilding dependency tree...nReading state information...nThe following extra packages will be installed:n libpq5 libxslt1.1 pgdg-keyring postgresql-9.4 postgresql-client-9.4n postgresql- client-common postgresql-common postgresql-contrib-9.4 ssl-certnSuggested packages:n postgresql-doc oidentd ident-server locales-all postgresql-doc- 9.4n libdbd-pg-perl openssl-blacklistnThe following NEW packages will be installed:n (…) Setting up postgresql (9.4+169.pgdg80+1) ...rnSetting up postgresql-contrib- 9.4 (9.4.4-1.pgdg80+1) ...rnProcessing triggers for libc-bin (2.19-18+deb8u1) ...rnProcessing triggers for systemd (215-17+deb8u2) ...rn" } PgMaster | success >> { "changed": true, (…)
  • 13. Vérifier l’état du service user@ansadmin:~/postgres_cascading$ ansible -i hosts alls -u root -m shell -a "systemctl status postgresql“ PgMaster | success | rc=0 >> * postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled) Active: active (exited) since Wed 2015-09-30 15:35:22 CEST; 2min 16s ago Main PID: 47224 (code=exited, status=0/SUCCESS) CGroup: /system.slice/postgresql.service PgHotStandbyUpstream | success | rc=0 >> * postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled) Active: active (exited) since Wed 2015-09-30 15:35:13 CEST; 2min 26s ago Main PID: 47134 (code=exited, status=0/SUCCESS) CGroup: /system.slice/postgresql.service (…)
  • 14. Ansible pour la maintenance  Cas 1 : modification d’une configuration en place  Cas 2 : déploiement d’un script de supervision  Cas 3 : application de patches
  • 15. Modification IP du serveur syslog {{ hostuuid }} > variable définie dans le fichier d’inventaire user@ansadmin:~$ ansible xenall -u root -m shell -a "xe host-param-set uuid={{ hostuuid }} logging:syslog_destination=192.168.1.250" user@ansadmin:~$ ansible xenall -u root -m shell -a "xe host-syslog-reconfigure host-uuid={{ hostuuid }}"
  • 16. Copie d’un script de supervision mode > droits à appliquer au fichier ; owner / group > les propriétaires user@ansadmin:~$ ansible xenall -u root -m copy -a "src=/home/administrator/cloudstack/files/monitoring_wrapper.sh dest=/home/zabbix/scripts/monitoring_wrapper.sh mode=500 owner=zabbix group=zabbix" fr-z1-mutu03-xen01 | success >> { "changed": true, "checksum": "f58c96289522ab9418d420dc356ee412d1ae261e", "dest": "/home/zabbix/scripts/monitoring_wrapper.sh", "gid": 500, "group": "zabbix", "md5sum": "1c02718baa2c4d5193a430789d51e033", "mode": "0500", "owner": "zabbix", "size": 4951, "src": "/tmp/ansible/ansible-tmp-1440771441.05-37417552365678/source", "state": "file", "uid": 500 }
  • 17. Gestion de patchs {{ hostuuid }} & {{ pwd }} > variables définies dans l’inventaire user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "hostname && xe -u root -pw {{ pwd }} patch-list hosts:contains={{ hostuuid }} params=name-label | sort" | awk '{print $NF}' | grep -v "^$” >> fr-z3-mutu01-xen01 XS65E001 (…) XS65ESP1005 >> nl-z2-basic-mutu01-xen01 XS65E001 (…) XS65ESP1005 >> de-z1-adv-mutu01-xen02 XS65E001 (…) XS65ESP1005 >>
  • 18. Appliquer un patch Pour uploader et appliquer le patch « XS65ESP1008.xsupdate » sur tous les Xenserver en version 6.5 SP1 user@ansadmin:~$ ansible xenall65sp1 -u root -m copy -a "src=/home/administrator/cloudstack/patchs/XS65ESP1008.xsupdate dest=/root/XS65ESP1008.xsupdate" user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "xe patch-upload -s {{ my_host_alias }} -u root -pw {{ pwd }} file-name=/root/XS65ESP1008.xsupdate" user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "xe -s {{ my_host_alias }} -u root -pw {{ pwd }} patch-pool-apply uuid=d91b3557-f1bf-4083-bd6f- 80a19d983775" user@ansadmin:~$ ansible xenall65sp1 -u root -m shell -a "rm -f /root/XS65ESP1008.xsupdate"
  • 19. Ansible, outil d’admin indispensable Avantages :  Simple d’utilisation  Riche en modules Core et Extra  Pas d’agent nécessaire  Gestion de rôles (les “playbooks”) A venir :  le module« cloudstack » récemment arrivé dans les modules Core de Ansible 2.0
  • 20. Ressources  Documentation Ansible http://docs.ansible.com/ansible/index.html  Ressources Ikoula  https://github.com/ikoula  Scripts Ansible  https://www.ikoula-blog.com/  Tutoriaux, cas pratiques, etc.  https://fr.ikoula.wiki/  Base de connaissances
  • 21. Gardez le contact ! @ikoula ou @ikoula_EN ikoula Hosting Services ikoula ikoula Auteur : Nicolas Trauwaen