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

1 Dynamic DNS. 2 Module - Dynamic DNS ♦ Overview The domain names and IP addresses of hosts and the devices may change for many reasons. This module focuses.
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Fundamentals of Python: From First Programs Through Data Structures
Linux Operations and Administration
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
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.
© 2012 IBM Corporation Tivoli Workload Automation Informatica Power Center.
STIG Compliance and Remediation with Ansible April 2015.
Working Out with KURL! Shayne Koestler Kinetic Data.
SKA/KAT SPIN Presentation Software Engineering (!?) Robert Crida.
Sponsored by the National Science Foundation Configuration Management For Experimenters: Ansible Hands-On Sarah Edwards, GPO.
AI project components: Facter and Hiera
An Introduction to IBM Systems Director
1 Apache. 2 Module - Apache ♦ Overview This module focuses on configuring and customizing Apache web server. Apache is a commonly used Hypertext Transfer.
Client – Server Application Can you create a client server application: The server will be running as a service: does not have a GUI The server will run.
Interfaces to External EDA Tools Debussy Denali SWIFT™ Course 12.
Web Automation Testing With Selenium By Rajesh Kanade.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
1 PUPPET AND DSC. INTRODUCTION AND USAGE IN CONTINUOUS DELIVERY PROCESS. VIKTAR VEDMICH PAVEL PESETSKIY AUGUST 1, 2015.
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.
SAN DIEGO SUPERCOMPUTER CENTER Inca Control Infrastructure Shava Smallen Inca Workshop September 4, 2008.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Sponsored by the National Science Foundation Today’s Exercise.
Welcome to Azure App Services! Amie Seisay
Linux Operations and Administration
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.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
Cloud Installation & Configuration Management. Outline  Definitions  Tools, “Comparison”  References.
Sponsored by the National Science Foundation Systematic Experimentation Sarah Edwards GENI Project Office.
Monitoring Dynamic IOC Installations Using the alive Record Dohn Arms Beamline Controls & Data Acquisition Group Advanced Photon Source.
Introduction to Ansible
Michael DeHaan & Adrian Likins Red Hat. What is Func? A way to communicate with all your machines and query or control them over the network. Func uses.
Npush agent deployment Yancy Ribbens
Advanced Computing Facility Introduction
Pulling the Galaxy’s Strings
Introduction to Ansible
Development Environment
Configuration Management using Ansible
@ Bucharest DevOps Hacker Meetup
Essentials of UrbanCode Deploy v6.1 QQ147
© 2002, Cisco Systems, Inc. All rights reserved.
Site Administration Tools: Ansible
Modernize Your Operations
Efficient development and deployment of Hydra projects using Vagrant
Working in the Forms Developer Environment
Infrastructure Orchestration to Optimize Testing
Introduction to Ansible
Consulting Services JobScheduler Architecture Decision Template
IT Atoumation / Conf. Mgmt...
Drupal VM and Docker4Drupal For Drupal Development Platform
CompTIA Linux+ Powered by LPI 2 LX0-104 Dumps PDF LX0-104 Dumps LX0-104 Braindumps LX0-104 Question Answers LX0-104 Study Material.
Solutions: Backup & Restore
Drupal VM and Docker4Drupal as Consistent Drupal Development Platform
Intro to Config Management Using Salt Open Source
Ansible and Zabbix Rushikesh Prabhune (Software Technical Consultant)
Section 1: Introduction to Simics
Microsoft Ignite NZ October 2016 SKYCITY, Auckland.
Ansible for Easy Provisioning and Application Deployment
Scaling Experiments.
Nate Nelson I*LEVEL, Inc.
Presented By - Avinash Pawar
GBIF CESP Workshop, Madrid 2018 Dave Martin
Server Management and Automation Windows Server 2012 R2
Securing IaaS in the cloud
Presentation transcript:

Introduction to Ansible Network Management Spring 2018 Masoud Sadri & Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

Outline Introduction Ansible architecture Technical Details Demo

Outline Introduction Ansible architecture Technical Details Demo

What is the Problem?! Configuration management CM == writing some kind of system state description + Using a tool to enforce that the servers are in that state CLI is vendor dependent NETCONF needs a complicated agent Ansible exposes a domain-specific language (DSL) that you use to describe the state of your servers Can also be used for Deployment and Orchestration

What is Ansible? IT automation, configuration management and provision tool It uses playbooks to deploy, manage, build, test and configure anything from full server environments to website to custom compiled source code for application a text file by YAML Human readable

How Does it Work?

Outline Introduction Ansible architecture Technical Details Demo

Ansible Architecture

