Commit Graph

110 Commits (c3a8b6ff07541d2acfdb52188901e69b61dee57e)

Author SHA1 Message Date
Serge van Ginderachter 2a7f9df109 add support for callback_plugins/ relative to playbook 2013-06-12 23:54:00 +02:00
Chris Church 3f17a39238 Set current play/task to None for callback context when finished running the current play/task. 2013-06-09 12:17:57 -04:00
Tim Habermaas 4d24faeeb1 Fix grammatical error in error message 2013-05-13 13:22:57 +02:00
Michael DeHaan a81089231e Register skipped tasks so we can at least check their changed/not-changed status. 2013-04-28 10:13:58 -04:00
Michael DeHaan 5af271911b Fix duplicate handler notification issue in 1.2 devel 2013-04-25 21:24:15 -04:00
Michael DeHaan 21fe750cef Flush handlers before pre and post task sections change, but not between task and roles, as this seems
to be confusing to people (and not usually neccessary)
2013-04-24 22:28:06 -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 3e0c33c1fa Empty plays should still gather facts 2013-04-21 17:35:09 -04:00
Stoned Elipot 747c7f0dff handlers must be run once
so remove all occurences of each host from the handlers notified by
lists
2013-04-21 17:23:13 +02: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 53ac0bbec2 Instantiate callback plugins only once so we can set play/task objects on them and they'll stick. 2013-04-20 09:09:35 -04:00
Michael DeHaan d8bf87b008 (A) include errors in inventory scripts should they occur.
(B) allow registration with ignore_errors: True
2013-04-17 22:27:00 -04:00
Michael DeHaan b09ef21ec9 Add code to flag legacy templating like $foo.{bar} as deprecated in favor of Jinja2 {{ foo.bar }} so we
can remove the legacy system at a later date.
2013-04-10 17:52:35 -04:00
Michael DeHaan 29209c4913 Style fixes so "make pep8" is clean. 2013-04-10 16:37:49 -04:00
Michael DeHaan c5d9823467 Fix some items related to playbook includes and indentation. 2013-04-10 15:04:41 -04:00
Michael DeHaan 290780d13f Playbook + with_items was an undocumented feature that was causing problems because it would
evaluate and replace '$item' with ''.  Really it doesn't make sense to include multiple playbooks
via a loop variable, as you can do this with task + with_items already (and it's a simpler code
path).  Given this is undocumented, this removes that feature, and we'll consider next how to
also add 'with_items' support directly to roles.
2013-04-09 20:13:55 -04:00
Michael DeHaan c64f19dc5f Don't set the item variable as eager template replacement will over-replace the variable as an empty string. 2013-04-09 19:57:53 -04:00
Michael DeHaan 61f2668b0a Don't include the '.yml' in the path to the retry files. 2013-04-08 12:38:05 -04:00
Michael DeHaan 0d530f3bf0 Change the retry logic to write a limit file, able to source limit from files by indicating with @filename 2013-04-08 12:36:01 -04:00
Michael DeHaan c695aa2d6a When playbooks fail, attempt to create an inventory file in the inventory directory that allows rerunning
of the playbook against only the hosts that failed.
2013-04-07 23:37:10 -04:00
Junegunn Choi b874027b36 compare the number of available hosts before and after running each task 2013-03-29 13:13:22 +09:00
Junegunn Choi 20a48c6bdf terminate immediately on a failure 2013-03-28 15:17:01 +09:00
Michael DeHaan 42b0e51223 Upgrade callbacks further, now '.play', '.task', and so on are also available! 2013-03-25 22:56:32 -04:00
Michael DeHaan 0d11f53eff Let the callbacks see the playbook and (current) runner objects. 2013-03-25 22:47:06 -04:00
Michael DeHaan 783a12cc0e Resolve merge commit. 2013-03-25 22:32:01 -04:00
Seth Vidal 7687c2caf8 add --step option to ansible-playbooks to let people step through a playbook
one by one - asking for confirmation along the way.

also allows to 'continue' after a certain point
2013-03-11 00:39:05 -04:00
Michael DeHaan 1ecf4a6943 Working on complex argument support. 2013-02-17 15:01:49 -05:00
Michael DeHaan c8878998d1 update some of many copyright dates but we can just do this when editing each file, not super high priority 2013-02-16 15:32:01 -05:00
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.
2013-02-10 13:05:58 -05:00
Michael DeHaan a9162a86f2 Very basic --diff option for showing what happens when templates change.
Probably output is not useful if not used with --limit

Works well with --check mode
2013-02-07 22:52:25 -05:00
Michael DeHaan fed82c2188 This implements a basic --check mode which for now is only implemented on template & copy operations. More detail will be shared with the list
shortly.
2013-02-03 20:34:13 -05:00
Daniel Hokka Zakrisson a79373f6b2 Make template_ds the only templater
Instead of having to remember when to use which one, rename template_ds
to template and move the last bit of code from template to varReplace
(which gets used for all string replacements, in the end).

