docs.ansible.com Open in urlscan Pro
2606:4700:20::ac43:44fb  Public Scan

Submitted URL: https://docs.ansible.com/ansible/latest/user_guide/playbooks.html
Effective URL: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks.html
Submission: On July 27 via api from US — Scanned from US

Form analysis 3 forms found in the DOM

GET

<form class="version-dropdown" method="get">
  <script>
    function switchVersionTo(slug) {
      var current_url_path = window.location.pathname;
      var url_version = current_url_path.search("/10/") > -1 ? "/10/" : "/latest/";
      var new_version_url = current_url_path.replace(url_version, "/" + slug + "/");
      window.location.replace(new_version_url);
    }
  </script>
  <label class="sr-only" for="version-list">Select version:</label>
  <select class="version-list" id="version-list" onchange="switchVersionTo(this.value);">
    <option value="latest"> latest </option>
    <option value="9"> 9 </option>
    <option value="2.9"> 2.9 </option>
    <option value="devel"> devel </option>
  </select>
</form>

GET

<form id="rtd-search-form" class="wy-form" method="get">
  <label class="sr-only" for="q">Search docs:</label>
  <input type="text" class="st-default-search-input" id="q" name="q" placeholder="Search docs" autocomplete="off" autocorrect="off" autocapitalize="off">
  <input type="hidden" name="check_keywords" value="yes">
  <input type="hidden" name="area" value="default">
</form>

<form>
  <input class="st-default-search-input st-search-set-focus" type="text" value="" placeholder="Search this site" aria-label="Search this site" id="st-overlay-search-input" autocomplete="off" autocorrect="off" autocapitalize="off">
</form>

Text Content

 * Blog
 * Ansible community forum
 * Documentation

Ansible Community Documentation
Ansible
10
Select version: latest 9 2.9 devel
Search docs:

Ansible getting started

 * Getting started with Ansible
 * Getting started with Execution Environments

Installation, Upgrade & Configuration

 * Installation Guide
 * Ansible Porting Guides

Using Ansible

 * Building Ansible inventories
 * Using Ansible command line tools
 * Using Ansible playbooks
   * Ansible playbooks
   * Working with playbooks
     * Templating (Jinja2)
     * Using filters to manipulate data
     * Tests
     * Lookups
     * Python3 in templates
     * The now function: get the current time
     * The undef function: add hint for undefined variables
     * Loops
     * Controlling where tasks run: delegation and local actions
     * Conditionals
     * Blocks
     * Handlers: running operations on change
     * Error handling in playbooks
     * Setting the remote environment
     * Working with language-specific version managers
     * Re-using Ansible artifacts
     * Roles
     * Module defaults
     * Interactive input: prompts
     * Using Variables
     * Discovering variables: facts and magic variables
     * Playbook Example: Continuous Delivery and Rolling Upgrades
   * Executing playbooks
   * Advanced playbook syntax
   * Manipulating data
 * Protecting sensitive data with Ansible vault
 * Using Ansible modules and plugins
 * Using Ansible collections
 * Using Ansible on Windows and BSD
 * Ansible tips and tricks

Contributing to Ansible

 * Ansible Community Guide
 * Ansible Collections Contributor Guide
 * ansible-core Contributors Guide
 * Advanced Contributor Guide
 * Ansible documentation style guide

Extending Ansible

 * Developer Guide

Common Ansible Scenarios

 * Legacy Public Cloud Guides

Network Automation

 * Network Getting Started
 * Network Advanced Topics
 * Network Developer Guide

Ansible Galaxy

 * Galaxy User Guide
 * Galaxy Developer Guide

Reference & Appendices

 * Collection Index
 * Indexes of all modules and plugins
 * Playbook Keywords
 * Return Values
 * Ansible Configuration Settings
 * Controlling how Ansible behaves: precedence rules
 * YAML Syntax
 * Python 3 Support
 * Interpreter Discovery
 * Releases and maintenance
 * Testing Strategies
 * Sanity Tests
 * Frequently Asked Questions
 * Glossary
 * Ansible Reference: Module Utilities
 * Special Variables
 * Red Hat Ansible Automation Platform
 * Ansible Automation Hub
 * Logging Ansible output

Roadmaps

 * Ansible Roadmap
 * ansible-core Roadmaps






Ansible
 * 
 * Using Ansible playbooks
 * Working with playbooks
 * Edit on GitHub

--------------------------------------------------------------------------------

This is the latest (stable) Ansible community documentation. For Red Hat Ansible
Automation Platform subscriptions, see Life Cycle for version details.


WORKING WITH PLAYBOOKS

