Introduction to Ansible

Slides:



Advertisements
Similar presentations
Optinuity Confidential. All rights reserved. C2O Configuration Requirements.
Advertisements

Hands-On Microsoft Windows Server 2003 Chapter 2 Installing Windows Server 2003, Standard Edition.
1#Dynatrace QCon London 2015 Martin Etmajer, Technology Dynatrace Deploying On-Prem as SaaS Why we go with Ansible.
MCTS Guide to Microsoft Windows Server 2008 Network Infrastructure Configuration Chapter 8 Introduction to Printers in a Windows Server 2008 Network.
MCTS Guide to Microsoft Windows Server 2008 Network Infrastructure Configuration Chapter 7 Configuring File Services in Windows Server 2008.
Patch Management Module 13. Module You Are Here VMware vSphere 4.1: Install, Configure, Manage – Revision A Operations vSphere Environment Introduction.
Project Implementation for COSC 5050 Distributed Database Applications Lab1.
Securing LAMP: Linux, Apache, MySQL and PHP Track 2 Workshop PacNOG 7 July 1, 2010 Pago Pago, American Samoa.
Edu.51cto.com 自动化运维 --Ansible. edu.51cto.com 讲师: Breeze Yan 自动化运维 QQ 群:
Monitoring Scale-Out with the MySQL Enterprise Monitor Andy Bang Lead Software Engineer MySQL-Sun, Enterprise Tools Team Wednesday, April 16, :15.
UNIX ™ /Linux Overview Unix/IP Preparation Course June 9, 2013 Lusaka, Zambia.
STIG Compliance and Remediation with Ansible April 2015.
Module 4: Add Client Computers and Devices to the Network.
© 2010 VMware Inc. All rights reserved Patch Management Module 13.
Sponsored by the National Science Foundation Configuration Management For Experimenters: Ansible Hands-On Sarah Edwards, GPO.
Module 14: WCF Send Adapters. Overview Lesson 1: Introduction to WCF Send Adapters Lesson 2: Consuming a Web Service Lesson 3: Consuming Services from.
1 Apache. 2 Module - Apache ♦ Overview This module focuses on configuring and customizing Apache web server. Apache is a commonly used Hypertext Transfer.
GNU Compiler Collection (GCC) and GNU C compiler (gcc) tools used to compile programs in Linux.
The Professional Open Source™ Company CLI Shell JBossNetwork Enterprise Manager Command Line Interface.
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
Ansible with vCloud Air Workshop
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
CSE 548 Advanced Computer Network Security Trust in MobiCloud using Hadoop Framework Updates Sayan Cole Jaya Chakladar Group No: 1.
CRaSH Portal Team. 2 Agenda Introduction to CRaSH Deployment and connection Using the CRaSH command Develop the CRaSH commands yourself.
Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration.
Database server Campus-Booster ID : ****** Copyright © SUPINFO. All rights reserved MySQL.
Sponsored by the National Science Foundation Today’s Exercise.
© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1.
IBM Express Runtime Quick Start Workshop © 2007 IBM Corporation Deploying a Solution.
VMware Certified Professional 6-Data Center Virtualization Beta 2V0-621Exam.
Automating Legacy Network Devices
Ansible and Ansible Tower 1 A simple IT automation platform November 2015 Leandro Fernandez and Blaž Zupanc.
Vmware 2V0-621D Vmware Exam Questions & Answers VMware Certified Professional 6 Presents
Let's build a VMM service template from A to Z in one hour Damien Caro Technical Evangelist Microsoft Central & Eastern Europe
Microsoft Installing & Configuring Windows Server Exam Questions Answers Powered By:
Introduction to Ansible
TAKING THE OPENSTACK JOURNEY WITH CONFIDENCE
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com SSH Thomas Petazzoni Free.
Ansible Configuration management tool and ad hoc solution
Introduction to Ansible
Patch Management Module 13.
Configuration Management using Ansible
@ Bucharest DevOps Hacker Meetup
Essentials of UrbanCode Deploy v6.1 QQ147
Open OnDemand: Open Source General Purpose HPC Portal
Site Administration Tools: Ansible
Modernize Your Operations
Efficient development and deployment of Hydra projects using Vagrant
COP 4343 Unix System Administration
Chapter 5 Linux Services
on behalf of the NRC-KI Tier-1 team
IT Atoumation / Conf. Mgmt...
CompTIA Linux+ Powered by LPI 2 LX0-104 Dumps PDF LX0-104 Dumps LX0-104 Braindumps LX0-104 Question Answers LX0-104 Study Material.
Intro to Config Management Using Salt Open Source
Ansible and Zabbix Rushikesh Prabhune (Software Technical Consultant)
Automating an Open Source Hypervisor
Microsoft Ignite NZ October 2016 SKYCITY, Auckland.
Ansible for Easy Provisioning and Application Deployment
Scaling Experiments.
Introduction to Ansible
Presented By - Avinash Pawar
GBIF CESP Workshop, Madrid 2018 Dave Martin
APPLICATION LIFECYCLE MANAGEMENT(ALM) QUALITY CENTER(QC)
Cloud Computing.
Module P3 Practical: Building a webapp in nodejs and
APPLICATION LIFECYCLE MANAGEMENT(ALM) QUALITY CENTER(QC)
Jerald Overstreet, GISP Server Portal SQL Manager Admin
VirgoStaging Status F.Carbognani, S. Cortese, E. Pacaud.
Securing IaaS in the cloud
Presentation transcript:

