Chapter 2 - Automating Your IT Infrastructure with Ansible

  1. Ansible is an open source automation platform used for running tasks across an inventory of servers. It differs from a simple shell script in that it will (when using native modules) only attempt to make changes when they are required (hence resulting in a consistent state), and it offers native support for remote connections to other machines (using SSH on Linux) and encryption of sensitive data and makes use of highly readable, self-documenting code.
  2. An Ansible inventory is simply a list of servers against which an Ansible playbook is to be run.
  3. Ansible has built-in features to make it easy to reuse roles—hence, a single role might find application in several playbooks. Conversely, if the code is written in a single large playbook, the only way to reuse the code in a different playbook is to copy and paste, which is both cumbersome and difficult to keep track of (especially when the code is changed in one place).
  4. Jinja2.
  5. Yes—Ansible has a strict and well-documented variable precedence order.
  6. Employing templates will always result in a deployed file that looks the same on all machines. Using search and replace can be tricky, and simple changes to the target file on one machine can break the search pattern in all but the most meticulously designed regular expressions.
  7. Ansible facts can be used to tell Ansible useful information, such as which operating system it is running on—hence, playbooks can be coded to perform different actions on a CentOS and Ubuntu host (for example, using yum on CentOS and apt on Ubuntu).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset