Book Image

Ansible Configuration Management

By : Daniel Hall
Book Image

Ansible Configuration Management

By: Daniel Hall

Overview of this book

<p>Ansible provides a clear and concise way to manage the configuration of your Linux infrastructure. It can help in making your infrastructure more maintainable, quicker to deploy, and easier to understand. <br /><br />"Ansible Configuration Management" will take you from your very first command all the way to extending the very capabilities of Ansible itself. It takes a practical approach with hands-on examples, which ensures that the readers walk away with all the knowledge and skills they will need to harness Ansible.<br /><br />"Ansible Configuration Management" starts with an explanation of the basics and builds the reader’s knowledge through step-by-step guidelines.<br /><br />The book concentrates on discussions related to realistic worked examples. Using this approach we discuss how to perform ad-hoc actions, script actions together to set up services, and how to script more complicated tasks. The discussion carries onto explanation of organising your configurations for large deployments and warps up with examples of how to extend the capabilities of Ansible.<br /><br />"Ansible Configuration Management" provides the knowledge you require to effectively manage your systems in a simple, quick, and maintainable way.</p>
Table of Contents (12 chapters)

Preface

Since CFEngine was first created by Mark Burgess in 1993, configuration management tools have been constantly evolving. Followed by the emergence of more modern tools such as Puppet and Chef, there are now a large number of choices available to a system administrator.

Ansible is one of the newer tools to arrive into the configuration management space. Where other tools have focused on completeness and configurability, Ansible has bucked the trend and, instead, focused on simplicity and ease of use.

In this book, we aim to show you how to use Ansible from the humble beginnings of its CLI tool, to writing playbooks, and then managing large and complex environments. Finally, we teach you how to extend Ansible by writing your own modules.

What this book covers

Chapter 1, Getting Started with Ansible, teaches you the basics of Ansible, how to build an inventory, how to use modules, and, most importantly, how to get help.

Chapter 2, Simple Playbooks, teaches you how to combine multiple modules to create Ansible playbooks to manage your hosts.

Chapter 3, Advanced Playbooks, delves deeper into Ansible's scripting language and teaches you more complex language constructs.

Chapter 4, Larger Projects, teaches you the techniques to scale Ansible configurations to large deployments containing many complicated systems.

Chapter 5, Custom Modules, teaches you how to expand Ansible beyond its current capabilities.

What you need for this book

To use this book, you will need at least the following:

  • A text editor

  • A machine with Linux operating system

  • Python 2.6.x

However, to use Ansible to its full effect, you should have several Linux machines available to be managed. You could use a virtualization platform to simulate many hosts, if required.

Who this book is for

This book is intended for those who want to understand the basics of how Ansible works. It is expected that you have rudimentary knowledge of how to set up and configure Linux machines. In parts of the book, we cover the configuration files of BIND, MySQL, and other Linux daemons; a working knowledge of these would be helpful, but is certainly not required.

Conventions

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

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

[group]
machine1
machine2
machine3

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

tasks:
  - name: install apache
    action: yum name=httpd state=installed

  - name: configure apache
    copy: src=files/httpd.conf dest=/etc/httpd/conf/httpd.conf

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

ansible machinename -u root -k -m ping

New terms and important words are shown in bold.

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 may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via 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 on 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 all Packt books you have purchased 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.

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 would 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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright 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 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

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.