DevOps With Ansible, Chef and PowerVC
DevOps With Ansible, Chef and PowerVC
DevOps With Ansible, Chef and PowerVC
Vess Natchev
[email protected]
Power Cloud Team Leader
IBM Systems Lab Services
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 0
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Agenda
• Ansible
• Overview
• Ansible and Power
• How does it work?
• PowerVC-managed environment
• Creating VM images
• Managing deployed VMs
• Ad hoc commands
• Playbooks & Roles
• Chef
• Overview
• Updating AIX with Chef
• Integration with PowerVC
• Resources
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 1
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Ansible - Why Is It So Popular?
• Released 3/2012
• Very fast adoption rate
• Shipped with Fedora
• Available on github
• Open source
• RHEL, Ubuntu, SLES, AIX & more, Python
• Growing community
• Simple!
• Easy Install
• Infrastructure
• SSH
• Quick configuration: “Agentless”
• Registration not required
• No client to install/update/secure
• No ports (SSH)
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 2
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Ansible - Why Is It So Popular?
• Time to value
• Useful
• Don’t have to know how it works
• No scripting required
• Powerful
• Playbooks/Scripting
• Over 400 integrating “modules” including
• Cloud (OpenStack, AWS, KVM, Cloudstack, Softlayer, …)
• Containers (Docker)
• Networks (Open vSwitch, …)
• Write and publish roles
• Ansible Galaxy
• https://galaxy.ansible.com/intro#share
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 3
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Ansible Architecture
• Controller
• RHEL 7.3, Ubuntu, others
• Python 2.6 or later
RHEL 7.3 Ansible
• SSH connection Controller module
• Uses “modules” to configure the desired end state of a server “inventory” SSH Key
• Example: module to copy file or run a shell command
• Modules handle the “state” of the inventory Managed through
RHEL 7.2 server SSH
• Example: file module does not create a directory if directory is there RHEL 7.2 Deployed
RHEL Public
Client?)
7.2 SSH Key
Deployed
• Managed LPARs/VMs “inventory” Client?)
Public SSH Key
• RHEL, Ubuntu, SLES, AIX, others Public SSH Key
• Python 2.6 or later
• Controller SSH public key
• Agentless
• Can be added or removed from inventory (simple IP “file registration”)
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 4
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
How Does It Work? (On Power)
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 5
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
How Does It Work? (On Power)
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 6
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
How Does It Work? (On Power)
• Push controller OS’s SSH public key to client(s)
• Set up (client) inventory file
• # export ANSIBLE_INVENTORY=~/ansible_hosts
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 7
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Ansible and PowerVC Environment
Managed through
Deploy
SSH
RHEL 7.2 image
Controller SSH Public RHEL 7.2 Deployed
Key RHEL VM7.2 Deployed
Client?)
RHEL 7.2 Deployed
Client?)Public SSH Key
Public SSH Key
Public SSH Key
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 8
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Managing deployed VMs with Ansible
• Controller can be installed on RHEL 7.3 LPAR
• Controller SSH public key set up on client OS
• Push key to client (post deploy)
• (Or) set up in test client, capture as image, and deploy
• Add deployed VM’s IP to client inventory on controller
• # export ANSIBLE_INVENTORY=~/ansible_hosts
• (example adding third IP)
• cat ~/ansible_hosts
[managedClients]
9.5.110.116
9.5.110.120
9.5.110.112
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 9
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Ansible “Ad Hoc” Commands
• No script needed
• Examples
• Ping everything in inventory
# ansible all -m ping
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 10
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Playbooks
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 11
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Example Playbook
# cat /logAnsible.yml
---
- name: Log time in /ansible/run.log when this playbook is run on the hosts
hosts: all
become: yes
tasks:
- name: Create directory /ansible
file: path=/ansible state=directory
- name: echo line in /ansible/run.log
shell: echo '--------------------------' >> /ansible/run.log
- name: save system time in /ansible/run.log
shell: date >> /ansible/run.log
- name: echo comment in /ansible/run.log
shell: echo 'Running ansible playbook /logAnsible.yml from' $(hostname --long) >> /ansible/run.log
- name: echo line in /ansible/run.log
shell: echo '--------------------------' >> /ansible/run.log
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 12
IBM Systems Technical © Copyright IBMofCorporation 2017. Technical University/Symposia materials
may
IBM Systems Lab Services — ProvenEvents | ibm.com/training/events
IT Infrastructure Expertise part without the prior written permission IBM.
[email protected] |
not be reproduced in whole or in part without the prior written permission of IBM.
12
Ansible Roles
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 13
IBM Systems Technical © Copyright IBMofCorporation 2017. Technical University/Symposia materials
may
IBM Systems Lab Services — ProvenEvents | ibm.com/training/events
IT Infrastructure Expertise part without the prior written permission IBM.
[email protected] |
not be reproduced in whole or in part without the prior written permission of IBM.
13
Ansible Example of Roles
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 14
IBM Systems Technical © Copyright IBMofCorporation 2017. Technical University/Symposia materials
may
IBM Systems Lab Services — ProvenEvents | ibm.com/training/events
IT Infrastructure Expertise part without the prior written permission IBM.
[email protected] |
not be reproduced in whole or in part without the prior written permission of IBM.
14
Ansible Example of Roles
Execution on
Webservers
Execution on
Fileservers
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 15
IBM Systems Technical © Copyright IBMofCorporation 2017. Technical University/Symposia materials
may
IBM Systems Lab Services — ProvenEvents | ibm.com/training/events
IT Infrastructure Expertise part without the prior written permission IBM.
[email protected] |
not be reproduced in whole or in part without the prior written permission of IBM.
15
AIX and Ansible
• AIX LPARs (VMs) manageable by Ansible deployed with PowerVC
• Same as Linux, Ansible controller’s public SSH key stored in AIX image
• Originally, few Ansible modules worked on AIX but more now such as:
setup, command, script, fetch, file, group, user, stat
• In 2017, AIX development team has been creating and testing AIX playbooks
https://github.com/aixoss/ansible-playbooks
https://github.com/kairoaraujo/ansible-aix-support
• Similar to existing Chef work for AIX (suma, nim, flrtvc, altdisk)
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 16
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
What Is Chef?
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 17
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Chef Overview
• Supported client available on AIX
(https://www.chef.io/blog/2014/12/08/announcing-chef-client-for-ibm-aix/)
• Available since December 8, 2014
• AIX cookbook with multiple resources available from IBM on official Chef
supermarket – https://supermarket.chef.io/cookbooks/aix
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 19
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Chef Components
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 20
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Updating AIX with Chef
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 22
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Updating AIX with Chef: update_by_multibos
Recipe
Execution
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 23
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Updating AIX with Chef: update_by_altdisk
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 24
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Updating AIX with Chef: nimclient
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 25
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Resources in AIX Cookbook
• https://supermarket.chef.io/cookbooks/aix
• Resources currently available:
• inittab • fixes
• subserver (inetd) • volume_group
• tcpservice • logical_volume
• toolboxpackage (install packages from AIX Toolbox for Linux) • filesystem
• chdev • wpar
• pagingspace
• no (network tunables)
• tunables (other tunables like vmo)
• multibos
• chsec
• etchosts
• niminit
• nimclient
• bootlist
• altdisk
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 26
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Integrating Chef with PowerVC
• What is the problem we are trying to solve?
• Automate and reliably repeat post-installation tasks – installing or updating filesets, changing
configuration files, accessing remote resources
• Tasks that would previously be executed via Korn or Bash shell scripts; or via NIM scripts on AIX
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 27
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Requirements and Automation Sequence
• What is required?
• Standard Chef server and Chef workstation configuration (not shown)
• Specific roles, cookbooks and recipes created for AIX VMs (see later slides)
• Operational PowerVC environment that can provision AIX (not shown)
• Includes base cloud-init configuration
• AIX image in PowerVC that has chef-client installed (not shown)
• Chef-specific cloud-init configuration (see later slides)
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 28
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
Chef Server Configuration
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 29
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
PowerVC Configuration
• Image that has AIX, cloud-init, chef-client install and configured has been captured
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 30
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
AIX Configuration
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 31
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
End Result
• Once a standard PowerVC deploy has been performed, the test recipe defined for the role
executes on the new VM
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 32
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.
IBM Systems Lab Services — Power Systems
Automation for DevOps Implementation
Overview Key Features
• IBM will implement a DevOps solution on Power Systems based on a jointly • Install DevOps central server
developed plan with the client. • Configure automation settings
• Integrate DevOps solution with PowerVC (if applicable)
Demonstrate automation of:
Target Audience •
• System configuration
• Clients using AIX, IBM i or Linux on Power that want to implement cloud
• Software packages
• Clients using or investigating DevOps solutions – Chef, Ansible, Puppet
• Patches or fixes
• Security settings
Benefits • Compliance settings
• Get started with lifecycle automation on Power Systems
• Gain experience with DevOps on Power Systems Deliverables
• Quantify the benefits DevOps automation for your IT environment • After the implementation, the details of Automation for DevOps implementation are
documented and skills transfer is provided to the client.
Find a Lab Services Opportunity Manager in your area -> https://ibm.biz/Bd4sLP Part of Power to
Cloud Rewards
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 33
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials may
Future Made |
ibm.com/systems/services/labservices Contact
not be reproduced in whole or in part without us: [email protected]
the prior written permission of IBM.
1
0
IBM Systems Lab Services
Proven expertise to help leaders design, build, and deliver
IT infrastructure expertise for the cognitive era
Call on our team of 1100+ consultants engaging worldwide for:
§ Power Systems
§ Storage and Software Defined Infrastructure
§ z Systems and LinuxONE
§ Systems Consulting
§ Migration Factory
§ Technical Training and Events
Company
[email protected]
www.ibm.com/systems/services/labservices
© Copyright IBM Corporation 2017. Technical University/Symposia materials may not be reproduced in whole or in 34
IBM Systems Technical Events | ibm.com/training/events © Copyright
part without the prior IBMofCorporation
written permission IBM. 2017. Technical University/Symposia materials
may
not be reproduced in whole or in part without the prior written permission of IBM.