This means that you can template any data type without worrying about
whether it's a string or not, and the right thing will happen.
2013-02-03 14:01:54 +01:00
Seth Vidal 83b9654c63 stop updating SETUP_CACHE in run_play as per comment on pr 1945 2013-01-31 11:24:22 -05:00
Seth Vidal f649777072 - make extra-vars override all other vars and facts in playbooks 2013-01-30 11:56:04 -05:00
Daniel Hokka Zakrisson 3a36c024da Make lookups being fatal up to the caller
Fixes #1769.
2012-12-19 19:19:04 +01:00
Daniel Hokka Zakrisson 97cc384ccf Set basedir to . if there isn't one
This avoids special-casing '' = '.' everywhere the basedir gets used.
Fixes #1729.
2012-12-19 13:22:57 +01:00
Daniel Hokka Zakrisson c2792a936d Allow parameterized playbook includes to define complex variables
To be used like:
- include: playbook.yml
  vars:
    mylistvar:
    - item1
    - item2
2012-12-15 21:56:28 +01:00
Daniel Hokka Zakrisson b8d6dec5ad Reset notified_by list per serialized batch
Fixes the case where a handler attempts to run for every batch after any
batch has notified it, regardless of whether the current batch did.
2012-11-28 22:04:44 +01:00
Daniel Hokka Zakrisson a56e1f31fa Properly restrict hosts after 9070875 2012-11-28 22:03:23 +01:00
Daniel Hokka Zakrisson 9070875a6f Move available hosts gathering to a common function 2012-11-28 01:03:18 +01:00
Daniel Hokka Zakrisson 5065103017 Skip already failed hosts
Fixes #1699.
2012-11-28 00:54:08 +01:00
Daniel Hokka Zakrisson c948c65bcd Template the name of the task
Broken by 1e0295c. Fixes #1698.
2012-11-28 00:36:10 +01:00
Daniel Hokka Zakrisson 900790af41 Reuse inventory object created by ansible-playbook in playbook
This reduces the amount of times an inventory script has to be invoked.
2012-11-27 15:24:33 +01:00
Daniel Hokka Zakrisson 1e0295c7e2 Template handlers late
This allows overriding variables in name, and removes templating from
parsing.
2012-11-26 22:07:57 +01:00
Daniel Hokka Zakrisson e44b85daba Remove special-casing for all group
global_vars has higher precedence than inventory. Putting the all
group's variables into it overrides all other groups and hosts.

Partially fixes #1647.
2012-11-23 00:54:02 +01:00
Daniel Hokka Zakrisson ef357ed1f2 Use the play's vars for the setup step
Allows using -e ansible_ssh_port=foo and have it apply to all actions.
2012-11-21 23:42:24 +01:00
Daniel Hokka Zakrisson f95fefd8c5 Use plugin system to find modules 2012-11-18 19:09:21 +01:00
Michael DeHaan d500398e76 Merge pull request #1616 from dagwieers/skip-register
Do not register variable if host has been skipped
2012-11-14 06:33:30 -08:00
Dag Wieers 302eeae65d Do not register variable if host has been skipped
Executive summary: skipping a host corrupts a variable (when it is registered)

We have a play existing out of multiple tasks that check a condition, if one of these tasks fails we want to skip all next tasks in the playbook. I noticed that if we skip a task because a certain condition is met, and this task has a register-attribute, I loose the value in the variable. Which means we cannot use that variable in subsequent tasks to evaluate because it was skipped:

```
- action: command test -d /some/directory
  register: task

- action: command test -f /some/directory/file
  register: task
  only_if: '${task.rc} == 0'

- action: do something else
  only_if: '${task.rc} == 0'
```

In the above example, if the second task is skipped (because the first failed), the third action will end with a "SyntaxError: invalid syntax" complaining about the unsubstituted ${task.rc} (even though it was set by the first task and used for skipping the second).

The following play demonstrates the problem:

```
- name: Test register on ignored tasks
  hosts: all
  gather_facts: no

  vars:
    skip: true
    task: { 'rc': 666 }

  tasks:
  - action: debug msg='skip = ${skip}, task.rc = ${task.rc}'

  - name: Skip this task, just to test if task has changed
    action: command ls
    register: task
    only_if: '${skip} != True'

  - action: debug msg='skip = ${skip}, task.rc = ${task.rc}'

  - name: Now use task value
    action: command echo 'Works !'
    only_if: '${task.rc} == 0'
```

And the enclosed fix, fixes the above problem.
2012-11-13 16:57:10 +01:00