Playbooks record and execute Ansible’s configuration, deployment, and
orchestration functions. They can describe a policy you want your remote systems
to enforce, or a set of steps in a general IT process.

If Ansible modules are the tools in your workshop, playbooks are your
instruction manuals, and your inventory of hosts is your raw material.

At a basic level, playbooks can be used to manage configurations of and
deployments to remote machines. At a more advanced level, they can sequence
multi-tier rollouts involving rolling updates and can delegate actions to other
hosts, interacting with monitoring servers and load balancers along the way.

Playbooks are designed to be human-readable and are developed in a basic text
language. There are multiple ways to organize playbooks and the files they
include, and we’ll offer up some suggestions on that and making the most out of
Ansible.

 * Templating (Jinja2)
   * Jinja2 Example
 * Using filters to manipulate data
   * Handling undefined variables
   * Defining different values for true/false/null (ternary)
   * Managing data types
   * Formatting data: YAML and JSON
   * Combining and selecting data
   * Randomizing data
   * Managing list variables
   * Selecting from sets or lists (set theory)
   * Calculating numbers (math)
   * Managing network interactions
   * Hashing and encrypting strings and passwords
   * Manipulating text
   * Manipulating strings
   * Managing UUIDs
   * Handling dates and times
   * Getting Kubernetes resource names
 * Tests
   * Test syntax
   * Testing strings
   * Vault
   * Testing truthiness
   * Comparing versions
   * Set theory tests
   * Testing if a list contains a value
   * Testing if a list value is True
   * Testing paths
   * Testing size formats
   * Testing task results
   * Type Tests
 * Lookups
   * Using lookups in variables
 * Python3 in templates
   * Dictionary views
   * dict.iteritems()
 * The now function: get the current time
 * The undef function: add hint for undefined variables
 * Loops
   * Comparing loops
   * Using loops
   * Ensuring list input for loop: using query rather than lookup
   * Adding controls to loops
   * Nested Loops
   * Migrating from with_X to loop
 * Controlling where tasks run: delegation and local actions
   * Tasks that cannot be delegated
   * Delegating tasks
   * Templating in delegation context
   * Delegation and parallel execution
   * Delegating facts
   * Local playbooks
 * Conditionals
   * Basic conditionals with when
   * Debugging conditionals
   * Commonly-used facts
 * Blocks
   * Grouping tasks with blocks
   * Handling errors with blocks
 * Handlers: running operations on change
   * Handler example
   * Notifying handlers
   * Naming handlers
   * Controlling when handlers run
   * Defining when tasks change
   * Using variables with handlers
   * Handlers in roles
   * Includes and imports in handlers
   * Meta tasks as handlers
   * Limitations
 * Error handling in playbooks
   * Ignoring failed commands
   * Ignoring unreachable host errors
   * Resetting unreachable hosts
   * Handlers and failure
   * Defining failure
   * Defining “changed”
   * Ensuring success for command and shell
   * Aborting a play on all hosts
   * Controlling errors in blocks
 * Setting the remote environment
   * Setting the remote environment in a task
 * Working with language-specific version managers
 * Re-using Ansible artifacts
   * Creating reusable files and roles
   * Re-using playbooks
   * When to turn a playbook into a role
   * Re-using files and roles
   * Re-using tasks as handlers
 * Roles
   * Role directory structure
   * Storing and finding roles
   * Using roles
   * Role argument validation
   * Running a role multiple times in one play
   * Using role dependencies
   * Embedding modules and plugins in roles
   * Sharing roles: Ansible Galaxy
 * Module defaults
   * Module defaults groups
 * Interactive input: prompts
   * Hashing values supplied by vars_prompt
   * Allowing special characters in vars_prompt values
 * Using Variables
   * Creating valid variable names
   * Simple variables
   * When to quote variables (a YAML gotcha)
   * Boolean variables
   * List variables
   * Dictionary variables
   * Combining variables
   * Registering variables
   * Referencing nested variables
   * Transforming variables with Jinja2 filters
   * Where to set variables
   * Variable precedence: Where should I put a variable?
   * Using advanced variable syntax
 * Discovering variables: facts and magic variables
   * Ansible facts
   * Information about Ansible: magic variables
 * Playbook Example: Continuous Delivery and Rolling Upgrades
   * What is continuous delivery?
   * Site deployment
   * Reusable content: roles
   * Configuration: group variables
   * The rolling upgrade
   * Managing other load balancers
   * Continuous delivery end-to-end

Previous Next

--------------------------------------------------------------------------------

© Copyright Ansible project contributors. Last updated on Jul 25, 2024.


Close


suggested results





Search this site