Publicité
Publicité

Contenu connexe

Publicité
Publicité

Introduction to ansible

  1. Intro to Ansible Dharmit Shah @dharm1t
  2. Who am I? ➔Co-organizer of Ansible Ahmedabad & Docker Ahmedabad ➔Software Engineer @ Red Hat ➔Work on Ansible, CentOS, Docker, Vagrant, Jenkins, etc. ➔I ❤ automation
  3. Agenda ➔What’s the problem? ➔What is Ansible? ➔How does Ansible try to solve it? ➔How is it different from tools in same domain? ➔How to install and use it?
  4. The Problem ➔ Normally dev, staging and prod environments ➔ Numerous systems in each one of them ➔ Webserver, DB, Mail server, Application server etc. ➔ Different setup and multiple systems for each server type ➔ Security update, bug fix, add new system to environment
  5. What is Ansible? ➔Radically simple IT automation engine ➔Automates: ◆ cloud provisioning ◆ configuration management ◆ application deployment ◆ any many other IT needs ➔Uses no agents, so easy to deploy
  6. Ansible style solution and difference ➔ Install Ansible on only one system ➔ SSH access to all other systems ➔ No client process running in any remote system ➔ No daemon process either! ➔ Run a command, sit back and relax
  7. Installation ➔ pip install ➔ dnf install ➔ apt-get install ➔ yum install ansible
  8. Using Ansible ➔Modify /etc/ansible/hosts (aka Inventory file) ➔Put one or more remote systems in the file ➔Public SSH key must exist in authorized_keys on that system ➔Run ansible; it’s that easy!
  9. ➔Modules for almost all OSes ➔Supports Docker, Kubernetes, AWS, Azure, Google Cloud, OpenStack, Rackspace, VMware ➔ansible-vault to store secrets ➔Blue-Green deployment Features
  10. DEMO
  11. ➔ansible localhost -m setup ➔ansible do -m ping ➔ansible do -bu root -m shell -a 'yum install nginx' ➔ansible do -bu root -m yum -a 'name=docker state=installed' ➔ansible do -bu root -m service -a 'name=docker state=started' Simple commands Imagine doing that for every package you want to install.
  12. Ansible Playbooks ➔Configuration, deployment and orchestration language ➔Manage configurations and deployments of remote sys ➔Rolling updates, delegate to other host, interact with monitoring servers and load balancers! ➔Still human readable!
  13. Example $ cat playbook.yml - hosts: do remote_user: root tasks: - name: Install Docker yum: name=docker state=installed - name: Install EPEL yum: name=epel-release state=installed - name: Start & Enable Docker service: name=docker enabled=yes state=started $ ansible-playbook playbook.yml
  14. Thank you!
Publicité