CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

27
Kopf frei für’s Produkt – Automatisierung mit Ansible und Jenkins CodeTalks Conference, Hamburg Oktober 2014

description

Presentation bei der CodeTalks Developer Conference in Hamburg zum Thema: "Kopf frei für's Produkt - Automatisierung mit Ansible und Jenkins" von LeanIX CTO André Christ und SW Architekt Dr. Daniel Pozzi. Vom ersten Einrichten einer Maschine bis zum Ausliefern der Anwendung ist es ein weiter Weg, der in einem Startup viele menschliche und technische Ressourcen abverlangt. Neue Kundenwünsche und Skalierung erfordern immer mehr Server, Dienste („best tool for the job“) oder Anwendungsinstanzen, die verwaltet werden wollen. Der SaaS-Anbieter LeanIX aus Bonn hat den manuellen Prozess in wenigen Wochen gegen eine vollständig automatisierte Provision-, Build- und Deploy-Kette mit ansible und Jenkins getauscht, um den Rücken für die Produktentwicklung frei zu haben.

Transcript of CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Page 1: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Kopf frei für’s Produkt – Automatisierung mit Ansible und Jenkins

CodeTalks Conference, Hamburg

Oktober 2014

Page 2: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Über uns

2

André Christ Gründer & CTO

Dr. Daniel Pozzi SW Architekt

Page 3: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Agenda

3

Kopf frei für welches Produkt?

Weshalb Automatisierung?

Was sind die „Lessons Learned“?

Wie wurde es mit Jenkins & Ansible umgesetzt?

Page 4: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Typisches Bild für IT Landschaften in Unternehmen: Fehlende Transparenz

4

Redundanz Kopfmonopole Risiken

Page 5: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

leanIX eine leicht zu nutzende SaaS-Plattform für das IT Architektur-Management

5

Fact Sheets & Tagging

Kontext-basierte Suche

API, Import & Export

Kommentierung

IT Inventory Kollaborationsplattform Interaktives Reporting

Activity Stream & Benachrichtigungen

Subscription

Print & Export (PDF)

Best Practice Reports

Interaktive Anpassung

Page 6: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Agenda

6

Kopf frei für welches Produkt?

Weshalb Automatisierung?

Wie wurde es mit Jenkins & Ansible umgesetzt?

Was sind die „Lessons Learned“?

Page 7: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Starke Nachfrage namhafter Kunden nach frischem Ansatz

7

2012 2013 2014 2015

> 50 Kunden

Page 8: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Skalierung der Platform

2012 2014 2013

“MVP” Enterprise

Integration / SSO Single Page

JS App Professionalisierung

Build-Umgebung Qualitäts &

Servicemangement

Page 9: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

9

Statische Dokumentation?

• Zu wenig Ressourcen

• Nicht wiederholbar

• Schnell veraltet

Page 10: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Agenda

10

Kopf frei für welches Produkt?

Weshalb Automatisierung?

Wie wurde es mit Jenkins & Ansible umgesetzt?

Was sind die „Lessons Learned“?

Page 11: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Anwendungsfälle

11

DevOps

Code, Build & Test Provision & Deploy WebEx & Trial-Phase

Page 12: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Warum Jenkins & Ansible?

12

Einfach

Erweiterbar

Skalierbar

Flexibel

Open Source

Community

Gute Weboberfläche Einfache Syntax (YAML)

Continuous Integration (CI) & Continuous Delivery (CD)

Zahlreiche Plugins Zahlreiche Module

Verteiltes Build System Pull-Mode anstatt SSH-Push

Konfiguration von Jobs Kapselung durch Rollen

MIT License MIT License

Sehr aktiv (seit 2011) Starkes Wachstum (seit 2012)

Orchestrierung von Admin-Aufgaben

Page 13: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Einbindung in den Gesamtprozess

13

Deploy to Staging

Development Branch

Build Automated

Tests

Business Tests

Merge to Production

Deploy to Production

In Production

GitFlow xUnit + Selenium

GitFlow BrowserStack

Page 14: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Ansible Architektur

