mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-31 09:01:23 -07:00
Update man pages. Fix formatting in playbook example. Also, YAML documents by definition start with '---', so I have added this to the example and the manpage
This commit is contained in:
parent
6027c16ddd
commit
6612772711
5 changed files with 75 additions and 186 deletions
|
@ -14,19 +14,23 @@ ansible-playbook - format and function of an ansible playbook file
|
|||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
Ansible ships with a ansible-playbook tool for running playbooks. Playbooks can represent
|
||||
frequent tasks, desired system configurations, or deployment processes.
|
||||
Ansible ships with a ansible-playbook tool for running playbooks.
|
||||
Playbooks can represent frequent tasks, desired system configurations,
|
||||
or deployment processes.
|
||||
|
||||
|
||||
FORMAT
|
||||
------
|
||||
|
||||
Playbooks are currently writeable in YAML. Other formats (JSON?) may be supported in the future.
|
||||
Playbooks are currently writeable in YAML. Other formats (JSON?) may
|
||||
be supported in the future.
|
||||
|
||||
|
||||
EXAMPLE
|
||||
-------
|
||||
|
||||
[literal]
|
||||
---
|
||||
- pattern: '*'
|
||||
hosts: '/etc/ansible/hosts'
|
||||
tasks:
|
||||
|
@ -52,48 +56,52 @@ WHAT THE EXAMPLE MEANS
|
|||
|
||||
Here's what the above example will do.
|
||||
|
||||
For all hosts in /etc/ansible/hosts (one host per line) that are named 'webserver-anything', first
|
||||
write a JSON file into /etc/ansible/setup on each remote system with the values
|
||||
max_clients and http_port.
|
||||
For all hosts in /etc/ansible/hosts (one host per line) that are named
|
||||
'webserver-anything', first write a JSON file into /etc/ansible/setup
|
||||
on each remote system with the values max_clients and http_port.
|
||||
|
||||
Next, use a Jinja2 template locally residing
|
||||
at /srv/mytemplates/httpd.j2 to write the Apache config file on each host
|
||||
Next, use a Jinja2 template locally residing at
|
||||
/srv/mytemplates/httpd.j2 to write the Apache config file on each host
|
||||
to the path /etc/httpd/conf, using the previous values.
|
||||
|
||||
Ensure that apache is running if stopped.
|
||||
|
||||
If and only if the config file changed, note that we need to restart apache at the end of
|
||||
the run, otherwise, don't bother because we already know it is running.
|
||||
If and only if the config file changed, note that we need to restart
|
||||
apache at the end of the run, otherwise, don't bother because we
|
||||
already know it is running.
|
||||
|
||||
|
||||
HIGH LEVEL EXPLANATION
|
||||
----------------------
|
||||
|
||||
Playbooks are executed top down and can contain multiple references to patterns.
|
||||
For instance, a playbook could do something to all webservers, then do something
|
||||
to all database servers, then do something different to all webservers again.
|
||||
Playbooks are executed top down and can contain multiple references to
|
||||
patterns. For instance, a playbook could do something to all
|
||||
webservers, then do something to all database servers, then do
|
||||
something different to all webservers again.
|
||||
|
||||
For each pattern, the tasks in the 'tasks' list are executed in order for all
|
||||
hosts in the host file matching the pattern.
|
||||
For each pattern, the tasks in the 'tasks' list are executed in order
|
||||
for all hosts in the host file matching the pattern.
|
||||
|
||||
For each task, a "do" statement describes what the task is and what ansible
|
||||
module to use to accomplish the task, along with any arguments. The first
|
||||
line in the "do" is the name of the task -- this will appear in any log output.
|
||||
For each task, a "do" statement describes what the task is and what
|
||||
ansible module to use to accomplish the task, along with any
|
||||
arguments. The first line in the "do" is the name of the task -- this
|
||||
will appear in any log output.
|
||||
|
||||
The second line in each "do" is the module name followed by module arguments.
|
||||
The second line in each "do" is the module name followed by module
|
||||
arguments.
|
||||
|
||||
Most modules accept key=value format arguments.
|
||||
|
||||
Handlers are like tasks, but are conditionally executed. If a module reports
|
||||
a 'change', it can choose to notify a handler by name. If notified, it will
|
||||
run only for hosts that changed.
|
||||
Handlers are like tasks, but are conditionally executed. If a module
|
||||
reports a 'change', it can choose to notify a handler by name. If
|
||||
notified, it will run only for hosts that changed.
|
||||
|
||||
|
||||
FUTURE BEHAVIOR
|
||||
---------------
|
||||
|
||||
What the playbook run does with a host when an error is detected is currently being refined
|
||||
and is subject to change.
|
||||
What the playbook run does with a host when an error is detected is
|
||||
currently being refined and is subject to change.
|
||||
|
||||
|
||||
AUTHOR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue