A number of Jinja2 "filters" can also be used in when statements, some of which are unique
A number of Jinja2 "filters" can also be used in when statements, some of which are unique
and provided by ansible. Suppose we want to ignore the error of one statement and then
and provided by Ansible. Suppose we want to ignore the error of one statement and then
decide to do something conditionally based on success or failure::
decide to do something conditionally based on success or failure::
tasks:
tasks:
@ -484,7 +484,7 @@ be used like this::
.. versionadded: 0.9
.. versionadded: 0.9
Many new lookup abilities were added in 0.9. Remeber lookup plugins are run on the *controlling* machine::
Many new lookup abilities were added in 0.9. Remember, lookup plugins are run on the *controlling* machine::
---
---
- hosts: all
- hosts: all
@ -580,7 +580,7 @@ This length can be changed by passing an extra parameter::
(...)
(...)
# create an user with a given password
# create a user with a given password
- user: name=guestuser
- user: name=guestuser
state=present
state=present
uid=5000
uid=5000
@ -737,7 +737,7 @@ Turning Off Facts
`````````````````
`````````````````
If you know you don't need any fact data about your hosts, and know everything about your systems centrally, you
If you know you don't need any fact data about your hosts, and know everything about your systems centrally, you
can turn off fact gathering. This has advantages in scaling ansible in push mode with very large numbers of
can turn off fact gathering. This has advantages in scaling Ansible in push mode with very large numbers of
systems, mainly, or if you are using Ansible on experimental platforms. In any play, just do this::
systems, mainly, or if you are using Ansible on experimental platforms. In any play, just do this::
- hosts: whatever
- hosts: whatever
@ -750,8 +750,8 @@ The use of playbooks in local mode (above) is made extremely powerful with the a
A script for setting up ansible-pull is provided in the examples/playbooks directory of the source
A script for setting up ansible-pull is provided in the examples/playbooks directory of the source
checkout.
checkout.
The basic idea is to use Ansible to set up a remote copy of ansible on each managed node, each set to run via
The basic idea is to use Ansible to set up a remote copy of Ansible on each managed node, each set to run via
cron and update playbook source via git. This inverts the default push architecture of ansible into a pull
cron and update playbook source via git. This inverts the default push architecture of Ansible into a pull
architecture, which has near-limitless scaling potential. The setup playbook can be tuned to change
architecture, which has near-limitless scaling potential. The setup playbook can be tuned to change
the cron frequency, logging locations, and parameters to ansible-pull.
the cron frequency, logging locations, and parameters to ansible-pull.
@ -765,7 +765,7 @@ Register Variables
Often in a playbook it may be useful to store the result of a given command in a variable and access
Often in a playbook it may be useful to store the result of a given command in a variable and access
it later. Use of the command module in this way can in many ways eliminate the need to write site specific facts, for
it later. Use of the command module in this way can in many ways eliminate the need to write site specific facts, for
instance, you could test for the existance of a particular program.
instance, you could test for the existence of a particular program.
The 'register' keyword decides what variable to save a result in. The resulting variables can be used in templates, action lines, or *when* statements. It looks like this (in an obviously trivial example)::
The 'register' keyword decides what variable to save a result in. The resulting variables can be used in templates, action lines, or *when* statements. It looks like this (in an obviously trivial example)::
@ -786,8 +786,8 @@ Rolling Updates
..versionadded:: 0.7
..versionadded:: 0.7
By default ansible will try to manage all of the machines referenced in a play in parallel. For a rolling updates
By default, Ansible will try to manage all of the machines referenced in a play in parallel. For a rolling updates
use case, you can define how many hosts ansible should manage at a single time by using the ''serial'' keyword::
use case, you can define how many hosts Ansible should manage at a single time by using the ''serial'' keyword::
- name: test play
- name: test play
@ -858,11 +858,11 @@ Fireball Mode
Ansible's core connection types of 'local', 'paramiko', and 'ssh' are augmented in version 0.8 and later by a new extra-fast
Ansible's core connection types of 'local', 'paramiko', and 'ssh' are augmented in version 0.8 and later by a new extra-fast
connection type called 'fireball'. It can only be used with playbooks and does require some additional setup
connection type called 'fireball'. It can only be used with playbooks and does require some additional setup
outside the lines of ansible's normal "no bootstrapping" philosophy. You are not required to use fireball mode
outside the lines of Ansible's normal "no bootstrapping" philosophy. You are not required to use fireball mode
to use Ansible, though some users may appreciate it.
to use Ansible, though some users may appreciate it.
Fireball mode works by launching a temporary 0mq daemon from SSH that by default lives for only 30 minutes before
Fireball mode works by launching a temporary 0mq daemon from SSH that by default lives for only 30 minutes before
shutting off. Fireball mode once running uses temporary AES keys to encrypt a session, and requires direct
shutting off. Fireball mode, once running, uses temporary AES keys to encrypt a session, and requires direct
communication to given nodes on the configured port. The default is 5099. The fireball daemon runs as any user you
communication to given nodes on the configured port. The default is 5099. The fireball daemon runs as any user you
set it down as. So it can run as you, root, or so on. If multiple users are running Ansible as the same batch of hosts,
set it down as. So it can run as you, root, or so on. If multiple users are running Ansible as the same batch of hosts,
take care to use unique ports.
take care to use unique ports.
@ -972,7 +972,7 @@ feature produces a large amount of output, it is best used when checking a singl
Dictionary & Nested (Complex) Arguments
Dictionary & Nested (Complex) Arguments
```````````````````````````````````````
```````````````````````````````````````
As a review, most tasks in ansible are of this form::
As a review, most tasks in Ansible are of this form::