Extending Ansible - Rishabh Das - E-Book

Extending Ansible E-Book

Rishabh Das

0,0
26,39 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Discover how to efficiently deploy and customize Ansible in the way your platform demands

About This Book

  • Get the first book on the market that maximizes the functionalities of Ansible
  • Master the skill of extending Ansible by deep diving into its modules and plugins
  • Work through this step-by-step guide to customizing Ansible according to your requirements

Who This Book Is For

This book is perfect for developers and administrators who are familiar with Ansible and Python programming, but have no knowledge of how to customize Ansible.

What You Will Learn

  • Get a thorough understanding of Ansible modules
  • Find out everything about plugins that fit in the Ansible architecture
  • Get to grips with designing modules and handling errors
  • Work with data structures
  • Distribute Ansible extensions using PyPi and Git submodules
  • Get to know the various distribution methods of modules and plugins

In Detail

Ansible is an IT automation tool that lets you manage your Infrastructure as a Code. It helps you deploy your applications and manage configurations, thus making life easier. Ansible, in most ways, is self sufficient to address most of your requirements.

Ideally, standard modules, libraries, or plugins are used to automate a given IT platform. Customizing Ansible can be done by custom module and plugin development.

This book shows you how to automate most of the tasks in your IT environment, thus minimizing the need to manually perform scheduled tasks and extend your Ansible implementation by developing customized modules and plugins.

You'll begin by getting an understanding of the fundamental aspects of extending the Ansible framework, such as custom functions and reusable modules. You'll then progress to building custom plugins and extensions using the fundamental building blocks explained earlier. We'll also show you how to automate some tasks using scripts. Finally, we'll demonstrate how these extensions can be seamlessly integrated into existing Ansible installations and explain how to conduct unit testing on these extensions to ensure they work as desired.

Style and approach

This book is a learning book on the fundamentals of Ansible framework and how it can be leveraged to extend it using the modules and plugins.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 120

Veröffentlichungsjahr: 2016

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Extending Ansible

Extending Ansible

Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: March 2016

Production reference: 1210316

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78217-500-1

www.packtpub.com

Credits

Author

Rishabh Das

Reviewer

Xiang Zhang

Commissioning Editor

Veena Pagare

Acquisition Editor

Subho Gupta

Content Development Editor

Divij Kotian

Technical Editor

Vivek Pala

Copy Editor

Lauren Harkins

Project Coordinator

Nikhil Nair

Proofreader

Safis Editing

Indexer

Tejal Soni

Graphics

Kirk D'Penha

Production Coordinator

Melwyn D'sa

Cover Work

Melwyn D'sa

About the Author

Rishabh Das, presently working with Red Hat India, is responsible for managing and maintaining the CI/CD workflow and infrastructure for his team. He has more than 3 years of industry experience and has extensive hands-on experience with Ansible. You can reach Rishabh on Twitter at @rshbhdas.

This book would have not seen the light of day without the support of many individuals—both known and unknown. I would like to express my gratitude to the Ansible and Python communities for making my life easier. Thank you to everyone who is part of this open source community for all the amazing work that you do.

I would like to thank my colleagues who helped me out at each step with their varying abilities. I couldn't have asked for more encouragement and support. Thank you for all the awesome projects you work on, giving me an opportunity to learn, explore, and push my limits.

Thanks to my friends and family, who have always been there no matter the time, situation, or place. Thanks for all the things you have done, for all the ideas you pitched in, for my craziness that you put up with, and for all the compromises you made to help me finish off what I started.

Lastly, but most importantly, I want to specially thank my father, who every single day, checked on my progress. I couldn't have reached this far without you. Thank you ma and baba.

About the Reviewer

Xiang Zhang is a systems engineer working for SINA. He has expertise in Python and has put Ansible in use to manage several thousand servers at work.

SINA is a NASDAQ-listed company and the parent company of Weibo, another NASDAQ-listed company.

www.PacktPub.com

eBooks, discount offers, and more

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Preface

