Ansible for VMware by Examples : A Step-by-Step Guide to Automating Your VMware Infrastructure

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Learn to use the Ansible open source IT automation tool to automate your VMware infrastructure. This book contains all of the obvious and not-so-obvious best practices of Ansible automation. Each lesson summarizes a specific use case for the modern VMware infrastructure and is focused on a single module from the most important parameter, including live demo of code and real-life usage. You'll configure the Ansible Controller to interact with VMware infrastructure using the “community.VMware” Ansible documentation collection and the appropriate Python libraries. Next, learn how to automate the creation of a virtual machine manually and from a template, start and stop using the shutdown and forced-power off a Virtual Machine, take and delete and snapshot, add a new hard disk and expand a currently attached hard disk, as well as gather information for data centers, clusters, host systems, and virtual machines. By the end of this book, you'll be well-versed in efficiently maintaining a VMware infrastructure with Ansible Automation. You'll also be able to save time and reduce manual errors using simple human-readable automation technology. What You'll Learn Automate your VMware infrastructure using Ansible code Install Ansible in operating systems such as RedHat, Ubuntu, Fedora, etc. Write and execute your first Ansible Playbook code Troubleshoot the most common error messages Who This Book Is For IT professionals of every industry who would like a jargon-free understanding of Ansible technology, including VMware, Linux, and Windows Systems Administrators, DevOps professionals, thought leaders, and infrastructure-as-code enthusiasts.

Author(s): Luca Berton
Publisher: Apress
Year: 2022

Language: English
Commentary: Vmware examples, step by step guide, open source IT automation tool
Pages: 204
Tags: Vmware examples, step by step guide, open source IT automation tool

s
Chapter 1:​ Ansible for Beginners with Examples
What Is Ansible?​
Ansible
Three Main Use Cases
Four Key Tenets of Ansible
Six Values of Ansible
Ansible History
Ansible, Ansible Tower, and the Ansible Automation Platform
Getting Started
Ansible Architecture
Connecting with Managed Nodes
Ansible Installation
Running Ad-Hoc Commands with Privilege Escalation on Ansible
Recap
Inventory
Simple INI Inventory
Simple YAML Inventory
Adding Ranges of Hosts
Hosting in Multiple Groups
Host Variables
Group Variables
Inheriting Variable Values
Using Multiple Inventory Sources
The localhost Inventory
Recap
Playbook
YAML Syntax
helloworld.​yml
Tip 1:​ ansible-playbook –check Option
Tip 2:​ Debug Day-to-Day Usage
Idempotency
multipleplays.​yml
privilege_​escalation.​yml
Common Ansible Modules
Recap
Variables
Not Permitted Variable Names
variableprint.​yml
variableprint.​yml - Extra Variables
Host Variables and Group Variables
Array Variables
array.​yml Execution
Registered Variables
registeredvariab​les.​yml Execution
Filters and Templates
Recap
Facts and Magic Variables
Ansible Facts
Magic Variables
Recap
Vault
Creating an Encrypted File
Viewing an Encrypted File
Editing an Existing Encrypted File
Encrypting an Existing File
Decrypting an Existing File
Changing the Password of an Encrypted File
Playbooks and Ansible Vault
Recap
Conditional
Basic Conditionals with “when”
Conditionals Based on ansible_​facts
Recap
Loop
with_​* Statement
loop_​with_​items.​yml
Recap
Handler
rollingupdate.​yml
Role
Role Tree Directories
Using Ansible Roles in a Playbook
Order of Execution
Ansible Galaxy
Installing Roles from Ansible Galaxy Manually
Installing Roles from Ansible Galaxy requirements.​yml
Collection
Ansible Plugins
Key Takeaways
Chapter 2:​ Installing Ansible
Ansible Community vs.​ ansible-core Packages
ansible-core
The Ansible Community Package
Additional Collections Installation
Installing the community.​vmware Collection via the ansible-galaxy Command
Installing the community.​vmware Collection via the requirements.​yml File
Verifying the Currently Installed Version of community.​vmware
Links
Ansible Installation for RedHat Enterprise Linux (RHEL) 8
Code
Ansible Installation for Ubuntu 22.​04 LTS
Code
Ansible Installation for Fedora 36
Code
Ansible Installation for CentOS 9 Stream
Links
Code
Ansible Installation on Windows
Links
Code
Ansible Installation for macOS
Code
Ansible Installation for SUSE SLES (Linux Enterprise Server) 15 SP3
Links
Code
Ansible Installation with PIP
Code
Ansible Installation for RedHat Enterprise Linux 9
Links
Demo
Ansible Installation for Amazon Linux 2 (AWS EC2)
Links
Code
Ansible Installation for Debian 11
Code
Key Takeaways
Chapter 3:​ Ansible for VMware
Configuring Ansible for VMware
The Ansible vmware.​vmware_​rest Collection
Configuring a Python Virtual Environment for Ansible VMware
Ansible Troubleshooting:​ VMware Failed to Import pyVmomi
Ansible Troubleshooting:​ VMware Unknown Error While Connecting to vCenter or ESXi
Ansible Troubleshooting:​ VMware Certificate Verification Failed Connecting to vCenter or ESXi
Creating a VMware Virtual Machine
Deploying a VMware Virtual Machine from a Template
Starting a VMware Virtual Machine
Stopping a VMware Virtual Machine
Taking a VMware Virtual Machine Snapshot
Deleting a VMware Virtual Machine Snapshot
Adding a New Hard Disk to a VMware Virtual Machine
Expanding a Virtual Disk in a VMware Virtual Machine
Gathering VMware Host Information on a Cluster
Getting a VMware Virtual Machine UUID
Ansible Dynamic Inventory For VMware
Getting a VMware Virtual Machine Running Host
Getting VMware Datastore Status
Uploading a File to the VMware Datastore
Getting the Status of VMware Guest Tools
Upgrading VMware Guest Tools
Live Migration of a VMware Virtual Machine Using vMotion
Changing the Boot Device Order of a VMware Virtual Machine
Key Takeaways
Chapter 4:​ Closing Remarks
Key Takeaways
Index