14

Tasks

Install Package

Copy file

Apply template

Rollen

Linux Basis

Apache

MySQL

PHP

Application 1

...

Playbooks

Provision DB Server

Deploy Web App

...

Hosts

SVR-DE-TEST

SVR-DE-DEV

SVR-DE-PROD

SVR-US-PROD

Page 15: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Beispiel für Live-Demo

CI Server Webserver

1 Jenkins führt Ansible playbook aus

2 Ansible … installiert Apache auf Linux System … erstellt vhost … deployed HTML-Seite aus template

1

2

Page 16: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Live-Demo

16

Page 17: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Ansible: Ausführung des Playbooks

17

#

# Provisions the demo web server

#

---

- hosts: web

sudo: true

roles:

- {role: 'init'}

- {role: 'apache2'}

- {role: 'webbox'}

/ansible/provision_web.yml

$ ansible_playbook provision_web.yml –I hosts/web -v

Page 18: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Ansible: Apache Rolle (Auszug)

18

[…]

- name: Install Apache

sudo: yes

apt: pkg=apache2 state=latest

- name: Install Apache Modules

command: a2enmod {{item}} creates="/etc/apache2/mods-enabled/{{item}}.load"

notify: restart apache

with_items: apache_modules

[…]

/ansible/roles/apache2/tasks/install.yml

Page 19: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Ansible: Hosts Datei

19

#

# Gruppe mit Hosts (DNS-Name & Parameter)

#

[web]

web-box.dev ansible_ssh_user=vagrant […]

web.leanix.net ansible_ssh_user=root

[db]

db-box.dev ansible_ssh_user=vagrant […]

db.leanix.net ansible_ssh_user=root

Roles/apache2/tasks/install.yml

Page 20: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Agenda

20

Kopf frei für welches Produkt?

Weshalb Automatisierung?

Wie wurde es mit Jenkins & Ansible umgesetzt?

Was sind die „Lessons Learned“?

Page 21: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Erste Hürden und Problemlösungen

21

• Ansible v1 nicht unter Windows

• Für bestimmte Tasks müssen Bilbliotheken auf Ziel-Maschine vorhanden sein

• Parallele Ausführung führt zu Locking von Packetmanagern

Nutzung via Vagrant

In Tasks bzw. Rollen check auf Installierte Pakete Erst prüfen, ob Paket installiert werden muss

Page 22: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Was haben wir davon?

22

20 Tage

3 Std

30 Min

Aufwand für die Einrichtung, Lernen, Stolperfallen von Ansible & Jenkins

Ramp-Up eines neuen Mitarbeiters bis zum ersten Commit

Zeit bis ein neuer leanIX Node „from scratch“ produktiv ist (bei installiertem OS)

Page 23: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

23

DANKE! Follow us @leanix_net

Download Beispiel Code github.com/leanix/codetalks_2014_demo

Zu kompliziert??? - Bei LeanIX moderne Anwendungen für Unternehmen entwickeln!

[email protected]

Page 24: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Backup

24

Page 25: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

leanIX integriert sich in ein Ökosystem für modernes IT Management

25

Collaboration- & Document Mgmt

IT Service Management & Help Desk

Requirements- & Business Process Mgmt

Project Portfolio- and Ressource-Management

Selected products to illustrate

Out-of-the-box Integrationen

REST API & SDKs

developer.leanix.net

Page 26: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Verständliche Reports und flexible Sichten ermöglichen eine umfassende IT Transparenz

26

Heatmaps Roadmaps Costs Metrics

Application Landscape

Interface Landscape

Application Sourcing Map

Application Roadmap

Technology Vendor Support

Project Roadmap

Operations Cost by Capability

Operations Cost by Provider

Project Cost & Status

Application Portfolio

Application Lifecycle Development

Application Age Structure

Page 27: CodeTalks Vortrag: Automatisierung mit Ansible & Jenkins (LeanIX GmbH)

Nahtlose Einbindung der Geschäftsprozesse sichert Visibilität bei den Fachseiten

27

Sync