With most companies moving to the cloud, infrastructure needs are growing exponentially. The growing data and massive computing power required to store, analyze, and process this data adds to the infrastructure needs. With the endlessly increasing number of Internet service users and the enormous inflow of data accompanied by a race for data mining, big data and cloud services have opened up new data centers and expanded upon the existing ones. Also, with constantly scaling infrastructure and increasing demands, with the 99.9% uptime promises to keep, automated management of infrastructure became the need of the hour. DevOps soon became a necessity and the market has flooded with DevOps tools. Ansible is one such open source solution that combines orchestration, configuration management, and application deployment capabilities in one.

Ansible is an IT automation tool that lets you manage your Infrastructure as Code. It helps you deploy your applications and manage configurations, thus making life easier. It is an open source project built on Python and has great community support. Ansible, in most ways, is sufficient to address most of your requirements. With a number of modules and plugins available, Ansible makes everything look so easy. Writing and understanding playbooks is smooth.

This book is aimed at advanced users who already have a working knowledge of Ansible, we will discuss various extension points that are exposed by Ansible and how they can be exploited to fit our requirements. This book covers in detail the Ansible Python API, Ansible modules, and Ansible plugins. In this book—by means of real-life scenarios—demonstrates how Ansible can be extended to meet your requirements. This will take you through a step-by-step process of how you can fill in the gaps and become a master of Ansible.

What this book covers

Chapter 1, Getting Started with Ansible, is an introductory chapter that introduces you to Ansible and encourages you to become a power user. It introduces you to the Ansible architecture and gives you a reason to chose Ansible as an infrastructure and configuration management tool.

Chapter 2, Getting to Know Ansible Modules, covers the basics of writing an Ansible module. It introduces you to the AnsibleModule boilerplate. This chapter also helps you develop sample Ansible modules in Bash and Python.

Chapter 3, Digging Deeper into Ansible Modules, introduces you to handling arguments in an Ansible Module. It also takes you through a scenario of collecting information about the infrastructure by developing a custom Ansible module.

Chapter 4, Exploring API, covers in detail the Python API for Ansible, running Ansible programmatically, and discusses the various extension points provided by Ansible. It discusses topics such as Plugin Loader, Runner, Playbooks, and Callbacks in depth.

Chapter 5, An In-Depth Look at Ansible Plugins, covers different plugins from the code level. It also demonstrates how you can write your own Ansible plugin through a few examples.

Chapter 6, Fitting It All Together – Integration, covers various configuration options for Ansible, thus allowing the user to get the most out of the tool. This chapter introduces you to Ansible Galaxy, a platform for sharing roles. It takes the reader through the process of contributing to Ansible and distributing their modules and plugins.

Chapter 7, Becoming a Master – A Complete Configuration Guide, contains real-life scenarios where one can exploit the power of Ansible to perform the required tasks. Also contains scenarios where one can go a step ahead from using Ansible as an Infrastructure and configuration management tool.

What you need for this book

To get the most out of this book, you need the following:

Linux distribution (Fedora/Ubuntu)AnsiblePython

Who this book is for

This book is perfect for developers and administrators who are familiar with Ansible and Python programming but have no knowledge of how to customize Ansible.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "A path specified by the library variable in the configuration file, located at /etc/ansible/ansible.cfg."

A block of code is set as follows:

[default] exten => s,1,Dial(Zap/1|30) exten => s,2,Voicemail(u100) exten => s,102,Voicemail(b100) exten => i,1,Voicemail(s0)

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

[default] exten => s,1,Dial(Zap/1|30) exten => s,2,Voicemail(u100) exten => s,102,Voicemail(b100) exten => i,1,Voicemail(s0)

Any command-line input or output is written as follows:

# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample /etc/asterisk/cdr_mysql.conf

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "By using the Add a Role option from the menu and supplying the required credentials, Galaxy will import the role from your GitHub repository and make it available on the Galaxy platform for the entire community."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

Log in or register to our website using your e-mail address and password.Hover the mouse pointer on the SUPPORT tab at the top.Click on Code Downloads & Errata.Enter the name of the book in the Search box.Select the book for which you're looking to download the code files.Choose from the drop-down menu where you purchased this book from.Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR / 7-Zip for WindowsZipeg / iZip / UnRarX for Mac7-Zip / PeaZip for Linux

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at <[email protected]>