Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
ca261e89
Commit
ca261e89
authored
Oct 16, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more 0.8 documenting
parent
63100c9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
docsite/rst/playbooks2.rst
+36
-0
No files found.
docsite/rst/playbooks2.rst
View file @
ca261e89
...
@@ -254,6 +254,18 @@ there will be accessible to future tasks::
...
@@ -254,6 +254,18 @@ there will be accessible to future tasks::
action: site_facts
action: site_facts
- action: command echo ${my_custom_fact_can_be_used_now}
- action: command echo ${my_custom_fact_can_be_used_now}
In Ansible 0.8, a few shortcuts are available for testing whether a variable is defined or not::
tasks:
- action: command echo hi
only_if: is_set($some_variable)
There is a matching 'is_unset' that works the same way. Do not quote the variables inside the function.
While only_if is a pretty good option for advanced users, it exposes more guts of the engine than we'd like, and
we can do better. In 0.9, we will be adding 'when', which will be like a syntactic sugar for only_if and hide
this level of complexity -- it will numerous built in operators.
Conditional Imports
Conditional Imports
```````````````````
```````````````````
...
@@ -329,6 +341,30 @@ The above would be the equivalent of::
...
@@ -329,6 +341,30 @@ The above would be the equivalent of::
The yum and apt modules use with_items to execute fewer package manager transactions.
The yum and apt modules use with_items to execute fewer package manager transactions.
More Loops
``````````
.. versionadded: 0.8
Various 'lookup plugins' allow additional ways to iterate over data. Ansible will have more of these
over time. In 0.8, the only lookup plugin that comes stock is 'with_fileglob', but you can also write
your own.
'with_fileglob' matches all files in a single directory, non-recursively, that match a pattern. It can
be used like this::
----
- hosts: all
tasks:
# first ensure our target directory exists
- file: dest=/etc/fooapp state=directory
# copy each file over that matches the given pattern
- copy: src=$item dest=/etc/fooapp/ owner=root mode=600
with_fileglob: /playbooks/files/fooapp/*
Selecting Files And Templates Based On Variables
Selecting Files And Templates Based On Variables
````````````````````````````````````````````````
````````````````````````````````````````````````
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment