Ansible - Warum, wie; es ist
so einfach
Infracoders Meetup
17.07.2017 1
Über ME2Digital
• Aleksandar Lazic seit ~20 Jahren in IT
• Seit 2003 aktiv haproxy commnity
• Seit 2006 aktiv nginx community dabei => nginxexpert
• Seit ??? Bei curl semi-aktiv community dabei
• Seit 2015 bei openshift community dabei
• Immer neugierig sein
• Ich mache den Job gerne und mit Freude ;-)
• Das Unternehmen gibt es seit 2017
17.07.2017 2
Geschichte von Ansible
• Entwicklung begann 2012
• Programmiersprache ist python
• Erste Release 2013 Ansible 1.1 Released!
• Die Geschichte hinter Ansible vom Autor The Origins of Ansible
• Akquiriert von Red Hat 2015 Red Hat acquires Ansible
• Sehr aktive community
• Ansible Blog
17.07.2017 3
Ansible Aufbau
• Ansible besteht aus einem schlanken core
• Vieles ist auf Module ausgelagert
• Modul Übersicht
• Fast alle Module sind von der Eingabeaufforderung aufrufbar
• ansible -m <MODUL> -a <ARGUMENTE> hostliste
• Erweiterbar mit Lösungen von Ansible Galaxy
• Kein Agent
• Kommunikation basiert auf SSH
17.07.2017 4
Wo fang ich an
• Ansible gibt es für viele Plattformen Installation
• Ja auch windows aber nur als „Managed Node“
• Lern YAML, WICHTIG!
• Kleine Schritte wie zum Beispiel ändern einer Konfigurationsdatei
• ansible -m lininfile -a 'regex="^nameserver 8.8.8.8" line="nameserver 8.8.8.8"
state=absent backup=yes" dest=/etc/resolv.conf' nodes
• Nutze „--syntax-check“ und „--check“
17.07.2017 5
Ein Beispiel
• Siehe auch Rollout corporate CA with ansible
• Unternehmens CA als .pem-Datei
• Das playbook
---
- hosts: all
vars:
ANCH_DIR:/usr/share/pki/ca-trust-source/anchors
CA_PEM:THE-PATH-TO-THE-PEM.pem
tasks:
- name: copy corporate-ca pem file
copy: src={{ CA_PEM }} dest={{ ANCH_DIR }}
- name: execute update-ca-trust
command: update-ca-trust
• Ausführen
ansible-playbook ca-distribute.yaml
17.07.2017 6
Tips & Tricks
• Lesen & Verstehen & Lesen http://docs.ansible.com/
• Vorgeschlagene Verzeichnisstruktur
• Geduld und viel Testen. Ist relativ einfach mit „Conditionals“
• ME2Digital Some Tips and Tricks for ansible
• Debug log
• ANSIBLE_LOG_PATH=/tmp/ans-log-$(date +%Y%m%d-%H%M%S).log
ANSIBLE_DEBUG=true ansible-playbook DEIN-PLAYBOOK.yml > /tmp/ans-
std-$(date +%Y%m%d-%H%M%S) 2>&1
• „rollen“ gut überlegen, nicht zu viele und nicht zu wenige
• Call für kommerziellen Unterstützung ;-)
17.07.2017 7
Informationen
• LinkedIn: https://www.linkedin.com/in/me2digital-eu/
• SlideShare: https://www.slideshare.net/AleksandarLazic4
• Facebook: https://www.facebook.com/me2digitaleu
• Xing: https://www.xing.com/profile/Aleksandar_Lazic
• Twitter: @ME2Digital
• HP: www.me2digital.com
• E-Mail: aleks@me2digital.com
• Phone: 0043 663 03 00 31 15
17.07.2017 8

Infra coders meetup

  • 1.
    Ansible - Warum,wie; es ist so einfach Infracoders Meetup 17.07.2017 1
  • 2.
    Über ME2Digital • AleksandarLazic seit ~20 Jahren in IT • Seit 2003 aktiv haproxy commnity • Seit 2006 aktiv nginx community dabei => nginxexpert • Seit ??? Bei curl semi-aktiv community dabei • Seit 2015 bei openshift community dabei • Immer neugierig sein • Ich mache den Job gerne und mit Freude ;-) • Das Unternehmen gibt es seit 2017 17.07.2017 2
  • 3.
    Geschichte von Ansible •Entwicklung begann 2012 • Programmiersprache ist python • Erste Release 2013 Ansible 1.1 Released! • Die Geschichte hinter Ansible vom Autor The Origins of Ansible • Akquiriert von Red Hat 2015 Red Hat acquires Ansible • Sehr aktive community • Ansible Blog 17.07.2017 3
  • 4.
    Ansible Aufbau • Ansiblebesteht aus einem schlanken core • Vieles ist auf Module ausgelagert • Modul Übersicht • Fast alle Module sind von der Eingabeaufforderung aufrufbar • ansible -m <MODUL> -a <ARGUMENTE> hostliste • Erweiterbar mit Lösungen von Ansible Galaxy • Kein Agent • Kommunikation basiert auf SSH 17.07.2017 4
  • 5.
    Wo fang ichan • Ansible gibt es für viele Plattformen Installation • Ja auch windows aber nur als „Managed Node“ • Lern YAML, WICHTIG! • Kleine Schritte wie zum Beispiel ändern einer Konfigurationsdatei • ansible -m lininfile -a 'regex="^nameserver 8.8.8.8" line="nameserver 8.8.8.8" state=absent backup=yes" dest=/etc/resolv.conf' nodes • Nutze „--syntax-check“ und „--check“ 17.07.2017 5
  • 6.
    Ein Beispiel • Sieheauch Rollout corporate CA with ansible • Unternehmens CA als .pem-Datei • Das playbook --- - hosts: all vars: ANCH_DIR:/usr/share/pki/ca-trust-source/anchors CA_PEM:THE-PATH-TO-THE-PEM.pem tasks: - name: copy corporate-ca pem file copy: src={{ CA_PEM }} dest={{ ANCH_DIR }} - name: execute update-ca-trust command: update-ca-trust • Ausführen ansible-playbook ca-distribute.yaml 17.07.2017 6
  • 7.
    Tips & Tricks •Lesen & Verstehen & Lesen http://docs.ansible.com/ • Vorgeschlagene Verzeichnisstruktur • Geduld und viel Testen. Ist relativ einfach mit „Conditionals“ • ME2Digital Some Tips and Tricks for ansible • Debug log • ANSIBLE_LOG_PATH=/tmp/ans-log-$(date +%Y%m%d-%H%M%S).log ANSIBLE_DEBUG=true ansible-playbook DEIN-PLAYBOOK.yml > /tmp/ans- std-$(date +%Y%m%d-%H%M%S) 2>&1 • „rollen“ gut überlegen, nicht zu viele und nicht zu wenige • Call für kommerziellen Unterstützung ;-) 17.07.2017 7
  • 8.
    Informationen • LinkedIn: https://www.linkedin.com/in/me2digital-eu/ •SlideShare: https://www.slideshare.net/AleksandarLazic4 • Facebook: https://www.facebook.com/me2digitaleu • Xing: https://www.xing.com/profile/Aleksandar_Lazic • Twitter: @ME2Digital • HP: www.me2digital.com • E-Mail: aleks@me2digital.com • Phone: 0043 663 03 00 31 15 17.07.2017 8