Download presentation
Presentation is loading. Please wait.
1
Automating an Open Source Hypervisor
Matt St. Onge Sr. Partner Solutions Architect, Red Hat GSI Alliances Team @MattTheITGuru Blog:
2
Ansible Review KVM Review Playbook Examples Atom Quick Demo Q&A AGENDA
--- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=started Ansible Review KVM Review Playbook Examples Atom Quick Demo Q&A $] ansible-playbook -i inventory playbook.yml PLAY [install and start apache] *********************************** TASK [Gathering Facts] ******************************************** ok: [webserver.local] TASK [install httpd] ********************************************** changed: [webserver.local] TASK [write the apache config file] ******************************** TASK [start httpd] ************************************************* PLAY RECAP ********************************************************* webserver.local : ok=4 changed=3 unreachable=0 failed=0
3
WHAT IS ANSIBLE AUTOMATION?
--- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=started The Ansible project is an open source community sponsored by Red Hat. It’s also a simple automation language that perfectly describes IT application environments in Ansible Playbooks. Ansible Engine is a supported product built from the Ansible community project. Ansible Tower is an enterprise framework for controlling, securing, managing and extending your Ansible automation (community or engine) with a UI and RESTful API. $] ansible-playbook -i inventory playbook.yml PLAY [install and start apache] *********************************** TASK [Gathering Facts] ******************************************** ok: [webserver.local] TASK [install httpd] ********************************************** changed: [webserver.local] TASK [write the apache config file] ******************************** TASK [start httpd] ************************************************* PLAY RECAP ********************************************************* webserver.local : ok=4 changed=3 unreachable=0 failed=0
4
POWERFUL AGENTLESS SIMPLE
WHY ANSIBLE? POWERFUL AGENTLESS SIMPLE Human readable automation No special coding skills needed Tasks executed in order Usable by every team Get productive quickly App deployment Configuration management Workflow orchestration Network automation Orchestrate the app lifecycle Agentless architecture Uses OpenSSH & WinRM No agents to exploit or update Get started immediately More efficient & more secure
5
WHAT CAN I DO WITH ANSIBLE?
Automate the deployment and management of your entire IT footprint. Do this... Orchestration Configuration Management Application Deployment Provisioning Continuous Delivery Security and Compliance On these... Firewalls Load Balancers Applications Containers Clouds Servers Infrastructure Storage Network Devices And more...
6
WHY IS AUTOMATION IMPORTANT?
Your applications and systems are more than just collections of configurations. They’re a finely tuned and ordered list of tasks and processes that result in your working application. Ansible can do it all: • Provisioning • App Deployment • Configuration Management • Multi-tier Orchestration Combination of configuration and order Configuration Management alone is not sufficient for app deployment Allows you to automate entire sets of process
7
HOW ANSIBLE WORKS MODULES ANSIBLE’S AUTOMATION ENGINE
• Tools in the toolkit • Python, Powershell or any language • Extend Ansible simplicity to entire stack ANSIBLE’S AUTOMATION ENGINE CMDB INVENTORY HOSTS NETWORK DEVICES PLUGINS API PUBLIC / PRIVATE CLOUD USERS ANSIBLE PLAYBOOK HOW ANSIBLE WORKS USERS ANSIBLE PLAYBOOK [web] webserver1.example.com webserver2.example.com [db] dbserver1.example.com ANSIBLE’S AUTOMATION ENGINE CMDB HOSTS NETWORK DEVICES PLUGINS API MODULES PUBLIC / PRIVATE CLOUD INVENTORY ANSIBLE’S AUTOMATION ENGINE CMDB INVENTORY HOSTS NETWORK DEVICES PLUGINS API MODULES PUBLIC / PRIVATE CLOUD USERS ANSIBLE PLAYBOOK PLAYBOOKS • Written in YAML • Tasks are executed sequentially • Invokes Ansible modules CLOUD OpenStack, VMware, EC2, Rackspace, GCE, Azure, Spacewalk, Hanlon, Cobbler CUSTOM CMDB USERS ANSIBLE PLAYBOOK ANSIBLE’S AUTOMATION ENGINE HOSTS NETWORK DEVICES PLUGINS API MODULES PUBLIC / PRIVATE CLOUD INVENTORY CMDB CMDB PUBLIC / PRIVATE CLOUD PLUGINS • Gears in the engine • Python that plugs into the core engine • Adaptability for various uses & platforms USERS ANSIBLE PLAYBOOK ANSIBLE’S AUTOMATION ENGINE HOSTS NETWORK DEVICES API MODULES INVENTORY ANSIBLE’S AUTOMATION ENGINE CMDB USERS INVENTORY HOSTS NETWORK DEVICES PLUGINS API MODULES PUBLIC / PRIVATE CLOUD ANSIBLE PLAYBOOK
8
PLAYBOOK EXAMPLE Playbook example:
--- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: state: started --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: state: started --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: state: started --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: state: started --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: state: started --- - name: install and start apache hosts: web become: yes vars: http_port: 80 tasks: - name: httpd package is present yum: name: httpd state: latest - name: latest index.html file is present copy: src: files/index.html dest: /var/www/html/ - name: httpd is started service: state: started Playbook example: The name fields are human-readable comments. Optional, but useful as comments to the Playbook. These strings also show up in Tower, so it is easy to correlate any failures in a long running Playbook. Inventory call-out Variables can be handled in several different ways: Directly in the playbook As part of a separate vars file Via the command line As output from a previous play Via Tower You are not required to use root as the remote user. You can have Ansible connect and run the playbook as any user or even multiple users – as long as that user has the permission to perform the tasks in the playbook. You can even use multiple users and specify different users for different plays or tasks. Ansible supports sudo, su, powerbroker, and other privilege escalation mechanisms. The real work. General format: <<module>>: key=value
9
ANSIBLE SHIPS WITH OVER 1250 MODULES
CLOUD WINDOWS NETWORK NOTIFY VIRT AND CONTAINER AWS Azure CenturyLink CloudScale Digital Ocean Docker Google Linode OpenStack Rackspace And more... Docker VMware RHEV OpenStack OpenShift Atomic CloudStack And more... ACLs Files Commands Packages IIS Regedits Shell Shares Services Configs Users Domains And more... Arista A10 Cumulus Big Switch Cisco Dell F5 Juniper Palo Alto OpenSwitch And more... HipChat IRC Jabber RocketChat Sendgrid Slack Twilio And more...
10
COMMUNITY
11
docs.ansible.com
12
docs.ansible.com
13
10,000+ ROLES AT YOUR DISPOSAL
Re-usable Roles and Container Apps that allow you to do more, faster Built into the Ansible CLI and Tower galaxy.ansible.com
14
ANSIBLE NETWORK AUTOMATION ansible.com/networking
Use Ansible to manage, validate, and continuously track heterogeneous network device configurations and deployments. Network modules are included as part of the Ansible distribution. 33+ Networking platforms 460+ Networking Modules ansible.com/networking
15
PLAYBOOK EXAMPLE: NETWORK AUTOMATION
--- - name: configure ios interface hosts: ios01 tasks: - name: collect device running-config ios_command: commands: show running-config interface GigabitEthernet0/2 provider: “{{ cli }}” register: config - name: administratively enable interface ios_config: lines: no shutdown parents: interface GigabitEthernet0/2 when: ‘”shutdown” in config.stdout[0]‘ - name: verify operational status commands: - show interfaces GigabitEthernet0/2 - show cdp neighbors GigabitEthernet0/2 detail waitfor: - result[0] contains ‘line protocol is up’ - result[1] contains ‘iosxr03’ - result[1] contains ’ ’
16
ANSIBLE WINDOWS AUTOMATION
Use Ansible to deploy and manage Windows systems and applications. 70+ Windows Modules 350+ Powershell DSC resources ansible.com/windows
17
PLAYBOOK EXAMPLE: WINDOWS
- hosts: new_servers tasks: - name: ensure common OS updates are current win_updates: register: update_result - name: ensure domain membership win_domain_membership: dns_domain_name: contoso.corp domain_admin_user: '{{ domain_admin_username }}' domain_admin_password: '{{ domain_admin_password }}' state: domain register: domain_result - name: reboot and wait for host if updates or domain change require it win_reboot: when: update_result.reboot_required or domain_result.reboot_required - name: ensure local admin account exists win_user: name: localadmin password: '{{ local_admin_password }}' groups: Administrators - name: ensure common tools are installed win_chocolatey: name: '{{ item }}' with_items: ['sysinternals', 'googlechrome']
18
KVM
19
Kernel-based Virtual Machine (KVM)
Open Source Virtualization Managed by libvirt KVM is part of the Linux kernel Uses existing features of the Linux operating system: Security features Memory management Process scheduler Device drivers Network stack
20
VIRTUALIZATION MANAGER
How Can I Manage My KVM Host? VIRTUALIZATION MANAGER Designed for ease of use Full control of configuration options VM creation, Cloning, Snapshots, & more COCKPIT Included as part of Fedora or RHEL Used to configure networking, storage, tuning, subscriptions, and other aspects of the virtualization host Limited VM management capabilities Web UI, and RESTful API Ansible Automation Numerous Modules for usage in playbooks
21
Examples: Ansible Playbook
--- - name: List VMs hosts: hypervisors tasks: name: Get DOWN VM List virt: command: list_vms state: shutdown register: list_down_vms_result debug: var: list_down_vms_result name: Get RUNNING VM List virt: command: list_vms state: running register: list_running_vms_result debug: var: list_running_vms_result
22
Examples: Ansible Playbook
--- - name: Status Checker hosts: hypervisors tasks: name: KVM Node Info Details virt: command: nodeinfo tags: nodeinfo name: Check status of VM(s) virt: command: status name: rhel75test tags: status
23
Examples: Ansible Playbook
name: List KVM Auto-starting VMs hosts: hypervisors tasks: name: autostart | list domains command: virsh list --autostart --name register: libvirt_list_autostart_result debug: var: libvirt_list_autostart_result.stdout
24
Atom Creating an Ansible Playbook - ATOM OpenSource Editor
Windows, Linux & Mac 100’s of Integrations Git Ansible YAML Syntax Line completion Language Intelligence
25
DEMO
26
Q & A
27
THANK YOU plus.google.com/+RedHat facebook.com/redhatinc
linkedin.com/company/red-hat twitter.com/RedHatNews youtube.com/user/RedHatVideos
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.