Michael DeHaan
60944b81f0
Provide warning about "with_items: '{{ loop }}'" being redundant only when {{ starts the expression value. Fixes #4582 .
12 years ago
Michael DeHaan
21d4400c96
Misc pep8 fixes
12 years ago
jctanner
69fa5954fd
Merge pull request #3932 from jocelynj/devel
...
Add option remote_user to task level, to specify the ssh login user
12 years ago
Michael DeHaan
9ea54fcaaf
Fixes a dev branch glitch where a conditional could be applied to multiple tasks. Also improves the errors on parsing bad conditionals to make them less confusing to users.
12 years ago
Michael DeHaan
d168c709d5
Fix an issue where the ordering of an include statement is processed ahead of the conditional in the included statement,
...
which required a redundant check to see if a variable was defined rather than short circuiting.
Fixes #4469
12 years ago
Michael DeHaan
709ffda3d1
Tweak only_if deprecation detector.
12 years ago
Michael DeHaan
a45494a896
Add warnings feature.
12 years ago
Michael DeHaan
9637f620d7
Deprecation warnings of several flavors, nice and purple and can be disabled
...
in ansible.cfg.
12 years ago
Michael DeHaan
5e30cd999c
Make it possible to say:
...
tags: 42
And have the tag be a string, not an int, so --tags matches.
Fixes #4110
12 years ago
bennojoy
53e48b63a9
dountil feature commit 1
12 years ago
James Cammarata
27e8675277
Make the role_name in the task its own field for use in the callback
12 years ago
James Cammarata
a5ee6ff1e5
Display parent role name of tasks in the name line
...
Fixes #4076
12 years ago
Hiroaki Nakamura
2357194b39
Add failed_when module variable.
...
Implementation note: Ternery operator trick for python prior to 2.5 is used.
(test and [when_true_value] or [when_false_value])[0]
http://stackoverflow.com/questions/394809/ternary-conditional-operator-in-python#comment1466794_394887
12 years ago
James Cammarata
02b7b79d7e
Re-adding capability of tasks to see a unique view of their own defaults
12 years ago
James Cammarata
637d3070dc
Allow default variables to be overridden by inventory variables
12 years ago
Jocelyn Jaubert
4cee6a5435
Add option remote_user to task level, to specify the ssh login user
12 years ago
Stoned Elipot
f0743fc32a
Introduce the 'always_run' task clause.
...
The 'always_run' task clause allows one to execute a task even in
check mode.
While here implement Runner.noop_on_check() to check if a runner
really should execute its task, with respect to check mode option
and 'always_run' clause.
Also add the optional 'jinja2' argument to check_conditional() :
it allows to give this function a jinja2 expression without exposing
the 'jinja2_compare' implementation mechanism.
12 years ago
Stoned Elipot
eb45f07ae3
Introduce 'changed_when' keyword to override a task's changed status with the evaluation of a Jinja2 expression
13 years ago
Michael DeHaan
d2721526de
Small tweak, don't merge conditionals, just evaluate each in turn.
13 years ago
David Golden
d65f45f0b2
Expand sudo_user after variable merging
...
Previous commit c3659741 expanded sudo_user during task construction,
but this is too early as it does not pick up variables set during
the play.
This commit moves sudo_user expansion to the runner after variables
have been merged.
13 years ago
Kent Frazier
4c6583bd00
Fix bug with include-level vars and sudo_user.
...
If a variable was provided for an include, in either of these ways:
---
- hosts: all
tasks:
- include: included.yml param=www-data
- include: included.yml
vars:
param: www-data
and then that param was used as the value of sudo_user in the included
tasks:
---
- name: do something as a parameterized sudo_user
command: whoami
sudo: yes
sudo_user: $param
you would receive a "failed to parse: usage: sudo" error back and the
command would not execute.
This seemed to be due to a missing call to template.template somewhere,
because the final value being passed through ssh was still `$param`.
After some digging, the issue seems to instead have been a problem with
providing the wrong context to the template for expansion. Inside the
`Task` logic, it was passing `play.vars` as the context, where
`module_vars` seemed more appropriate. After replacing it, my test case
above ran without issue. There was a comment above suggesting that the
template call might be unnecessary, but removing it made the original
error return, since it is not getting escaped later down the line. I
removed the comment since it was inaccurate.
I tried to actually incorporate my test case above into the test suite
as a regression test, but was unable to figure out how to structure it.
The existing test infrastructure seemed to only be testing for correct
number of counts in things (ok vs. changed, etc.), without regard for
whether the content generated by the command is correct. If there is an
example of a test similar to this one (where I would want to check the
JSON generated to make sure sudo_user had been converted), please let me
know and I will be happy to submit an additional patch.
13 years ago
Michael DeHaan
7117ca5395
Allow modules in a "./library" directory to be referenced by their shortforms "modulename:" instead of just "action: modulename"
13 years ago
Michael DeHaan
6fdfbb1a34
Improve variable smushing so it only has to be done in one place. This is related to shlex.split being called
...
on untemplated variables in some rare cases.
13 years ago
Michael DeHaan
6c778acd91
Smush the braces in various places (hey, that rhymes) to avoid undo key=value splitting surprises
...
in new template system.
13 years ago
Michael DeHaan
08324cb5d7
Allow play tagging in context of new meta-tasks.
13 years ago
Michael DeHaan
32fb6c807c
Allow handlers to run in between pre_tasks, roles, tasks, and post_tasks.
13 years ago
Michael DeHaan
7931597a6a
Fix template call.
13 years ago
Michael DeHaan
f585c4cde7
Upgraded variable support met with upgraded conditional support, see examples/playbooks/upgraded_vars.yml
...
for details!
13 years ago
Junegunn Choi
20a48c6bdf
terminate immediately on a failure
13 years ago
David Hughes
c365974117
Added variable expansion to task sudo_user parameter
13 years ago
Daniel Hokka Zakrisson
297259725a
Allow (local_)action: to be a dict
...
Use the key module: to set which module to invoke.
13 years ago
Daniel Hokka Zakrisson
c04d5ba739
Allow specifying args directly to actions using module: syntax
...
Makes things like
- name: do complex things with complex module
complex:
setting_a: true
setting_b:
- foo
- bar
possible.
Fixes #2228 .
13 years ago
Daniel Hokka Zakrisson
7e0ee6809c
Don't template delegate_to too early, not all vars are available
...
Fixes using delegate_to: $item within a playbook include.
13 years ago
Michael DeHaan
1ecf4a6943
Working on complex argument support.
13 years ago
Michael DeHaan
c8878998d1
update some of many copyright dates but we can just do this when editing each file, not super high priority
13 years ago
Michael DeHaan
f7497e75e5
Able to use "environment: " on any task to pass proxy details and other useful settings. Can be a variable
...
or a dictionary.
13 years ago
Daniel Hokka Zakrisson
98f0a9210e
Raise an error when multiple when_* statements are provided
...
Fixes #1994 .
13 years ago
Daniel Hokka Zakrisson
d5e63332fe
Raise an error if an action doesn't have a string type
...
Happens with e.g. "command: true" that YAML helpfully converts to a
bool.
13 years ago
Daniel Hokka Zakrisson
4d48daff80
Actually allow using connection: on a task
13 years ago
Daniel Hokka Zakrisson
caee51e90e
Allow only_if/when_* on task includes and apply it on all tasks within
13 years ago
Daniel Hokka Zakrisson
4555cdc49c
Allow using connection: on the task level
...
This is the name of the setting on the play level, and the options.
Should be consistent.
13 years ago
Michael DeHaan
da90c5f75e
Document 'when' and tweak the code to be a little more comprehensive on what is false.
13 years ago
Daniel Hokka Zakrisson
43bdec8b20
Throw an error if multiple actions have been specified
13 years ago
Daniel Hokka Zakrisson
1e0295c7e2
Template handlers late
...
This allows overriding variables in name, and removes templating from
parsing.
13 years ago
Daniel Hokka Zakrisson
d5dd89a8f7
Allow specifying when: ...
13 years ago
Daniel Hokka Zakrisson
fd732f8d3b
Add when_boolean
...
Fixes #1567 .
13 years ago
Daniel Hokka Zakrisson
f95fefd8c5
Use plugin system to find modules
13 years ago
Michael DeHaan
2303f65a1a
Merge pull request #1614 from dagwieers/missing-action-error
...
Print the task name (if any) when complaining
13 years ago
Dag Wieers
b96877e5aa
Print the task name (if any) when complaining
...
After spending 10 minutes to find which playbook had an action/local_action missing, I changed the error to include the task name (if set). The error eventually was caused because I added a name to a task, but the dash before the existing action was not removed.
13 years ago
Daniel Hokka Zakrisson
0ca1775bda
Try to ensure the entire value is quoted
13 years ago
Daniel Hokka Zakrisson
233a36b9e8
Template using module_vars early
...
Since no basedir is available at that time, avoid invoking
lookup plugins since they assume it is present.
13 years ago
Daniel Hokka Zakrisson
47082a9171
Add $LOOKUP(<lookup plugin>,<data>) as a templating option
...
Also moves file and pipe to lookup_plugins.
13 years ago
Dag Wieers
dfa1e8b0dc
Bail out if an action is not a string
...
Since YAML allows anything, we should enforce that actions are strings.
This closes #1419 .
13 years ago
Daniel Hokka Zakrisson
e05e514861
Create a plugin loader system
13 years ago
Michael DeHaan
c0747b7baa
pep8 fixes
13 years ago
Michael DeHaan
21258dcc66
Added 'when' as a shortcut around only_if.
13 years ago
Michael DeHaan
a768e9a9ff
Fix for sudo defaults if sudo is passed in via --extra-vars
13 years ago
Daniel Hokka Zakrisson
026e251b94
Make with_items a lookup plugin
13 years ago
Michael DeHaan
c5d2f6b0d3
implement lookup plugins for arbitrary enumeration over arbitrary things. See the mailing list for some cool examples.
13 years ago
Michael DeHaan
271db7bddb
Merge pull request #1308 from abondis/named_action
...
named actions + modules list in utils.py
13 years ago
Aurélien Bondis
6d183959ba
#1303 : add sudo option to tasks
13 years ago
Aurélien Bondis
2063e10c00
named actions + modules list in utils.py
13 years ago
Michael DeHaan
f3d7294690
Test for directory existance, fix exception catching granularity
13 years ago
Aurélien Bondis
e07bfd9ef8
playbook/tasks: allow to use a module's name instead of action:
13 years ago
Jonathan Palley
faed650bb1
allow vars in delegate_to
13 years ago
Jonathan Palley
620accf117
make delegate_to localhost act like local_action
13 years ago
Daniel Hokka Zakrisson
cc948f339c
Allow including files through variables
...
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
13 years ago
Michael DeHaan
b8c4bb9e6e
Revert "Allow including files through variables"
...
This reverts commit bf47bb4753 .
Conflicts:
lib/ansible/utils.py
test/TestUtils.py
13 years ago
Michael DeHaan
544a8e44d7
Merge pull request #1053 from dhozac/varreplace-include
...
Allow including files through variables
13 years ago
Daniel Hokka Zakrisson
dd11b01350
Keep delegate_to so all auxiliary logic based on that works
13 years ago
Daniel Hokka Zakrisson
5bb0f6908b
Allow transport on tasks, and use it for local_action
13 years ago
Daniel Hokka Zakrisson
bf47bb4753
Allow including files through variables
...
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
13 years ago
Tim Bielawa
4121109665
Local actions, they're like aliases for actions with localhost
...
delegates.
Closes #905
13 years ago
Michael DeHaan
f07e55c568
Adds 'delegate_to' as a task option which can be used to signal load balancers and outage windows.
13 years ago
Michael DeHaan
05a128c2be
Add ability to store and access module results later on in the play. See examples/playbooks/register_logic for details.
14 years ago
Michael DeHaan
faed4b5a33
whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
...
in 0.6 release)
14 years ago
Michael DeHaan
b76efa39be
Fix some templating issues, needs testing with anti-unicode safeguard around shlex.split
14 years ago
Michael DeHaan
c192d8a2b2
Revert "Apply templating to module arguments in playbook"
...
Breaks copy module by introducing unicodeness, among other things
This reverts commit 4fedb17e38 .
14 years ago
Michael DeHaan
38ed7ca7df
Merge pull request #759 from lorin/error-feedback
...
If task action is invalid, output the name in error message
14 years ago
Lorin Hochstein
aed6ee7f74
Report only name in task error, all on one line
14 years ago
Lorin Hochstein
fa9fe9d246
If task action is invalid, output the name and action.
14 years ago
Will Thames
4fedb17e38
Apply templating to module arguments in playbook
...
Module arguments should have variable substitution applied
Also, replacing task.action with the templated task.name seems wrong
14 years ago
Petros Moisiadis
5f4bf813b1
added an 'ignore_errors' option to tasks
...
Failed tasks with ignore_errors=True, allow the remaining tasks in the
play to be executed as if no failure happened. A failure notice is still
written to the output as well as an '...ignoring' message.
14 years ago
Michael DeHaan
8bb8314d10
Inject vars need to pushed further up to make with_items work as desired.
14 years ago
Michael DeHaan
3c2cbae68e
Plays and tasks now yell when they see parameters they do not understand, so that typos like 'var' for 'vars'
...
don't result in people having to ask questions about what is wrong with their playbook
14 years ago
Michael DeHaan
1754de3335
Misc code cleanup, mostly whitespace preferences, removing unused imports, plus a few fixes here and there.
14 years ago
Michael DeHaan
61d8e2e7c7
with_items should be processed inside the task class, also make first_available_file
...
and with_items incompatible. Most cases that would need this could be solved
with vars_files.
14 years ago
Michael DeHaan
969c3feb13
Allow include statements from plays to specify tags (see tags.yml example file).
...
Also be smart and don't run a play at all if no tasks in the play match any of the tags specified. This includes not running the setup actions!
14 years ago
Michael DeHaan
83f23ef861
Basic support for tagging tasks and selecting a subset of tasks to run with --tags.
14 years ago
Michael DeHaan
4664e354c3
Get with_items to work with new play/task architecture.
14 years ago
Michael DeHaan
ecb944892d
Tweaks on previous refactoring of playbook, version bump a 0.4 reference, remove some debug, etc
14 years ago
Michael DeHaan
b9b53d1941
Playbook refactoring -- work in progress.
14 years ago