Commit Graph

136 Commits (e366712aca164a6d504695b0e5ea898580ff4654)

Author SHA1 Message Date
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
Kavin Kankeshwar c24f6f438b Avoid ugly formatting due to a long if statement 2013-09-06 22:37:17 -07:00
kavink a075ec9831 Bug fix for a crash, when any_errors_fatal is true
Reported by Rumen:

TASK: [fail FAIL] *************************************************************
skipping: [hostname.com]
failed: [hostname.com] => {"failed": true}
msg: Failed as requested from task
Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 268, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/local/bin/ansible-playbook", line 208, in main
    pb.run()
  File "/Library/Python/2.7/site-packages/ansible/playbook/__init__.py", line 262, in run
    if not self._run_play(play):
  File "/Library/Python/2.7/site-packages/ansible/playbook/__init__.py", line 580, in _run_play
    if (hosts_count - len(host_list)) > int((play.max_fail_pct)/100.0 * hosts_count):
TypeError: object of type 'NoneType' has no len()
2013-09-04 18:30:33 -07:00
James Cammarata d05c61d1f0 Merge branch 'devel' into fireball2
Conflicts:
	lib/ansible/playbook/__init__.py
	lib/ansible/playbook/play.py
2013-09-02 21:54:02 -05:00
James Cammarata 637d3070dc Allow default variables to be overridden by inventory variables 2013-08-29 17:21:28 -05:00
James Cammarata 959138d00d Added accelerate_port to plays, and made it configurable 2013-08-28 11:14:58 -05:00
James Cammarata 167f185092 Initial support for running gather_facts through fireball2 2013-08-28 11:14:58 -05:00
James Cammarata 521e14a3ad Fireball2 mode working! 2013-08-28 11:14:58 -05:00
James Cammarata ed3e4aff84 Place retry file in the user's home dir instead of /var/lib/tmp
Addresses CVE-2013-4260: predictable filename used for failed results
in world writable directory.
2013-08-21 11:40:46 -05:00
Kavin Kankeshwar 3f247fcbe3 fixes ansible/ansible#3609 Add max_fail_pct to playbook parameter, to complement serial option, So if total number of failures execeed max_fail_pct * total number of hosts, do not go to the next serial batch 2013-08-20 13:55:22 -05:00
Petr Svoboda e3adfbf5f8 Add tests for undefined variable detection
Tests `test_playbook_undefined_varsX_fail` check if ansible detects
undefined variables when `error_on_undefined_vars` is enabled. These
tests fail without "Improve behavior with error_on_undefined_vars
enabled" patch.

Tests `test_playbook_undefined_varsX_ignore` check if ansible ignores
undefined variables when `error_on_undefined_vars` is disabled.

Also modify PlayBook._run_task_internal() so error_on_undefined_vars is
testable.
2013-08-20 00:40:49 -05:00
René Moser e8272e365d
implemented 'inventory_file' variable. Closes GH-3789. 2013-08-10 13:04:56 +02:00
James Cammarata ceff3b6ba3 Minor modification to set_fact with_items patch
Previous patch was reverted due to the fact that there was an issue
with the results not always being a dictionary (they're sometimes
a unicode string, ie. when the with_items is used with yum). This
minor change corrects that by checking for a dict object.
2013-08-09 07:52:14 -05:00
James Cammarata 8be2fc745b Revert "Check for ansible_facts in results for with_ tasks"
This reverts commit 1a4e6e415e.
2013-08-08 20:32:30 -05:00
Serge van Ginderachter 1a4e6e415e Check for ansible_facts in results for with_ tasks
that loop over a lookup plugin. Fixes #3704 and #3735
2013-08-08 12:30:32 -05:00
Chris Church 6ba4331161 Correctly check for failed status from an async task. Use runner_on_async_failed callback (instead of runner_on_failed) when an async task times out. Add runner_on_async_ok callback when a task is started in fire and forget mode. 2013-08-06 12:42:44 -04:00
Michael DeHaan 56a00e0667 Remove dead code. 2013-08-05 16:13:50 -04:00
Michael DeHaan dec43f7a2b PEP8 indent fix. 2013-08-03 14:54:37 -04:00
Stoned Elipot 841093921b Add extra module path early during playbook parsing.
This should fix issue #3668

Also prevent an extra module path to be added multiple times.
2013-07-28 18:47:26 +02:00
Michael DeHaan 88720516a1 Merge branch 'changed_when' of git://github.com/stoned/ansible into changed_when 2013-07-21 10:14:03 -04:00
Michael DeHaan f592340f7f Merge branch 'playbook-skip-tags' of git://github.com/dekked/ansible into skip_tags 2013-07-21 09:43:23 -04:00
Michael DeHaan 0f4229f6c4 Merge pull request #3462 from stoned/filtererror
Introduce exception AnsibleFilterError and use it in Jinja filters.  Ign...
2013-07-20 09:12:26 -07:00
Tin Tvrtkovic 4a732c1e9f Enabled the use of extra vars in playbook file paths when including playbooks from other playbooks. 2013-07-18 22:45:18 +02:00
Alan Descoins 04349ec362 Added --skip-tags option to ansible-playbook. 2013-07-16 19:43:58 -03: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
Stoned Elipot 2d88c70cd5 Introduce exception AnsibleFilterError and use it in Jinja filters. Ignore this exception when trying to find the name of a task for display (callback) purpose. 2013-07-07 19:18:32 +02:00
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