Introduction to Ansible yench

What is ansible Anisble @ github : a radically simple IT automation system Configuration management Deployment Multi-node orchestration

Control host Ansible on Freebsd Ports : make install @ /usr/ports/sysutils/ansible Pkg : pkg install ansible Dependency :

ANSIBLE’S HERE Managed nodes Ansible on Freebsd Only need ssh daemon and python 2.6~7 ! ANSIBLE’S HERE

A new Security Advisory of Postfix! HOW IT WORKS You got an e-mail : A new Security Advisory of Postfix! Solution : upgrade it SSH Mail 1 SSH Mail 2 Admin SSH CORE 1

Detect affected nodes : HOW IT WORKS Detect affected nodes : Mail Servers SSH Mail 1 SSH Mail 2 Admin SSH CORE 1

HOW IT WORKS inventory SSH Mail 1 SSH Mail 2 Admin SSH CORE 1 # /usr/local/etc/ansible/hosts [mailserver] mail[1:2].mango.hot [cores] core1.mango.hot SSH Mail 1 SSH Mail 2 Admin SSH CORE 1

HOW IT WORKS inventory ERROR! Permission denied module SSH Mail 1 $ ansible mailserver \ –m shell \ -a ‘pkg upgrade -y postfix’ SSH Mail 2 Admin SSH CORE 1

HOW IT WORKS inventory module Challenge Accepted ssh key SSH Mail 1 Admin SSH CORE 1

HOW IT WORKS inventory module ssh key SSH Mail 1 SSH Mail 2 Admin mail1.mango.hot | SUCCESS | rc=0 >> Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. ...... SSH CORE 1

Inventory – basic Default location: /path/to/ansible/hosts Basic usage [group] domain.name:port variable=value Example : [mailserver] mail1.mango.hot:2222 service_type=MTA mail2.mango.hot:2222 service_type=MDA

Inventory – basic Pattern Alias core[1:6].mango.hot [a:z].ftp.mango.hot Alias [group] $(alias_name) ansible_port=$(port_num) ansible_host=$(host) Example : [cores] ace ansible_port=5566 ansible_host=core1.mango.hot

Inventory – host variables Assign variables to hosts that will be used in playbooks Example : mail3.mango.hot:2222 service_type=MUA Then in playbooks : tasks: - name: “Mail User Agent : nginx server for web mail client" pkgng: name=nginx state=present when: service_type==MUA

Inventory – group variables [group_Mail] # define a group of hosts mail[1:3].mango.hot [group_Mail:vars] # set variables on all hosts of this group fail2ban_duration=168 [metagroup_workstation:children] # define a group of two groups group_Linux group_BSD [metagroup_workstation:vars] # set variables on all groups of this meta group service_type=workstation login_limit=none

Inventory – ansible variables Ansible varibles ( started with ansible_ ) ansible_host The name of the host to connect to, if different from the alias you wish to give to it. ansible_port The ssh port number, if not 22 ansible_user The default ssh user name to use. ansible_ssh_pass The ssh password to use (this is insecure, we strongly recommend using --ask-pass or SSH keys) ansible_ssh_private_key_file Private key file used by ssh. Useful if using multiple keys and you don’t want to use SSH agent. http://docs.ansible.com/ansible/intro_inventory.html#list-of-behavioral-inventory-parameters