Push Based vs. Pull Based Tool like Puppet and Chef are pull based Agents on the server periodically checks for the configuration information from central server (Master) Ansible is push based Central server pushes the configuration information on target servers You control when the changes are made on the servers Ansible has official support for pull mode, using a tool it ships with called ansible-pull.

Push Based vs. Pull Based (cont’d)

Outline Introduction Ansible architecture Technical Details Demo

Host Inventory Ansible can manage only the servers it explicitly knows about. Information about devices is provided by specifying them in an inventory file. Each server needs a name that Ansible will use to identify it. You can use the hostname of the server. Pass additional arguments to tell Ansible how to connect to it. Default location is /etc/ansible/hosts

Inventory Example [tester] test1 ansible_host=127.0.0.1 ansible_port=22 ansible_user=bahador

Ansible Modules Modules (also referred as task plugins or library plugins) are the ones which actually get executed inside playbook These are scripts that come packaged with Ansible and preform some kind of action on a host Example: apt: Installs or removes packages using the apt package manager copy: Copies a file from local machine to the hosts file: Sets the attribute of a file, symlink, or directory service: Starts, stops, or restarts a service

YAML Basics Start of file: --- Comments: # List: - <item> or [<item>, <item>] Dictionary/Mapping: <label>:<value> or {<label>:<value>} Line Folding: >

YAML Example --- #This is a description by YAML name: Ali family: Hosseini Address: Iran > Tehran, … ID:1111 Courses: - course_name: abc course_id: 123 - course_name: xyz course_id: 456

Ansible Playbook Ansible’s configuration, deployment, and orchestration language Written in YAML, declaratively define your configuration A playbook describes which hosts (what Ansible calls remote servers) to configure, and an ordered list of tasks to perform on those hosts. Command to run the playbook: ansible-playbook file.yml

Playbook Structure

Playbook Simple Example --- - name: a test playbook hosts: test1 tasks: - name: check connectivity ping: - name: just a touch command: touch /tmp/123.txt

How Does it Work in Details? Ansible will do the following: 1. Generate a Python script that installs Nginx package 2. Copy the script to web1, web2, and web3 3. Execute the script on web1, web2, and web3 4. Wait for the script to complete execution on all hosts

Notes on Running Playbook Ansible runs each task in parallel across all hosts. Ansible waits until all hosts have completed a task before moving to the next task. Ansible runs the tasks in the order that you specify them.

Handlers Handlers usually run after all of the tasks Handlers are triggered by notify command They run only once, even if they are notified multiple times. If a play contains multiple handlers, the handlers always run in the order that they are defined in the handlers section, not the notification order. The official Ansible docs mention that the only common uses for handlers are for restarting services and for reboots

Handler Simple Example --- - name: a test playbook hosts: test1 handlers: - name: record new command: touch /tmp/new.txt tasks: - name: check connectivity ping: - name: just a touch command: touch /tmp/123.txt notify: record new

Variables The simplest way to define variables is to put a vars section in your playbook with the names and values of variables {{ variable_name }} is substituted by its value To set the value of a variable based on the result of a task, we create a registered variable using the register clause when invoking a module. The value of variable is the dictionary, we can access its fields

Variables Simple Example --- - name: a test playbook hosts: test1 vars: target_file: /tmp/123.txt new_file: /tmp/new.txt handlers: - name: save time shell: echo {{ date_var.stdout }} > {{ new_file }} - name: get time command: date register: date_var notify: save time tasks: - name: just a touch command: touch {{ target_file }} notify: get time

Facts When Ansible gathers facts, it connects to the host and queries it for all kinds of details about the host CPU architecture operating system IP addresses memory info … This information is stored in variables that are called facts, and they behave just like any other variable.

Facts Simple Example --- - name: Test Facts hosts: test1 gather_facts: True tasks: - debug: var=ansible_distribution - debug: var=ansible_architecture - debug: var=ansible_bios_date - debug: var=ansible_devices

Ansible Features Easy-to-Read Syntax: built on top of YAML Agentless: no need for agent installation and management Built on top of Python and hence provides a lot of Python’s functionality Uses SSH for secure connections Follows Push based architecture for sending configurations Very easy and fast to setup, minimal requirements Built-in Modules Ansible modules are declarative; you use them to describe the state you want the server to be in. Modules are also idempotent. It means that it’s safe to run an Ansible playbook multiple times against a server

Outline Introduction Ansible architecture Technical Details Demo

Demo Practical usage of Ansible

References Hochstein, Lorin, and Rene Moser. “Ansible: Up and Running: Automating Configuration Management and Deployment the Easy Way.” O'Reilly Media, Inc., 2017.