跳转到主要内容

章节Ansible 用户指南

Playbook Guide

37 页更新于 1 天前

开始阅读

本章内容37

  1. 01 Manipulating data In many cases, you will need to perform complex operations with your variables. While Ansible is not recomm... 1 天前
  2. 02 Playbook Example: Continuous Delivery and Rolling Upgrades What is continuous delivery? Continuous delivery (CD) means frequently delivering updates to your software ... 1 天前
  3. 03 Using Ansible playbooks [!NOTE] Making Open Source More Inclusive Red Hat is committed to replacing problematic language in our cod... 1 天前
  4. 04 Search paths in Ansible You can control the paths Ansible searches to find resources on your control node (including configuration,... 1 天前
  5. 05 Working with playbooks Playbooks record and execute Ansible's configuration, deployment, and orchestration functions. They can des... 1 天前
  6. 06 Advanced playbook syntax The advanced YAML syntax examples on this page give you more control over the data placed in YAML files use... 1 天前
  7. 07 Asynchronous actions and polling By default, Ansible runs tasks synchronously, holding the connection to the remote node open until the acti... 1 天前
  8. 08 Blocks Blocks create logical groups of tasks. Blocks also offer ways to handle task errors, similar to exception h... 1 天前
  9. 09 Validating tasks: check mode and diff mode Ansible provides two modes of execution that validate tasks: check mode and diff mode. These modes can be u... 1 天前
  10. 10 Conditionals In a playbook, you may want to execute different tasks or have different goals, depending on the value of a... 1 天前
  11. 11 Debugging tasks Ansible offers a task debugger so you can fix errors during execution instead of editing your playbook and ... 1 天前
  12. 12 Controlling where tasks run: delegation and local actions By default, Ansible gathers facts and executes all tasks on the machines that match the hosts line of your... 1 天前
  13. 13 Setting the remote environment 1.1 You can use the environment keyword at the play, block, or task level to set an environment variable f... 1 天前
  14. 14 Error handling in playbooks When Ansible receives a non-zero return code from a command or a failure from a module, by default it stops... 1 天前
  15. 15 Executing playbooks Ready to run your Ansible playbook? Running complex playbooks requires some trial and error so learn about ... 1 天前
  16. 16 Using filters to manipulate data Filters let you transform JSON data into YAML data, split a URL to extract the hostname, get the SHA1 hash ... 1 天前
  17. 17 Handlers: running operations on change Sometimes you want a task to run only when a change is made on a machine. For example, you may want to rest... 1 天前
  18. 18 Ansible playbooks<span id="about_playbooks"></span> Ansible Playbooks provide a repeatable, reusable, simple configuration management and multimachine deployme... 1 天前
  19. 19 Lookups Lookup plugins retrieve data from outside sources such as files, databases, key/value stores, APIs, and oth... 1 天前
  20. 20 Loops Ansible offers the loop, with_<lookup>, and until keywords to execute a task multiple times. Examples of... 1 天前
  21. 21 Module defaults If you frequently call the same module with the same arguments, it can be useful to define default argument... 1 天前
  22. 22 Understanding privilege escalation: become<span id="become"></span> Ansible uses existing privilege escalation systems to execute tasks with root privileges or with another us... 1 天前
  23. 23 Interactive input: prompts If you want your playbook to prompt the user for certain input, add a 'vars_prompt' section. Prompting the ... 1 天前
  24. 24 Python3 in templates Ansible uses Jinja2 to take advantage of Python data types and standard functions in templates and variable... 1 天前
  25. 25 Reusing Ansible artifacts You can write a simple playbook in one very large file, and most users learn the one-file approach first. H... 1 天前
  26. 26 Roles Roles let you automatically load related vars, files, tasks, handlers, and other Ansible artifacts based on... 1 天前
  27. 27 Masking secrets in Ansible output<span id="playbooks_secret_masking"></span> 2.22 Ansible can register values as secrets and mask them wherever Ansible writes output. Once a value is r... 1 天前
  28. 28 Executing playbooks for troubleshooting When you are testing new plays or debugging playbooks, you may need to run the same play multiple times. To... 1 天前
  29. 29 Controlling playbook execution: strategies and more By default, Ansible runs each task on all hosts affected by a play before starting the next task on any hos... 1 天前
  30. 30 Tags If you have a large playbook, it may be useful to run only specific parts of it instead of running the enti... 1 天前
  31. 31 Templating (Jinja2) Ansible uses Jinja2 templating to enable dynamic expressions and access to variables <playbooks_variables>... 1 天前
  32. 32 The now function: get the current time 2.8 The now() Jinja2 function retrieves a Python datetime object or a string representation for the curren... 1 天前
  33. 33 The undef function: add hint for undefined variables 2.12 The Jinja2 undef() function returns a Python AnsibleUndefined object, derived from jinja2.StrictUnd... 1 天前
  34. 34 Tests Tests in Jinja are a way of evaluating template expressions and returning True or False. Jinja ships with m... 1 天前
  35. 35 Using variables Ansible uses variables to manage differences between systems. With Ansible, you can execute tasks and playb... 1 天前
  36. 36 Play Argument Validation Beginning in version 2.20, you can enable argument validation using the play keyword validate_argspec. Thi... 1 天前
  37. 37 Discovering variables: facts and magic variables With Ansible you can retrieve or discover certain variables containing information about your remote system... 1 天前