Introduction to Ansible

Slides:



Advertisements
Similar presentations
About Me CTO, Individual Digital, Inc. (Startup) Author of ext/tidy, PHP 5 Unleashed, Zend Ent. PHP Patterns
Advertisements

Reproducible Environment for Scientific Applications (Lab session) Tak-Lon (Stephen) Wu.
Talend 5.4 Architecture Adam Pemble Talend Professional Services.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Microsoft Windows 2003 Server. Client/Server Environment Many client computers connect to a server.
Partner Logo German Cancio – WP4-install LCFG HOW-TO - n° 1 WP4 hands-on workshop: EDG LCFGng exercises
SCRAM Software Configuration, Release And Management Background SCRAM has been developed to enable large, geographically dispersed and autonomous groups.
Chapter 2 Applying Practical Automation Speaker : Chuang-Hung Shih Date :
Sponsored by the National Science Foundation Configuration Management For Experimenters: Ansible Hands-On Sarah Edwards, GPO.
Software Engineering CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Cloud Standard API and Contextualization
Ansible with vCloud Air Workshop
Wordpress with Mina Automated Deployment Solution Jonathan Gravato DIG 4104c.
Networking in Linux. ♦ Introduction A computer network is defined as a number of systems that are connected to each other and exchange information across.
Sponsored by the National Science Foundation Today’s Exercise.
Installing Applications in FreeBSD lctseng. Computer Center, CS, NCTU 2 Before we start  Permission issue root: the super user Like administrator in.
IBM Express Runtime Quick Start Workshop © 2007 IBM Corporation Deploying a Solution.
Automating Legacy Network Devices
Ansible and Ansible Tower 1 A simple IT automation platform November 2015 Leandro Fernandez and Blaž Zupanc.
Cloud Installation & Configuration Management. Outline  Definitions  Tools, “Comparison”  References.
Introduction to Ansible
Linux Basics Part 2. VIM Editor vi improved Installed on most Linux machines Can be a bit confusing at first... o Cheat sheets FTW Other popular editors:
April 1st, 2009 Cobbler Provisioning Made Easy Jasper Capel.
Progress Apama Fundamentals
ONAP on Vagrant for ONAPers
Open-O Integration Project Introduction
Stress Free Deployments with Octopus Deploy
Development Environment
Configuration Management using Ansible
@ Bucharest DevOps Hacker Meetup
Project Management: Messages
Essentials of UrbanCode Deploy v6.1 QQ147
SECTION 1: Add-ons to PowerPoint
Modernize Your Operations
AI How to: System Update and Additional Software
Efficient development and deployment of Hydra projects using Vagrant
What are they? The Package Repository Client is a set of Tcl scripts that are capable of locating, downloading, and installing packages for both Tcl and.
Introduction to Ansible
GLAST Release Manager Automated code compilation via the Release Manager Navid Golpayegani, GSFC/SSAI Overview The Release Manager is a program responsible.
IT Atoumation / Conf. Mgmt...
Deploying and Configuring SSIS Packages
Configuration Management
June 2011 David Front Weizmann Institute
Intro to Config Management Using Salt Open Source
Ansible and Zabbix Rushikesh Prabhune (Software Technical Consultant)
INSTALLING AND SETTING UP APACHE2 IN A LINUX ENVIRONMENT
What Is Sharepoint? Mohsen Ashkboos
TRANSLATORS AND IDEs Key Revision Points.
Microsoft Ignite NZ October 2016 SKYCITY, Auckland.
Ansible for Easy Provisioning and Application Deployment
Scaling Experiments.
Number and String Operations
asset: Academic Survey System & Evaluation Tool
Introduction to Ansible
Introduction to .NetTiers
Microsoft Virtual Academy
Presented By - Avinash Pawar
GBIF CESP Workshop, Madrid 2018 Dave Martin
In this session… Introduce what we’re talking about
Cloud Computing.
JENKINS TIPS Ideas for making your life with Jenkins easier
Module P3 Practical: Building a webapp in nodejs and
SUSE Linux Enterprise Desktop Administration
Deploying Your First Full Stack Application to the Cloud
Periodic Processes Chapter 9.
Configuration management suite
NAVIGATING THE MINEFIELD
Introduction to Docker
Preparing for the Windows 8.1 MCSA
Presentation transcript:

Introduction to Ansible Anthony Critelli Introduction to Ansible

Introduction to Ansible But first: There’s a live demo Sign up for info at: demo.acritelli.com If you’re already pretty comfortable with Ansible, please leave room for others I only have 20 demos Introduction to Ansible

Introduction to Ansible Overview Introduction to Ansible

Automation and Config Management Need ways to quickly and consistently deploy infrastructure Back in the day: bash, Perl scripts, and duct tape Today: standard tools, such as Puppet, Chef, Ansible, AWS CloudFormation, etc. Abstract away the underlying commands If the syntax of yum were to suddenly change, you wouldn’t have to update all of your scripts Manage the config – check into a repo, code review, etc. Introduction to Ansible

Infrastructure as Code Everything about a piece of infrastructure is codified In a human-readable format Easier to maintain state Easier to backup/recover Instead of backing up an entire VM, why not just back up the end-state configuration? Infrastructure code can be peer-reviewed, checked into repositories, etc. This continues to get easier as more services expose an API to administrators Introduction to Ansible

Introduction to Ansible What is Ansible? “Simple IT Automation” Very easy to get up and running Simple architecture – just a control machine for basic deployments Agentless Works over SSH Push-model by default Ansible server connects to managed hosts and executes commands Introduction to Ansible

Introduction to Ansible YAML YAML Ain’t Markup Language (YAML) Data serialization language Simple and straightforward syntax Used for expressing Ansible playbooks Introduction to Ansible

A quick note about documentation The Ansible docs are great Intro tutorials Module documentation Lots of examples Also read the best practices Particularly useful for larger projects Introduction to Ansible

Introduction to Ansible Technical Details Introduction to Ansible

Introduction to Ansible So, how does it work? Playbooks are executed against hosts (inventory) The playbooks contain a series of tasks Tasks are units of work/configuration policy Use modules to accomplish their goal Modules are “reusable, standalone scripts” Ex: The “get_url” module downloads a file via HTTP, HTTPS, or FTP and places it on a host Introduction to Ansible

Introduction to Ansible Inventory Hosts are defined in an inventory file INI-like format /etc/ansible/hosts You can group hosts together Define all of your webservers under one header Hosts or groups of hosts can have their own variables Ex: We want all servers in our NY datacenter to use a certain syslog server Dynamic inventory – automatically pull inventory from an external source, such as AWS Introduction to Ansible

Introduction to Ansible Sample inventory [webservers] 10.100.0.101 web02.example.com [databases] db-[a:f].example.com [rochester:swillburg] swillserver[01:20].rochester.example.com Introduction to Ansible

Introduction to Ansible Variables Variables can be defined in MANY places The right place depends on your environment But always try to write reusable code Written in YAML syntax Single variables, lists, dictionaries Introduction to Ansible

Introduction to Ansible Variable examples #Single variable webdirectory: /var/www/html/mysite/ #List users: - bob - alice #Dictionary server_params: max_connections: 10 port: 8080 Introduction to Ansible

Introduction to Ansible Facts When Ansible connects to a remote host, it collects information about the host Obtained via the “setup” module Hostname, distro, etc. This information can be accessed in your playbooks Setup module can be turned off Benefits for scalability when you don’t need a system’s facts Introduction to Ansible

Introduction to Ansible Jinja2 Ansible supports templating with Jinja2 Allows you to reference variables in file templates, which are then placed on remote hosts Example: specify certain ntp servers (variable) for hosts in a specific region (rochester:swillburg) Introduction to Ansible

Let’s take a look at a task - name: install ntp yum: pkg=ntp state=present become: yes #Executes task as root user Introduction to Ansible

Introduction to Ansible Handlers Tasks that are executed when a module changes the system Restart a service when a config file is changed Only executed once when called, no matter how many modules call a handler tasks: - name: disable password login lineinfile: path=/etc/ssh/sshd_config line=“PasswordAuthentication no” notify: restart ssh handlers: - name: restart ssh service: name=sshd state=restarted Introduction to Ansible

Introduction to Ansible Tags Tags can also be used to further classify plays and tasks For example: maybe there’s a set of tasks that you want to run separately from the rest of the playbook Example: updating packages and rotating keys Might be in a larger play of many tasks Only need to perform full system update and update SSH keys sometimes Tags can be specified when running Ansible Introduction to Ansible

Introduction to Ansible A simple playbook - hosts: all vars: user: donald tasks: - name: create user user: name={{ user }} createhome=yes - name: update packages yum: name=* state=latest Introduction to Ansible

Cool, so how do we call a playbook? ansible-playbook -i <hostsFile> <playbookName> Executes as the user who is calling the playbook on the control machine Unless you specify a different user in the playbook itself Introduction to Ansible

Introduction to Ansible Roles Best practices indicate that roles should be used in larger deployments Roles specify a special file hierarchy that abstracts imports For example: you might have a webserver role The webserver role, and all of its supporting files (variables, templates, etc.) are stored in a webserver folder Now, you can just specify that a host has the webserver role Allow you to begin describing your infrastructure in a more sensible way I want web01.example.com to be a webserver All webservers should also be “common servers” Introduction to Ansible

Introduction to Ansible Personal Tips Don’t get 100% hung up on best practices The Ansible docs even say that the best architecture is one that works for you But: don’t use that as free license to ignore best practices If you’re stuck, write your script as one large playbook and then break it out later Tag things Great way to organize tasks Good for testing (i.e. tag a set of new tasks that you’re adding to your playbook, then only run those tasks) Introduction to Ansible

Pre-deployment Housekeeping Introduction to Ansible

Prepping an Ansible control server Install Ansible Available through many repositories For RHEL/CentOS: available through EPEL Create an Ansible user Username can be whatever, but I typically call it “ansible” Create an SSH key for the Ansible user Introduction to Ansible

Prepping a server for Ansible Create the Ansible user Give the user passwordless sudo Or whatever methods are necessary to ensure that the Ansible user can execute the appropriate commands over SSH Copy the SSH public key for the Ansible user Password authentication supported but we usually use keys Introduction to Ansible

Introduction to Ansible Let’s do it live Introduction to Ansible

Introduction to Ansible Demo topology Introduction to Ansible

Introduction to Ansible Actual AWS Topology Introduction to Ansible

Introduction to Ansible Demo Code https://github.com/acritelli/NextHopAnsibleDemo Introduction to Ansible

www.acritelli.com critellia@gmail.com Questions? Comments? www.acritelli.com critellia@gmail.com Introduction to Ansible