Book Image

Mastering Ansible, 4th Edition - Fourth Edition

By : James Freeman, Jesse Keating
Book Image

Mastering Ansible, 4th Edition - Fourth Edition

By: James Freeman, Jesse Keating

Overview of this book

Ansible is a modern, YAML-based automation tool (built on top of Python, one of the world’s most popular programming languages) with a massive and ever-growing user base. Its popularity and Python underpinnings make it essential learning for all in the DevOps space. This fourth edition of Mastering Ansible provides complete coverage of Ansible automation, from the design and architecture of the tool and basic automation with playbooks to writing and debugging your own Python-based extensions. You'll learn how to build automation workflows with Ansible’s extensive built-in library of collections, modules, and plugins. You'll then look at extending the modules and plugins with Python-based code and even build your own collections — ultimately learning how to give back to the Ansible community. By the end of this Ansible book, you'll be confident in all aspects of Ansible automation, from the fundamentals of playbook design to getting under the hood and extending and adapting Ansible to solve new automation challenges.
Table of Contents (18 chapters)
1
Section 1: Ansible Overview and Fundamentals
7
Section 2: Writing and Troubleshooting Ansible Playbooks
13
Section 3: Orchestration with Ansible

Questions

  1. Why is an inventory important to Ansible?

    a) It forms part of Ansible's configuration management database.

    b) It is used to audit your servers.

    c) It tells Ansible which servers to perform automation tasks on.

    d) None of the above.

  2. When working with frequently changing infrastructures (such as public cloud deployments), Ansible users must manually update their inventory on a regular basis. Is this true or false?

    a) True – this is the only way to do it.

    b) False – dynamic inventories were invented for precisely this purpose.

  3. By default, Ansible processes hosts in an inventory in which order?

    a) In alphabetical order

    b) In lexicographical order

    c) In random order

    d) In the order in which they appear in the inventory

  4. By default, Ansible tasks in a simple playbook are executed in which order?

    a) In the order in which they are written, but each task must be completed on all inventory hosts before the next is executed.

    b) In the most optimal order.

    c) In the order in which they are written but only on one inventory host at a time.

    d) Something else.

  5. Which variable type takes the highest priority, overriding all other variable sources?

    a) Inventory variables

    b) Extra variables (from the command line)

    c) Role defaults

    d) Variables source via vars_prompt

  6. What is the name of the special Ansible variables that only exist at runtime?

    a) Special variables

    b) Runtime variables

    c) Magic variables

    d) User variables

  7. If you wanted to access external data from a playbook, what would you use?

    a) A lookup plugin

    b) A lookup module

    c) A lookup executable

    d) A lookup role

  8. What is Ansible's preferred default transport mechanism for most non-Windows hosts?

    a) The REST API

    b) RabbitMQ

    c) RSH

    d) SSH

  9. What can inventory variables be used to do?

    a) Define unique data for each host or group of hosts in an inventory.

    b) Declare your playbook variables.

    c) Define connection parameters for your inventory hosts.

    d) Both (a) and (c).

  10. How can you override the default Ansible configuration on your system?

    a) By creating an Ansible configuration file in any location, and using the ANSIBLE_CFG environment variable to specify this location.

    b) By creating a file called ansible.cfg in the current working directory.

    c) By creating a file in your home directory called ~/.ansible.cfg.

    d) Any of the above.