ansible workshop workshop ansible
play

Ansible workshop workshop Ansible The easiest way to: The easiest - PowerPoint PPT Presentation

Ansible workshop workshop Ansible The easiest way to: The easiest way to: orchestrate, deploy and manage orchestrate, deploy and manage http://dag.wiee.rs/attic/ansible-workshop/ http://dag.wiee.rs/attic/ansible-workshop/ NLUUG Spring


  1. Ansible workshop workshop Ansible The easiest way to: The easiest way to: orchestrate, deploy and manage orchestrate, deploy and manage http://dag.wiee.rs/attic/ansible-workshop/ http://dag.wiee.rs/attic/ansible-workshop/ NLUUG Spring Conference, Utrecht, NL NLUUG Spring Conference, Utrecht, NL Jeroen Hoekx, jeroen@hoekx.be Jeroen Hoekx, jeroen@hoekx.be Dag Wieërs, dag@wiee.rs Dag Wieërs, dag@wiee.rs

  2. Booming project Booming project ● Started in February 2012 Started in February 2012 – Well-defined unique selling proposition Well-defined unique selling proposition – Small auditable codebase (back in the day ;-)) Small auditable codebase (back in the day ;-)) ● Very high activity Very high activity – 700+ unique contributors in first 2 years 700+ unique contributors in first 2 years – Has slowed down when maturing Has slowed down when maturing ● Divers use-cases / userbase Divers use-cases / userbase – large dotcoms, hosting providers, universities, large dotcoms, hosting providers, universities, banks, government agencies, consultants, banks, government agencies, consultants, startups, Open Source projects startups, Open Source projects

  3. Compelling features Compelling features ● Uses SSH, no agent Uses SSH, no agent – Self-bootstrapping, no installation Self-bootstrapping, no installation – No extraneous PKI, uses existing authentication/authorization No extraneous PKI, uses existing authentication/authorization ● Swiss army knife Swiss army knife – parallel execution, provisioning, application deployment, configuration parallel execution, provisioning, application deployment, configuration management, orchestration, use-as-a-library, reporting tool, ... management, orchestration, use-as-a-library, reporting tool, ... ● Complex orchestration made easy Complex orchestration made easy – Simple management language (YAML-based !) Simple management language (YAML-based !) – “ “Infrastructure as data” (not as code !) Infrastructure as data” (not as code !) – Multi-tier management, multi-user Multi-tier management, multi-user ● Core written in python Core written in python – Modules can be in any language, interfaces using JSON Modules can be in any language, interfaces using JSON ● Get started in less than 10 minutes Get started in less than 10 minutes

  4. Buzzword compliant Buzzword compliant ● Privilege escalation ● Multi-user Privilege escalation Multi-user – Power to the people ! – sudo, su, powerbroker, … Power to the people ! sudo, su, powerbroker, … ● Module development ● Idempotency Module development Idempotency – Any language supported by Any language supported by – Not enforced, but advised Not enforced, but advised target (python, powershell) (python, powershell) target ● Orchestration Orchestration ● Transports Transports – Control “when”, “what” Control “when”, “what” – local, ssh, chroot, jail, lxc, local, ssh, chroot, jail, lxc, and “where” and “where” winrm, zone, fireball, winrm, zone, fireball, ● Declarative accelerate, funcd accelerate, funcd Declarative ● Integration Integration – Language limits Language limits – Design allows integration at complexity complexity Design allows integration at various levels various levels

  5. Easy to get running Easy to get running ● Requirements: Requirements: – python 2.6, paramiko/openssh, PyYAML, jinja2 python 2.6, paramiko/openssh, PyYAML, jinja2 ● Run or install from checkout Run or install from checkout – git clone git://github.com/ansible/ansible.git git clone git://github.com/ansible/ansible.git – cd ./ansible cd ./ansible 1. source ./hacking/env-setup source ./hacking/env-setup 1. 2. make install make install 2. ● Install distribution package or make your own Install distribution package or make your own 3. make deb make deb / / make rpm make rpm 3.

  6. Setting up demo environment Setting up demo environment Virtual Box KVM and Libvirt Virtual Box KVM and Libvirt ● Copy ● Copy Copy vm-noname.img vm-noname.img to local to local Copy vm-noname.vmdk vm-noname.vmdk to local disk to local disk disk-store (/var/lib/libvirt/images) disk-store (/var/lib/libvirt/images) ● Create a Host-Only network vboxnet0 Create a Host-Only network vboxnet0 ● Create new VM “vm-master” and use it below Create new VM “vm-master” and use it below ● Create new VM “vm-master” – Use “import existing disk image” but Create new VM “vm-master” Use “import existing disk image” but “Browse local” to vm-master.img “Browse local” to vm-master.img – As a Linux guest using Red Hat (32bit) As a Linux guest using Red Hat (32bit) – As a Linux guest using Red Hat EL6 As a Linux guest using Red Hat EL6 – Use 512MB RAM Use 512MB RAM – Use 1 CPU and 512MB RAM Use 1 CPU and 512MB RAM – Use “an existing virtual hard drive file” Use “an existing virtual hard drive file” – Use the “Virtual network 'default': Use the “Virtual network 'default': (vmdk) (vmdk) NAT” NAT” – Modify the VM to use the created Host- Modify the VM to use the created Host- ● Clone this VM as “vm-web Clone this VM as “vm-web Only network vboxnet0 Only network vboxnet0 ● Clone this VM again as “vm-db” ● Clone this VM as “vm-web” Clone this VM as “vm-web” Clone this VM again as “vm-db” ● Start all VMs ● Clone this VM again as “vm-db” Start all VMs Clone this VM again as “vm-db” ● Start all VMs Start all VMs

  7. Everybody ready ? Everybody ready ? ● During this session: During this session: – Documentation available from: Documentation available from: docs.ansible.com docs.ansible.com – Let us know if you need help Let us know if you need help ● To proceed, log on to To proceed, log on to vm-master using SSH vm-master using SSH – Username: Username: root root / Password: / Password: root root – Go inside Go inside ~/workshop/ ~/workshop/ – Edit the Edit the hosts hosts file file – Use the IP addresses from the other VMs Use the IP addresses from the other VMs

  8. Terminology Terminology ● Inventory Inventory – flat file(s), yaml or custom scripts – flat file(s), yaml or custom scripts – Collection of groups, hosts, variables Collection of groups, hosts, variables ● Modules Modules – scripted in any language, using json – scripted in any language, using json – Offers specific functionality used in tasks Offers specific functionality used in tasks ● Plugins Plugins – python scripts – python scripts – action, callback, connection, filter, lookup, ... action, callback, connection, filter, lookup, ... ● Playbooks Playbooks – yaml description – yaml description – Collection of plays Collection of plays ● Collection of tasks Collection of tasks

Recommend


More recommend