Commit Graph

108 Commits (b753625dbf367fba8308873d0378e0de70bb2cb0)

Author SHA1 Message Date
Michael Scherer 1e34e95ba0 Improve error message when multiple action are given
This can be illustrated using this playbook:

    - command: id
      delegate_to: "{{ remote_server }}"
      user: "{{ remote_user }}"

The error is to use 'user' instead of 'remote_user', but the error message
do not really mention it, so it can be a bit hard to spot.
2014-04-20 20:32:33 +02:00
James Tanner 14499e8bf3 Fixes #4325 allow async and poll parameters to be templated vars 2014-03-20 16:09:58 -04:00
Seth Woodworth 1d5db30067 Updates loop warning, removes unnecessary c 2014-03-09 00:19:28 -05:00
James Cammarata 75e3b59bbd Adding no_log: capability for tasks
Fixes #4088
2014-01-31 16:58:46 -06:00
Michael DeHaan d07a3b5e9b AnsibleWorks -> Ansible 2014-01-28 20:29:42 -05:00
jctanner b2d594d24e Merge pull request #5724 from angstwad/su-tasks-fix
Fix bug where playbook tasks do not escalate privs with 'su'
2014-01-23 14:05:14 -08:00
Paul Durivage e875089eba Fix bug where self.su was being set by the sudo param in play tasks 2014-01-22 11:04:19 -06:00
Paul Durivage 01d1bd61e7 Disallow su and sudo params in same play/task 2014-01-22 10:55:45 -06:00
Paul Durivage f72f5a20df Revert "Revert "Merge pull request #5325 from angstwad/add-su-support""
This reverts commit c17d0e0357.

Conflicts:
	lib/ansible/runner/connection_plugins/paramiko_ssh.py
2014-01-20 19:19:03 -06:00
James Tanner c17d0e0357 Revert "Merge pull request #5325 from angstwad/add-su-support"
This reverts commit 6f4bfa2cff, reversing
changes made to c91ba3a7c7.
2014-01-20 16:10:11 -05:00
Paul Durivage dec9131735 Ensure playbook support for su params 2014-01-20 11:46:56 -06:00
Paul Durivage 4088243deb Proposing fix for Issue #4324; adding support for su in connection plugins ssh, ssh_alt
Fixes for ssh_alt support, adding in references to in_data where appropriate
2014-01-20 11:25:10 -06:00
Michael DeHaan 10350d1639 Update various copyrights. Not complete, but sufficient. 2014-01-04 13:32:04 -05:00
Michael DeHaan 8e5b7d3095 Remove code underlying when_* and only_if, which are deprecated features slated for removal in the 1.5 release. 2014-01-03 19:13:21 -05:00
Michael DeHaan 28b9fd4e30 We have had only_if, when_foo, etc, deprecated for a while and said they would be removed in 1.5. Now they are, with friendly error messages still.
Users of these features should use "when:" as documented at docs.ansible.com.

Similarly, include + with_items has been removed.  The solution is to loop
inside the task files, see with_nested / with_together, etc.
2014-01-03 13:47:54 -05:00
James Tanner 4f13967386 Fixes #4536 Get the remote_user from multiple sources in a preferred order 2013-10-21 12:07:51 -04:00
Michael DeHaan 60944b81f0 Provide warning about "with_items: '{{ loop }}'" being redundant only when {{ starts the expression value. Fixes #4582. 2013-10-19 14:24:12 -04:00
Michael DeHaan 21d4400c96 Misc pep8 fixes 2013-10-19 13:03:15 -04:00
jctanner 69fa5954fd Merge pull request #3932 from jocelynj/devel
Add option remote_user to task level, to specify the ssh login user
2013-10-15 06:34:57 -07:00
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. 2013-10-12 17:39:28 -04:00
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
2013-10-11 20:43:58 -04:00
Michael DeHaan 709ffda3d1 Tweak only_if deprecation detector. 2013-10-11 19:12:25 -04:00
Michael DeHaan a45494a896 Add warnings feature. 2013-10-11 19:04:26 -04:00
Michael DeHaan 9637f620d7 Deprecation warnings of several flavors, nice and purple and can be disabled
in ansible.cfg.
2013-10-11 18:37:39 -04:00
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
2013-10-07 15:19:30 -04:00
bennojoy 53e48b63a9 dountil feature commit 1 2013-09-24 13:59:38 +05:30
James Cammarata 27e8675277 Make the role_name in the task its own field for use in the callback 2013-09-20 15:46:34 -05:00
James Cammarata a5ee6ff1e5 Display parent role name of tasks in the name line
Fixes #4076
2013-09-19 20:44:52 -05:00
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
2013-09-10 08:34:01 +09:00
James Cammarata 02b7b79d7e Re-adding capability of tasks to see a unique view of their own defaults 2013-09-02 21:37:50 -05:00
James Cammarata 637d3070dc Allow default variables to be overridden by inventory variables 2013-08-29 17:21:28 -05:00
Jocelyn Jaubert 4cee6a5435 Add option remote_user to task level, to specify the ssh login user 2013-08-23 23:20:13 +02:00
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.
2013-08-20 23:09:44 +02:00
Stoned Elipot eb45f07ae3 Introduce 'changed_when' keyword to override a task's changed status with the evaluation of a Jinja2 expression 2013-07-14 21:07:45 +02:00
Michael DeHaan d2721526de Small tweak, don't merge conditionals, just evaluate each in turn. 2013-06-19 21:18:05 -04:00
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.
2013-06-14 09:59:31 -04:00
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.
2013-05-23 00:05:11 -05:00
Michael DeHaan 7117ca5395 Allow modules in a "./library" directory to be referenced by their shortforms "modulename:" instead of just "action: modulename" 2013-04-28 21:05:19 -04:00
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.
2013-04-24 22:00:40 -04:00
Michael DeHaan 6c778acd91 Smush the braces in various places (hey, that rhymes) to avoid undo key=value splitting surprises
in new template system.
2013-04-22 22:05:06 -04:00
Michael DeHaan 08324cb5d7 Allow play tagging in context of new meta-tasks. 2013-04-21 17:12:12 -04:00
Michael DeHaan 32fb6c807c Allow handlers to run in between pre_tasks, roles, tasks, and post_tasks. 2013-04-20 18:03:03 -04:00
Michael DeHaan 7931597a6a Fix template call. 2013-04-11 12:15:13 -04:00
Michael DeHaan f585c4cde7 Upgraded variable support met with upgraded conditional support, see examples/playbooks/upgraded_vars.yml
for details!
2013-04-05 19:10:32 -04:00
Junegunn Choi 20a48c6bdf terminate immediately on a failure 2013-03-28 15:17:01 +09:00
David Hughes c365974117 Added variable expansion to task sudo_user parameter 2013-03-15 11:31:27 -07:00
Daniel Hokka Zakrisson 297259725a Allow (local_)action: to be a dict
Use the key module: to set which module to invoke.
2013-02-28 14:12:36 +01:00
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.
2013-02-28 13:54:04 +01:00
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.
2013-02-25 22:25:13 +01:00
Michael DeHaan 1ecf4a6943 Working on complex argument support. 2013-02-17 15:01:49 -05:00