Inventory – ansible variables Ansible varibles ( started with ansible_ ) ansible_become Equivalent to ansible_sudo or ansible_su, allows to force privilege escalation ansible_become_method Allows to set privilege escalation method ansible_become_user Equivalent to ansible_sudo_user or ansible_su_user, allows to set the user you become through privilege escalation ansible_become_pass Equivalent to ansible_sudo_pass or ansible_su_pass, allows you to set the privilege escalation password http://docs.ansible.com/ansible/intro_inventory.html#list-of-behavioral-inventory-parameters

Module Modules are the ones that do the actual work in ansible. Example in ad-hoc : $ ansible pongserver -m ping $ ansible webserver \ -m service -a ‘name=httpd state=started’ Example in playbook : # playbook.yml - hosts: webserver tasks: - name: keep httpd service running service: name=httpd state=started

Module Pkgng module : parameter required default choices annotation (added in 1.6) no cached yes chroot (added in 2.1) name pkgsite rootdir state present absent http://docs.ansible.com/ansible/list_of_all_modules.html

Module – setup One of the most useful module “setup” module $ ansible localhost -m setup localhost | SUCCESS => { "ansible_facts": { "ansible_all_ipv4_addresses": [ "192.168.64.111" ], "ansible_all_ipv6_addresses": [ "fe80::20c:29ff:fed5:cec0" "ansible_architecture": "x86_64", "ansible_bios_date": "07/02/2015", "ansible_bios_version": "6.00", "ansible_cmdline": { "BOOT_IMAGE": "/vmlinuz-linux", "quiet": true, "root": "UUID=2ab96c0b-fbc4-41bc-9b4a-8cefb1c937e5",

Ad-hoc ansible <host-pattern> [-m module_name] [-a args] [options] -a The ARGUMENTS to pass to the module. -m Execute the module called NAME. -b Use privilege escalation --ask-pass --ask-become-pass -f Level of parallelism.

Playbook Playbooks are Ansible’s configuration, deployment, and orchestration language. Usage: $ansible-playbook example_playbook.yml Example playbook #example_playbook.yml (YAML format) - hosts: workstation remote_user: root # by default tasks: - name: mail configuration copy: src: /etc/ansible/config/mail_relay.cfg dest: /usr/local/etc/postfix/main.cf

Playbook – trigger and handler tasks: - name: mail configuration copy: src: /etc/ansible/config/mail_relay.cfg dest: /usr/local/etc/postfix/main.cf notify: - restart postfix handlers: name: restart postfix service: name=postfix state=restarted

Playbook – trigger and handler tasks: - name: mail configuration copy: src: /etc/ansible/config/mail_relay.cfg dest: /usr/local/etc/postfix/main.cf notify: - restart postfix meta: flush_handler - mail: to=root@localhost subject=“Test mail”

Playbook – conditional tasks: - name: “FreeBSD: install openldap” pkgng: name=openldap state=present when: ansible_os_family == “FreeBSD“ - name: “Archlinux: install openldap” pacman: name=openldap state=present when: ansible_os_family == “Archlinux“

Playbook – conditional when: condition_a and condition_b when: (condition_a and condition_b) or condition_c when: var is defined when: var is undefined when: boolean_var when: not Boolean_var

Playbook – loop - name: add users user: name={{ item }} state=present groups=wheel with_items: - user1 - user2 - command: echo {{ item }} with_items: [ 0, 2, 4, 6, 8, 10 ] when: item > 5

Role # structure of roles roles/ common_role/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/ second_role/ … If roles/x/tasks/main.yml exists, tasks listed therein will be added to the play. If roles/x/handlers/main.yml exists, handlers listed therein will be added to the play. If roles/x/vars/main.yml exists, variables listed therein will be added to the play. If roles/x/meta/main.yml exists, any role dependencies listed therein will be added to the list of roles (1.3 and later).

Role # structure of roles roles/ common_role/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/ second_role/ … - hosts: mailserver roles: - core_machine - mail_service - { role: ldap_service, ldap_type: slave }

Ansible Galaxy