mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Conditionals chapter and some misc tweaks elsewhere
This commit is contained in:
parent
ddf51154fd
commit
00c2c0b11c
4 changed files with 46 additions and 2583 deletions
|
@ -97,3 +97,21 @@ Here is an example::
|
|||
Note that you must have passphrase-less SSH keys or an ssh-agent configured for this to work, otherwise rsync
|
||||
will need to ask for a passphrase.
|
||||
|
||||
Local Playbooks
|
||||
```````````````
|
||||
|
||||
It may be useful to use a playbook locally, rather than by connecting over SSH. This can be useful
|
||||
for assuring the configuration of a system by putting a playbook on a crontab. This may also be used
|
||||
to run a playbook inside a OS installer, such as an Anaconda kickstart.
|
||||
|
||||
To run an entire playbook locally, just set the "hosts:" line to "hosts:127.0.0.1" and then run the playbook like so::
|
||||
|
||||
ansible-playbook playbook.yml --connection=local
|
||||
|
||||
Alternatively, a local connection can be used in a single playbook play, even if other plays in the playbook
|
||||
use the default remote connection type::
|
||||
|
||||
- hosts: 127.0.0.1
|
||||
connection: local
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,11 @@
|
|||
Advanced Playbooks
|
||||
==================
|
||||
Conditionals
|
||||
============
|
||||
|
||||
Here are some advanced features of the playbooks language. Using all of these features
|
||||
is not necessary, but many of them will prove useful. If a feature doesn't seem immediately
|
||||
relevant, feel free to skip it. For many people, the features documented in `playbooks` will
|
||||
be 90% or more of what they use in Ansible.
|
||||
Often the result of a play may depend on the value of a variable, fact, or previous task result. In some cases,
|
||||
the values of variables may depend on other variables. Further, additional groups can be created to manage hosts based on
|
||||
whether the hosts match other criteria. There are many options to control execution flow in Ansible.
|
||||
|
||||
Let's dig into what they are.
|
||||
|
||||
.. contents::
|
||||
:depth: 2
|
||||
|
|
Loading…
Reference in a new issue