Abhijit Menon-Sen
5887e96b27
Introduce a connection locking infrastructure
...
The lock file is (a temporary file) opened in the parent process, whose
open fd is inherited by the workers after fork, and passed down through
the PlayContext. Connection grows lock/unlock methods which can be used
by individual connection plugins.
2015-09-03 08:43:21 +05:30
James Cammarata
843138e7d9
Merge pull request #12202 from mgedmin/py3k
...
Use rich comparisons for Attribute and FieldAttribute
2015-09-02 13:57:04 -04:00
Brian Coca
a7231c2203
actually implemented flags correctly for all priv escalation methods
2015-09-02 11:31:39 -04:00
Brian Coca
b9642585bd
added missing become_exe from config
2015-09-02 09:52:26 -04:00
Brian Coca
e156d9b677
fixed and generalized privilege escalation exe settings
2015-09-02 09:29:34 -04:00
Marius Gedminas
33a374edde
Use rich comparisons for Attribute and FieldAttribute
...
Because __cmp__ is not supported on Python 3.
2015-09-02 12:33:42 +03:00
Marius Gedminas
ca908f2e12
Fix indentation to be a multiple of 4
2015-09-02 12:22:18 +03:00
James Cammarata
3d282cd1b0
Also always post_validate Handler class as well
...
Fixes #12154
2015-09-01 11:02:42 -04:00
James Cammarata
0859ba7726
Adjust field loading order for vars and tweak post_validate exclusion logic
...
FieldAttributes will now by default not be post_validated unless a flag
is set on them in the class, as a large number of fields are really there
simply to be inherited by Task/PlayContext and shouldn't be templated too
early.
The other (unrelated to the base issue) in #12084 is also fixed here, where
the roles field is loaded before vars/vars_files, meaning there are no vars
yet loaded in the play when the templating occurs.
Fixes #12084
2015-08-28 15:56:42 -04:00
Toshio Kuratomi
120243d36d
Fix python3.4 syntax
2015-08-28 10:30:27 -07:00
Brian Coca
514fa73fcd
galaxy fixes
2015-08-28 12:32:50 -04:00
James Cammarata
5a5b9f211b
Validate variable names when loading 'vars:' blocks
...
TODO: add this to VariableManager to validate vars loaded from files too
Fixes #12022
2015-08-28 11:36:31 -04:00
Marius Gedminas
df1b41d3d3
Avoid types.NoneType
...
types.NoneType was removed in Python 3.
None is a singleton in Python, so 'x is None' is equivalent to
'isinstance(x, NoneType)'.
2015-08-27 22:15:56 +03:00
Marius Gedminas
47b088504d
Don't mix tabs and spaces
...
It's not allowed in Python 3 and merely a bad idea in Python 2.
2015-08-27 22:15:04 +03:00
Marius Gedminas
0c6ce31f76
Use 'except ... as' syntax
...
This syntax works on Python 2.6 through 3.x. lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
James Cammarata
50448d68e1
Implement max_fail_percentage and any_errors_fatal support
...
Fixes #11997
2015-08-26 12:03:47 -04:00
James Cammarata
af41ba929c
Add float and percent types for FieldAttributes
...
Also sets the max_fail_percentage value to the percent type.
2015-08-26 12:03:47 -04:00
James Cammarata
601a1cc6d9
Multiple fixes for include statements and blocks in general
...
Fixes #11981
Fixes #11995
Fixes #12039
Fixes #12077
2015-08-26 02:23:22 -04:00
Brian Coca
ae91cdfc98
fixed environment inheritance
2015-08-25 10:15:32 -04:00
Brian Coca
8aa732e0a4
allow for lists, sets and dicts to default to None, now return empty type in post processing
...
remove defaults from inhertiable fieldattributes to allow for proper detection and override
2015-08-25 10:14:28 -04:00
Marius Gedminas
44c94328c8
Speed up execution
...
`if method in dir(self):` is very inefficient:
- it must construct a list object listing all the object attributes & methods
- it must then perform a O(N) linear scan of that list
Replace it with the idiomatic `if hasattr(self, method):`, which is a
O(1) expected time hash lookup.
Should fix #11981 .
2015-08-25 16:07:21 +03:00
James Cammarata
21e421ce53
Validate required list items are not None or empty strings
...
Fixes #12011
2015-08-24 11:44:28 -04:00
Brian Coca
7a4a156d91
changed local_action to alias to connection=local vs delegate_to=localhost
...
fixes #11998 , but still leaves issue of delegate_to: localhost not working
2015-08-18 18:31:29 -04:00
Brian Coca
ee21ebaffc
Merge pull request #11975 from mutemule/become_doas
...
Add become support for OpenBSD doas
2015-08-17 21:36:03 -04:00
Damian Gerow
1c5611100e
Add become support for OpenBSD doas
2015-08-17 21:31:18 -04:00
James Cammarata
e7b2308b66
Performance improvements
...
* Speed up serialization of hostvars by simply using the internal
dictionary used for cached lookups
* Use blocking gets/puts on queues instead of spin locking
* Merge sequential implicitly created blocks
2015-08-17 13:46:57 -04:00
Brian Coca
f048aca5f6
runas placeholder
2015-08-16 02:37:21 -04:00
Brian Coca
49eb95e2d1
some fixes to become/sudo
...
* now it uses -n to get immediate error if no password is supplied and one is needed,
this should fix the issue with sudo hanging waiting for input.
* made -k configurable, this can break changing become_users in play if left out,
but opens up the possiblity of OTP support.
2015-08-15 12:17:40 -04:00
James Cammarata
4714cbeec8
Override post validation of environment to allow bare variables
...
Also prints a deprecated warning if a bare variable is detected, so
that we can remove this in a future version.
Fixes #11912
2015-08-14 00:33:36 -04:00
James Cammarata
6c036c3633
Template parent include file paths
...
Fixes #11955
2015-08-13 13:01:45 -04:00
James Cammarata
a498876bec
Make sure playbook includes use unique var dictionaries before modification
2015-08-12 23:38:47 -04:00
James Cammarata
dd67b1e4d6
Adjust relative include searches when roles are involved
...
Fixes #11895
2015-08-12 17:15:52 -04:00
James Cammarata
ac66e4001c
Fix for variable precedence with tasks/includes
...
Fixes #11881
2015-08-12 10:49:45 -04:00
James Cammarata
829a88b906
Disable undefined error failures during conditional templating
...
This allows us to properly catch the 'is defined' and 'is undefined'
checks and return the correct boolean result.
Fixes #11892
2015-08-12 07:37:03 -04:00
James Cammarata
adb9d7e461
Track role execution per-host, not overall in the role
...
Fixes #11863
Fixes #11878
2015-08-11 16:34:58 -04:00
James Cammarata
169d316704
Fixing bugs in include + loops
...
Fixes #11872
2015-08-11 01:33:43 -04:00
James Cammarata
e7d0c9f820
Re-add vars to Base and standardize var processing
...
Fixes #11779
2015-08-07 00:06:30 -04:00
Brian Coca
dbe7a9fe2f
Merge pull request #11857 from quinot/bug/playbook-init-comment
...
Minor comment fix
2015-08-06 23:39:08 -04:00
James Cammarata
5eb092b331
Handle top-level vars for include tasks to match v1 syntax
...
The "streamlined" syntax will be deprecated at some point in the future.
Fixes #11882
2015-08-06 17:21:02 -04:00
James Cammarata
37e38924de
Allow field attributes to have priorities
...
So that roles are loaded ahead of all other play fields, meaning any
plugins contained within the roles are loaded first before tasks.
Fixes #11858
2015-08-05 13:54:00 -04:00
Thomas Quinot
5d3cb636ad
Minor comment fix
2015-08-05 11:30:26 +02:00
James Cammarata
61e76fd707
Allow conditionals on PlaybookInclude statements
...
Fixes #11852
2015-08-04 15:24:28 -04:00
James Cammarata
5266679964
Use templar all the way down
...
Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.
Fixes #11815
2015-08-04 12:25:53 -04:00
James Cammarata
c3ce140dd2
Exclude loop_args from post_validation for tasks
...
This field is templated specially during the TaskExecutor's loop
calculation, so there's no need to post validate it again.
Fixes #11481
2015-08-04 01:12:27 -04:00
Brian Coca
015b922c1f
fix quoting for become commands
...
fixes #11808
2015-08-03 18:49:23 -04:00
James Cammarata
8279557e8f
Allow role names to be templated
...
Fixes #10858
2015-08-03 16:26:13 -04:00
James Cammarata
bcbcfc79be
Fix relative paths for included files
...
Also modifies the Play class to not include become* fields in the
post-validation step.
Fixes #11353
2015-08-03 12:04:31 -04:00
Abhijit Menon-Sen
a9b020d6de
Remove TODO: the play already overrides options
2015-08-01 20:09:02 +05:30
Abhijit Menon-Sen
7b3cb2126c
Remove outdated FIXME; ROLE_CACHE is already implemented below
2015-08-01 09:34:32 +05:30
Toshio Kuratomi
d1933accc3
Fixes for synchronize with delegate_to
2015-07-31 17:41:41 -07:00
Brian Coca
fa8043c0ba
corrected typo
2015-07-31 13:49:48 -04:00
Brian Coca
f16b745f17
now properly uses default port if defined
2015-07-31 12:01:58 -04:00
James Cammarata
efcad3aa6d
Re-allow vars on tasks, specifically for includes
2015-07-30 14:14:49 -04:00
James Cammarata
782c2f75df
Make sure role deps inherit conditionals/tags specified via params
...
Fixes #7353
2015-07-29 14:49:08 -04:00
James Cammarata
71867f9480
Remove vars attribute from base
...
Fixes #11779
2015-07-29 09:45:30 -04:00
Brian Coca
cc85473c1e
show role search path when not finding a role
...
fixes #9770
2015-07-28 19:07:47 -04:00
James Cammarata
42cfacf83b
Switch up the task/host overrides for PlayContext to use the compiled vars dict
...
Fixes #11436
2015-07-28 16:25:44 -04:00
Brian Coca
0b6fadaad7
started implementing diff
...
diff now works with template
also fixed check mode for template and copy
2015-07-26 12:22:22 -04:00
James Cammarata
7bc789ba64
Properly template task names
...
Also fixes in the correct way the bug in which the role name was
incorrectly showing up twice in the task name.
Fixes #10347
2015-07-23 15:45:36 -04:00
James Cammarata
37ed756d66
Make sure role names are strings
...
Fixes #10497
2015-07-23 15:26:31 -04:00
Toshio Kuratomi
f8e4aff4c1
Cleanups:
...
* Don't reference __class__ when we can use the instance itself
* use isdisjoint() as it can stop once a match is found
* Remove a condtional that was taken care of in the conditonal just above
2015-07-23 12:13:45 -07:00
James Cammarata
4b6525fb58
Fix handler flushing to match how v1 worked
...
Also adds meta tasks to the list of tasks excluded from tag filtering
Fixes #11574
2015-07-22 11:21:38 -04:00
James Cammarata
135404738e
Fix a couple start-at-task issues
...
* added pattern matching to match v1 functionality
* check the task name, not the task+role name for matches
* make sure the input is unicode
Fixes #11692
2015-07-22 07:45:03 -04:00
James Cammarata
975172c1ef
Make sure role name doesn't end up in task name more than once
...
Fixes #11691
2015-07-22 07:28:25 -04:00
James Cammarata
66a8864ae9
Fix environment setting and inheritence
...
Fixes #11401
2015-07-21 13:57:30 -04:00
James Cammarata
91519d1696
Don't filter include tasks based on tags
...
Fixes #11320
2015-07-21 12:37:22 -04:00
James Cammarata
e64989beb4
Moving ConnectionInformation -> PlayContext
...
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation
Fixes #11381
2015-07-21 12:13:50 -04:00
James Cammarata
5347db2952
Also check the play basedir for the role
...
Fixes #11328
2015-07-20 14:47:38 -04:00
James Cammarata
dca36c1d16
Reestablishing the use of tags/when for role duplication detection
...
Not figuring these in can cause problems with "diamond" pattern relationships,
even though this is still not quite optimal.
2015-07-20 14:37:20 -04:00
Pierre-Louis Bonicoli
8c392a94b7
Play.get_name: remove prefix, return name only
2015-07-20 12:41:39 +02:00
Abhijit Menon-Sen
28e2eae902
Make gathering=explicit work again
...
There was a confusion between the valid values for defaults.gathering
(explicit/implicit/smart) and a play's gather_facts setting (boolean),
which resulted in gathering=explicit being ignored.
2015-07-17 13:05:00 +05:30
James Cammarata
86a83c16b8
Remove some dead code from the base load_data method
...
Was causing an odd error which threw off the error detection code
when the datastructure was a string corresponding to a variable.
2015-07-16 15:10:41 -04:00
James Cammarata
052f3c2ece
Fixing allow_duplicate and variable resolution bugs
...
Fixes #11205
2015-07-16 11:39:40 -04:00
James Cammarata
9fe0f21f6a
Allow omit to be used on Playbook-level fields
...
Fixes #11173
2015-07-15 13:53:59 -04:00
James Cammarata
f40b66d841
Make sure the basedir is unicode
...
Fixes #10773
2015-07-12 16:40:00 -04:00
James Cammarata
c5c1dc2f11
Removing tags/when from role param hash calculation
2015-07-11 21:49:35 -04:00
James Cammarata
f8ddf2eb04
Move role cache into the play to avoid roles crossing play boundaries
2015-07-10 02:43:53 -04:00
James Cammarata
b520d5bc60
Lots of fixes for integration test bugs
2015-07-10 01:53:59 -04:00
Brian Coca
b5f3e84014
now allows for empty vars sections, returns empty dict
...
fixes #11532
2015-07-08 22:45:01 -04:00
James Cammarata
2e5dfd57cc
Clear flag indicating role had run before each play is run
...
Fixes #11514
2015-07-07 21:47:48 -04:00
James Cammarata
1d8ccfb99f
Fixing includes where the included file is "{{item}}"
2015-07-06 14:30:56 -04:00
James Cammarata
7c1d569a26
Make sure tags are pulled out of playbook includes properly
...
Fixes #9862
2015-06-30 16:09:04 -04:00
James Cammarata
0cfebb8760
Fixes a bug whereby tags are expected to be a set
...
Fixes #11424
Fixes #11429
2015-06-30 07:18:41 -04:00
James Cammarata
927072546b
Fixing up some issues with plugin loading
2015-06-29 22:49:25 -04:00
James Cammarata
24226646fc
When loading the play hosts list, enforce some consistency
...
Fixes #9580
2015-06-28 01:00:32 -04:00
James Cammarata
9d9cd0c42c
Handle getting the ds for Conditionals which may not be mixed in
2015-06-28 00:30:27 -04:00
James Cammarata
8ef28253e3
Properly catch and report conditional test failures
2015-06-27 15:37:10 -04:00
James Cammarata
0eb1c880dd
Use itertools instead of set for tags, as the data may not hash well
...
The tags field may contain bad data before it is post_validated, however
some methods assumed it would be a simple list or string. Using itertools
gets us around the problem of the data potentially not being hashable
Fixes #9380
2015-06-27 15:19:44 -04:00
James Cammarata
bb8d87ceb6
Allow field attributes which are lists to validate the type of the list items
...
Starting to apply this for tags too, however it is not correcting things
as would be expected.
2015-06-27 01:01:51 -04:00
James Cammarata
f68223b9ed
Don't add module args into variables at all
...
Getting recursive errors otherwise, so this is probably not something
we want to do. This most likely only worked in v1 due to the fact that
module args were templated earlier than the point in Runner() when
they were fed into the templating engine.
2015-06-27 01:01:51 -04:00
James Cammarata
332ca927d9
Fix parent attribute lookup
...
Using 'value is None' instead of 'not value', in order to account
for boolean values which may be false
Fixes #11232
2015-06-24 20:57:53 -04:00
James Cammarata
d0d9be30d5
Correctly compile handler blocks for dependent roles
2015-06-23 15:48:48 -04:00
James Cammarata
72d4b40a26
Don't allow empty (none) loop values
...
Fixes #8593
2015-06-23 10:42:33 -04:00
James Cammarata
24d2202591
Make sure role parsing can handle a few more types in includes/defs
2015-06-23 10:20:09 -04:00
James Cammarata
aa53212a9b
Don't use all task params for vars, just the module args
2015-06-23 10:20:09 -04:00
James Cammarata
cb5f630f33
Don't post_validate vars and vars_files on Play objects
...
Fixes #11343
2015-06-22 11:23:23 -04:00
Benno Joy
be81b650e8
fixes issue 11286 where role handlers are not run
2015-06-21 00:36:37 -04:00
James Cammarata
c0dfa8d512
Make sure task names are templated before callbacks are sent
2015-06-18 14:27:20 -04:00
James Cammarata
ff998b6022
Make sure the templar is using the right vars when evaluating conditionals
2015-06-17 00:10:11 -04:00
Brian Coca
a267f93c83
removed incorrect assumption on become user being set
2015-06-14 21:05:23 -04:00
Matt Martz
6a1c175991
Raise AnsibleParserError instead of AssertionError
2015-06-06 09:16:38 -05:00
Brian Coca
d67c9858a9
removed become_pass as it should not be used
2015-06-05 18:43:42 -04:00
James Cammarata
f3f3fb7c49
Fixing vars_prompt
2015-06-04 13:54:51 -04:00
Matt Martz
f983557e7e
Don't set a default on the _become FieldAttribute. Fixes #11136
2015-06-03 09:54:00 -05:00
James Cammarata
7985d2a8be
Moving included file stuff to a proper dedicated class and file (v2)
2015-05-28 23:58:38 -05:00
James Cammarata
4d999f8fe0
Fix logic error in parent attribute retrieval for blocks/roles (v2)
2015-05-12 15:08:35 -05:00
James Cammarata
1ca8cb8553
Fixing up v2 unit tests
2015-05-12 12:24:57 -05:00
James Cammarata
7b1c6fbab9
Fix playbook includes so tags are obeyed (v2)
2015-05-11 12:48:03 -05:00
Brian Coca
56c9614e74
made playbook include taggable, removed unused conditional import
2015-05-08 14:26:06 -04:00
James Cammarata
50542db0be
Make the default playbook name an empty string (v2)
2015-05-06 02:56:52 -05:00
James Cammarata
fba5588028
Handle empty role definitions in YAML (v2)
2015-05-05 13:17:04 -05:00
James Cammarata
803fb397f3
Fixing filter plugins directory from switch
2015-05-04 01:33:10 -05:00
James Cammarata
ce3ef7f4c1
Making the switch to v2
2015-05-03 21:47:26 -05:00
Carlos E. Garcia
cfbfd38723
just a few spelling error changes
2015-04-28 09:36:42 -04:00
James Cammarata
f4172fb9da
Fix tag handling on meta:flush_handlers tasks
...
Fixes #10758
2015-04-17 13:02:09 -05:00
Jesse Rusak
652cd6cd5e
Fix --force-handlers, and allow it in plays and ansible.cfg
...
The --force-handlers command line argument was not correctly running
handlers on hosts which had tasks that later failed. This corrects that,
and also allows you to specify force_handlers in ansible.cfg or in a
play.
2015-04-10 19:38:59 -04:00
Brian Coca
0d1e2e74a1
converted error on play var initialization into warning with more information
2015-03-31 23:07:03 -04:00
Brian Coca
662b35cbce
readded sudo/su vars to allow role/includes to work with passed sudo/su
2015-03-27 18:30:42 -04:00
Brian Coca
fd2d7fe447
Merge pull request #10290 from bcoca/remove_bare_warning
...
removed bare variable detection as this confuses people
2015-03-18 20:43:56 -04:00
Brian Coca
bbdcba53da
fixed bug on using su on play level not setting become method correctly
2015-03-16 19:37:03 -04:00
Brian Coca
a675b10b3b
Merge pull request #10329 from bcoca/var_merge_combined
...
changed from hash_merge to combine vars which resets default to
2015-03-12 10:58:12 -04:00
Brian Coca
de5eae2007
fixed traceback when x_user implicitly sets the become method
...
Fixes #10430
Also removed redundant resolution of sudo/su for backwards compatibility which
confused the conflict detection code.
2015-03-11 12:18:53 -04:00
Brian Coca
5f6db0e164
preliminary privlege escalation unification + pbrun
...
- become constants inherit existing sudo/su ones
- become command line options, marked sudo/su as deprecated and moved sudo/su passwords to runas group
- changed method signatures as privlege escalation is collapsed to become
- added tests for su and become, diabled su for lack of support in local.py
- updated playbook,play and task objects to become
- added become to runner
- added whoami test for become/sudo/su
- added home override dir for plugins
- removed useless method from ask pass
- forced become pass to always be string also uses to_bytes
- fixed fakerunner for tests
- corrected reference in synchronize action plugin
- added pfexec (needs testing)
- removed unused sudo/su in runner init
- removed deprecated info
- updated pe tests to allow to run under sudo and not need root
- normalized become options into a funciton to avoid duplication and inconsistencies
- pushed suppored list to connection classs property
- updated all connection plugins to latest 'become' pe
- includes fixes from feedback (including typos)
- added draft docs
- stub of become_exe, leaving for future v2 fixes
2015-03-10 18:42:36 -04:00
Toshio Kuratomi
89159951dc
Fix name of a task containing a template causing traceback
...
Workaround for #10321 Need to fix better in v2
2015-02-26 14:05:33 -08:00
Brian Coca
c81d981164
Merge pull request #10183 from bcoca/tag_control
...
adds complex tag management
2015-02-25 10:36:11 -05:00
Brian Coca
4fa51652b4
fixed typoe in combined_Vars
2015-02-24 05:26:41 -05:00
Brian Coca
ce764063f1
corrected merge vs combined in all pertinent sections
2015-02-24 05:14:22 -05:00
Toshio Kuratomi
920b71984e
lists => frozenset as we're only using them in membership checks
2015-02-23 07:09:33 -08:00
Brian Coca
7044b5a8d1
removed bare variable detection as this confuses people and forced us to allow for bare expressions
2015-02-19 08:29:53 -05:00
Brian Coca
f6a6df2169
removed unused method
2015-02-13 08:27:35 -05:00
Brian Coca
65c08d1364
added tests
...
refactored task selection into method
list-tasks now uses common method of task selection
always is now skippable if specified in --skip-tags
2015-02-13 08:27:07 -05:00
Brian Coca
6fbbf9c118
simplified if conditions
2015-02-13 08:27:07 -05:00
Brian Coca
6579c5ddf5
fixed skipped tags
2015-02-13 08:27:07 -05:00
Brian Coca
95fa770ba0
adds complex tag management
...
Adds a special tag:
- always: always runs no matter what --tags, --skip-tags say
Adds 4 special keywords for --tags/skip-tags
- all: all tagged + untagged tasks
- tagged: only tagged tasks
- untagged: only untagged tasks
- always: only run tasks tagged 'always'
2015-02-13 08:27:07 -05:00
Brian Coca
cbbe2f4e26
more resilient errors for bad host declarations in play
...
should fix #10148
2015-02-03 10:26:48 -05:00
Brian Coca
540d13cf52
Merge pull request #9404 from mmoya/configure-retry-files
...
Configure retry file usage and location
2015-01-30 15:14:27 -05:00
Brian Coca
1698b17b14
Merge pull request #8651 from ks888/enable-env-kw-at-play-level
...
Enable environment keyword at play level
2015-01-02 11:07:35 -05:00
James Cammarata
f1386bb114
Use more variable sources when templating the play ds
...
Fixes #9699
2014-12-03 12:44:32 -06:00
James Cammarata
6570a6c6de
Use additional vars when templating included file names
...
Fixes #9669
2014-12-01 15:00:14 -06:00
Hagai Kariti
bc505050b0
Don't template play vars by themselves, it's too early
2014-11-26 15:45:38 +02:00
James Cammarata
968c56d765
Expand playbook_dir in time for loading tasks
...
Fixes #9618
2014-11-25 13:01:08 -08:00
Kishin Yagami
ac4dc1f739
enable environment keyword at play level
2014-11-22 10:41:13 +09:00
James Cammarata
4b6b58ab11
Fix role parameter precedence after 9a0f8f0
...
Fixes #9497
2014-11-20 12:53:48 -06:00
James Cammarata
9a0f8f0158
Split out various vars-related things to avoid merging too early
...
Fixes #9498
2014-11-17 15:31:55 -06:00
Maykel Moya
c15b47fb7b
Configure retry file usage and location
...
Adds new settings for managing retry files:
* retry_files_enabled, defaults to True
* retry_files_save_path, defaults to ~/.ansible-retry
This change was adapted from PR #5515 .
2014-10-23 00:38:30 +02:00
James Cammarata
12d5b75a43
Template play vars after reading them
...
Fixes #9242
2014-10-06 10:50:55 -05:00
James Cammarata
0c40c6c23c
Fix order of resolving dependent role variables from vars files
...
Also adds a new class to the test_var_precedence test to check for
this type of error in the future.
Fixes #9178
2014-10-03 13:30:47 -05:00
James Cammarata
313f26f866
Fix issue with vars precedence from roles
...
Fixes #9219
2014-09-30 15:50:46 -05:00
Toshio Kuratomi
cf548baeab
Fix missing strip() in a1809a371a
2014-09-29 18:07:55 -04:00
Toshio Kuratomi
a1809a371a
Target unnecessary templating warning at lines consisting of a single variable
...
Fixes #6407
2014-09-29 17:56:44 -04:00
James Cammarata
c4f1785217
Use split_args instead of shlex to split include params
...
Fixes #8947
2014-09-23 16:12:01 -05:00
James Cammarata
8cc3543918
Re-allow templating of complex_args, but count params to prevent injection
...
Fixes #8810
2014-09-05 14:24:05 -05:00
James Cammarata
14b8e2cf01
Make sure set_fact variables go into VARS_CACHE
...
Fixes #8758
2014-09-03 09:39:50 -05:00
Will Thames
ada9074276
Allow installation of roles from yaml roles file
...
Added docs
Added more tests
Improved how roles are returned from the parsers
2014-08-21 17:15:23 -04:00
Will Thames
46b59b02ed
Friendly Role Names and roles from URLs
...
* Roles can now be given a friendly name as third field in role spec csv
* Roles can be installed from URL (not just from archived SCMs)
* Integration tests to demonstrate this
* Unit tests to ensure that role spec parsing works as expected
2014-08-21 17:15:23 -04:00
Will Thames
1803976a40
Ensured that role version can be specified in role dependencies
2014-08-21 17:15:23 -04:00
Will Thames
c2fe33f9f4
Tidied up a little, added tests
...
Moved repo_url_to_role_name to common method in ansible.utils
Added unit test for repo_url_to_role_name
Added integration tests for galaxy
2014-08-21 17:15:23 -04:00
Will Thames
b550cb9bc3
Need to take URLs into account when running playbooks too
...
Ensure that if meta/main.yml has dependencies containing URLs
these are correctly resolved at playbook runtime.
Update role_name during run time so that output of e.g. task names
look sensible
2014-08-21 17:15:23 -04:00
Serge van Ginderachter
7051cdeb57
roles: make role_path (path of current role) available as variable to the task
2014-08-21 11:56:27 +02:00
James Cammarata
8a1fbed5d6
Correct variable blending from vars_files with hostvars in them
...
Fixes #8638
2014-08-20 15:49:01 -05:00
James Cammarata
8a5675ca9f
Fixing no_log for the playbook level use
...
Fixes #8647
2014-08-19 10:35:01 -05:00
James Cammarata
ca6db40cb4
When serializing inventory, pop from the start of the hosts list
...
Fixes #8646
2014-08-19 09:04:47 -05:00
James Cammarata
542f07128e
Correct check for role library/ existence
...
Fixes #8633
2014-08-18 13:33:23 -05:00
James Cammarata
a01d97f12b
Fixing variable name bug introduced in ac8950f
...
Fixes #8617
2014-08-14 10:55:26 -05:00
James Cammarata
fc7859f445
Make sure playbook_dir variable is an absolute path
...
Fixes #8317
2014-08-12 09:51:44 -05:00
James Cammarata
ac8950fd36
Set special vars in play.vars rather than load_vars
...
Also refactors playbook loading code relating to vars in playbooks
to a sub-function.
Fixes #8534
2014-08-11 19:23:54 -05:00
James Cammarata
783a1e3dfc
Fixing broken patch 20957a1
...
Also adds integration tests for nested includes with conditionals
2014-08-11 14:58:48 -05:00
James Cammarata
20957a1b85
Remove duplicate compiling of task when: statements
...
Fixes #8538
2014-08-11 13:23:07 -05:00
Josh Drake
aa419044c4
WIP on the re-implementation of fact caching and various backends.
2014-08-11 12:23:05 -04:00
James Cammarata
a650421e39
Catch task parameter splitting errors nicely
...
Fixes #8481
2014-08-11 10:16:58 -05:00
hoettle
4243ce61b3
Correct placement of right parenthesis.
...
(serial_pct)/100.0 is a typo - the parentheses should be around the entire percentage calculation, which makes much more sense when multiplying by the number of hosts (luckily BODMAS prevailed).
2014-08-08 13:46:57 -04:00
Howard Oettle
cbf0bd6baf
playbook: permit the serial attribute to be a pecentage string as well as well as a straight integer
2014-08-08 13:46:57 -04:00
Michael DeHaan
8c4161d4a1
Merge branch 'retf_py' of git://github.com/berendt/ansible into devel
...
Conflicts:
lib/ansible/inventory/vars_plugins/group_vars.py
plugins/callbacks/mail.py
2014-08-08 12:17:37 -04:00
Michael DeHaan
48a0236ec6
Merge pull request #6619 from sergevanginderachter/ansible_version_var
...
Introduce an ansible_version dict as runner variable
2014-08-08 11:20:17 -04:00
James Cammarata
e19ed3424d
Make sure default vars are used in template calls for tasks
...
Fixes #8499
2014-08-07 13:28:09 -05:00
James Cammarata
80df2135e9
Fix parsing of tasks with variable module names
...
Also adding an integration test for same.
2014-07-30 14:18:06 -05:00
James Cammarata
e6fa50a306
Move splitter to module_utils so modules can use it and fix command arg splitting
...
Fixes #8338
2014-07-29 14:55:16 -05:00
James Cammarata
6e814566de
Unquote params passed to an include statement
...
Fixes #8315
2014-07-28 16:35:52 -05:00
James Cammarata
6eac47e519
Use split_args instead of shlex.split for included params
...
Fixes #8296
2014-07-26 00:30:42 -05:00
James Cammarata
b21875d5a9
Make sure 'item' variable is set when using first_available_file
...
Fixes #8220
2014-07-24 00:05:26 -05:00
Michael DeHaan
0fad9575e9
Refine error message about invalid ops since people forget to indent tasks fairly often.
2014-07-17 10:13:10 -04:00
James Cammarata
e74853300a
Merge branch 'task-host-loop-bypass' of https://github.com/sivel/ansible into sivel-task-host-loop-bypass
2014-07-14 14:21:25 -05:00
James Cammarata
fe892fccb1
Merge remote-tracking branch 'svg/varsplugins_refactor' into svg_and_inventory_refactor
2014-07-07 14:16:37 -05:00
James Cammarata
ff04b2b532
Allow empty yaml vars files
...
Fixes #7843
2014-07-04 23:10:32 -05:00
Chris Church
4e98e3785a
Reset play attribute on callback plugins when a play fails.
2014-07-01 17:02:10 -04:00
James Cammarata
6d9cc64e0f
Add role_names to valid keys entry for plays
...
Prevents a "not a legal parameter" error for play ds structures that
may be passed into the Play() constructor, which really is mainly a
concern during tests.
2014-06-16 10:00:43 -05:00
James Cammarata
82a784931e
Fix error passing play vars to an included playbook with empty vars
...
Fixes #7658
2014-06-04 13:22:50 -05:00
James Cammarata
74f20ebf79
Removing cruft leftover from the deprecation of include+with_items
...
Also cleaning up integration tests that had checks for the empty item
attribute in certain results.
Fixes #7535
2014-06-03 13:33:26 -05:00
James Cammarata
cfd8c685d1
Correct issue of handlers running on all hosts incorrectly
...
Also adds an integration test to catch this bug in the future.
Fixes #7559
2014-05-27 12:03:08 -05:00
James Cammarata
e36a8d466e
Don't re-query inventory when trimming failed/dark hosts
...
Since the filter list contains hosts, passing that back to list_hosts()
in the inventoy causes issues when the hostname is an IPv6 address
(with :'s interpreted as group unions). Since we already have the list
of hosts, we should not need to pass that back through inventory a
second time.
Fixes #7446
2014-05-20 14:58:37 -05:00
Matt Martz
0e953c2863
Add run_once task key
...
This caused the task to act like bypass host loop plugin and
execute only on a single host. Can be used with delegate_to
2014-05-19 12:33:47 -05:00
James Cammarata
7faecd54b0
Merge pull request #7388 from jimi-c/issue_7384_vars_files_include
...
Pass vars_files on to included playbooks too
2014-05-14 14:52:33 -05:00
James Cammarata
525e7339ed
Merge branch 'pass-basedir-to-runner-on-setup' of https://github.com/ByteInternet/ansible into ByteInternet-pass-basedir-to-runner-on-setup
2014-05-14 09:46:47 -05:00
James Cammarata
85bd6810bb
Pass vars_files on to included playbooks too
...
Fixes #7384
2014-05-14 08:37:47 -05:00
Allard Hoeve
c5833f9869
Add missing basedir to Runner in _do_setup_step
2014-05-14 15:22:02 +02:00
James Cammarata
360ffc4dfd
Properly merge role conditionals in with pre-existing conditionals
...
Fixes #7387
2014-05-14 01:45:35 -05:00
James Cammarata
187619c7fe
Use utils.combine_vars on vars_files data
...
Fixes #7345
2014-05-13 11:24:41 -05:00
James Cammarata
2e2e5d5321
Use the existing module_vars during the templating of module_vars
...
Since some of the vars contained in there may be used in the templating
of other variables. This also reverts e83a494
which originally fixed
issue #6979 but broke some other variable related things.
Fixes #6979
Fixes #7321
Fixes #7332
2014-05-08 13:09:36 -05:00
Christian Berendt
6676720ce5
fixed typos found by RETF rules in PY files
...
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos
2014-05-03 18:40:05 +02:00
Michael Scherer
0f0f5ff1ce
Give more information when a task is empty
...
I made a typo in a playbook and was great by:
ERROR: expecting dict; got: None
The issue was a single - on the last line of a playbook.
With the name of the file, I was able to see right away where the
error was.
2014-04-23 13:13:46 +02:00
James Cammarata
e83a494e41
Make sure VARS_CACHE for hosts are updated with the play vars too
...
Fixes #6979
2014-04-22 14:42:43 -05:00
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
4eb626825b
Refactor play._update_vars_files_for_host to make common functions and easier debugging
...
Fixes #4883
2014-04-10 13:43:59 -04:00
Serge van Ginderachter
d240e2b9fb
Introduce an ansible_version dict as runner variable
...
Given the version:
"1.6 (ansible_version_var 14499e8bf3
) last updated 2014/03/21 17:07:50 (GMT +200)"
We get the special variable:
"ansible_version": {
"full": "1.6",
"major": 1,
"minor": 6,
"revision": 0,
"string": "1.6 (ansible_version_var 14499e8bf3
) last updated 2014/03/21 17:07:50 (GMT +200)"
}
modified: lib/ansible/playbook/__init__.py
modified: lib/ansible/runner/__init__.py
modified: lib/ansible/utils/__init__.py
2014-04-08 17:14:42 +02:00
Michael DeHaan
0a574af270
Merge pull request #5555 from sivel/expose-playbook-to-callback
...
Expose the playbook to callback plugins
2014-04-03 17:01:28 -04:00
James Cammarata
317c2f4bc0
Fixes to variable issues introduced by recent changes
...
Fixes #6801
Fixes #6832
2014-04-02 19:49:38 -05:00
James Cammarata
a6a4680e5c
Fix variable naming issue in _load_tasks()
...
Fixes #6800
2014-04-02 16:13:22 -05:00
James Cammarata
e2d86e4f43
Splitting SETUP_CACHE into two caches, one for host vars and one for setup facts
2014-04-01 16:23:33 -05:00
James Cammarata
612a1a64f0
Apply extra vars after all other vars have been merged in a play
...
Fixes #6677
2014-03-31 15:31:10 -05:00
James Cammarata
78bdb078fe
Fix for bug related to async jid polling change plus a new test
2014-03-26 15:49:15 -05:00
James Tanner
38de8cc87e
Addresses #6705 Only set the role_uuid inside the role vars
2014-03-26 14:43:07 -04:00
James Tanner
8991e403e8
Fixes #6705 Give each role a unique uuid and apply tags only to tasks matching the uuid
2014-03-26 13:29:41 -04:00
James Cammarata
9ede6f7f49
Convert gather_facts to a boolean value if it is not None
...
Fixes #5618
2014-03-26 12:04:06 -05:00
Serge van Ginderachter
f8ea93c732
Move inventory.set_playbook_basedir from ansible-playbook to playbook constructor
2014-03-25 22:12:01 +01:00
James Tanner
f9018a6f1d
Ensure handlers run when meta tasks are defined and add handler integration tests
...
Fixes #6678
Fixes #6670
2014-03-25 13:33:52 -04:00
James Tanner
ebd1f70c5d
Typo in setting task_errors variable
2014-03-25 10:35:05 -04:00
James Tanner
605156c904
Fixes premature handler execution after adding force-handlers
2014-03-25 00:20:11 -04:00
James Tanner
9169a11088
Fixes #4777 add --force-handlers option to run handlers even if tasks fail
2014-03-24 10:28:48 -04:00
James Tanner
5b3b9ba267
Addresses #4407 Caculate failed percentage based on serial and number of hosts in play
2014-03-21 13:31:47 -04:00
James Tanner
14499e8bf3
Fixes #4325 allow async and poll parameters to be templated vars
2014-03-20 16:09:58 -04:00
James Tanner
95c79ad483
Fixes #4239 merge injects with new vars loaded from files
2014-03-20 13:12:33 -04:00
James Tanner
d327e3d11a
Fixes #5622 included tasks in roles now inherit tags from the role
2014-03-20 11:56:13 -04:00
Brian Coca
18adf07fc6
changed setting values and updated docs
2014-03-19 18:03:03 -04:00
Brian Coca
4dfa40f18e
added gathering control to ansible, defaults to 'smart'
2014-03-19 18:03:03 -04:00
James Cammarata
eb7717aa02
Make sure all tags are in a list before merging for role deps
...
Fixes #6557
2014-03-18 12:32:22 -05:00
James Cammarata
84908a57fc
Don't filter role deps on tags
...
Also, fixed a bug where the tags were being merged into the wrong
data structure (passed_vars) in _build_role_dependencies()
Fixes #6439
Fixes #5709
2014-03-17 23:03:16 -05:00
James Cammarata
7edee91aba
Fixing a bug in role tag handling where only the first tag was used
...
Fixes #6517
2014-03-17 11:28:54 -05:00
Michael DeHaan
b8f1e4f765
Merge pull request #6134 from veeti/include_with_items_path
...
Show the offending file name with the include + with_items error
2014-03-16 15:10:31 -05:00
Michael DeHaan
9cdbc53741
Merge pull request #6420 from bcoca/role_names
...
added new role_names variable that exposes current roles list
2014-03-16 14:42:40 -05:00
Michael DeHaan
26efc7ace8
Revert "Populate module_setup from the setup module rather than special code elsewhere"
...
This reverts commit 58eec2e4c2
.
2014-03-16 14:11:43 -04:00
Michael DeHaan
a9896afc66
Merge pull request #6418 from bcoca/template_itnore_errors
...
templates ignore_errors
2014-03-16 12:44:51 -05:00
Dag Wieers
58eec2e4c2
Populate module_setup from the setup module rather than special code elsewhere
...
This small change allows for individual setup actions to populate the SETUP_CACHE and not cause a subsequent facts-gathering when not needed. This follows the standard of other facts modules as laid out in #1206 and implemented in fedfd18774
. It allows to test of the setup module has already been run even when gather_facts was explicitely disabled.
2014-03-16 13:37:07 -04:00
Cristian Ciupitu
0749112286
Micro-optimization: replace s.find(x)!=-1 with x in s
...
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-16 13:10:28 -04:00
James Cammarata
86d2ee4b97
Don't append tags from roles to the plays tags list
...
Fixes #6393
2014-03-12 10:41:18 -05:00
Brian Coca
906e59d8a8
added new role_names variable that exposes current roles list
2014-03-11 22:13:29 -04:00
Brian Coca
7778aca966
templates ignore_errors
2014-03-11 21:30:58 -04:00
James Cammarata
6577ff5f85
Add tags from handlers to tag availability calculation
2014-03-10 16:06:13 -05:00
Seth Woodworth
1d5db30067
Updates loop warning, removes unnecessary c
2014-03-09 00:19:28 -05:00
James Cammarata
04a6dc6d12
Check for skipped tags in passed role variables before adding to them
...
Fixes #6330
2014-03-08 18:55:42 -06:00
James Cammarata
b6056044b7
Partial revert of 73c883c
due to issues with handlers in roles
...
Fixes #6322
2014-03-06 21:13:40 -06:00
Michael DeHaan
a4d01b0891
Also search .json filenames
2014-03-06 21:47:49 -05:00
Brian Coca
79809b67dc
fixed another line with same issues
...
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2014-03-06 08:43:24 -05:00
Brian Coca
d3d5680d8f
tags lists are properly uniqued and joined now, also avoids type issues when passed as list/set or strings
...
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2014-03-06 08:28:36 -05:00
James Cammarata
73c883c122
Keep track of role dependencies across plays
...
Also fixes a bug in which tags specified on top-level roles were
not being passed down to dependent roles.
Fixes #4656
2014-03-05 14:37:37 -06:00
Hagai
0e4b38ed5a
Fix incorrect use of copy on list
2014-03-03 14:47:57 +02:00
James Cammarata
b758ed9417
Merge pull request #6150 from hkariti/fix_join_bug
...
Fix incorrect use of .join on list causing a traceback
2014-02-26 12:50:07 -06:00
Hagai
ae9c0d87a9
Fix incorrect use of .join on list
2014-02-24 19:48:55 +02:00
Veeti Paananen
dd6f2e6bfa
Show the offending file name with the include + with_items error
2014-02-23 20:51:57 +02:00
James Cammarata
fa1ab231c9
Fixing bug in which playbook vars were not merged properly
...
This occurred when a hash would be passed in via extra args and the
hash variable behavior was set to 'merge', which resulted in the
variable from extra args replacing the playbook variable.
2014-02-20 15:25:52 -05:00
James Tanner
3fc87e011b
Fix all other calls to yaml
2014-02-19 11:01:21 -05:00
James Tanner
427b8dc78d
Ansible vault: a framework for encrypting any playbook or var file.
2014-02-18 15:35:12 -05:00
jctanner
28933de84d
Merge pull request #5771 from bcoca/play_hosts2
...
added new play_hosts var
2014-02-05 23:52:20 -05:00
jctanner
253fe7be50
Merge pull request #5662 from RSpiertz/update_playbook_error
...
PlayBook: better error message
2014-02-04 11:16:44 -08:00
James Cammarata
ae9843fccd
Fix issue with handler notifications being sent out incorrectly
...
This is a partial revert of e8ad36c
, which introduced the bug.
Fixes #5848
2014-02-03 10:10:45 -06:00
James Cammarata
75e3b59bbd
Adding no_log: capability for tasks
...
Fixes #4088
2014-01-31 16:58:46 -06:00
James Cammarata
5cc354696d
Build variable dictionary on included plays without using dict()
...
Using dict(k=v) means the key was always named 'k', as the variable
is not interpreted there.
Fixes #5801
2014-01-29 12:31:12 -06:00
Michael DeHaan
d07a3b5e9b
AnsibleWorks -> Ansible
2014-01-28 20:29:42 -05:00
James Cammarata
88e2595a90
Fixing bug relating to su without an su_pass
2014-01-27 16:27:02 -06:00
Brian Coca
59d5892fa3
added new play_hosts var
...
this variable has the 'current host list' to be executed over in the
play. Useful when using --limit to not iterate over hosts not included
in play in templates or with_items.
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2014-01-25 18:43:15 -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
jctanner
19e8742005
Merge pull request #5713 from angstwad/su-fix
...
Disallow su and sudo params in same play/task
2014-01-23 13:55:43 -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
James Tanner
61d283e2ad
Fix merge conflicts from #5519
2014-01-21 13:35:06 -05: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
Jesse Keating
6013f0738e
Store the list of hosts to run on in runner object
...
This reduces the number of times inventory.list_hosts is called, which
can be costly. When coming from a playbook that data is already known.
2014-01-20 16:22:28 -08:00
Jesse Keating
e8ad36c8d4
Store hosts for a play as a play attribute
...
Operate on that play attribute to make things faster for larger
inventories. Instead of making a round trip through inventory.list_hosts
and working through some lengthy list comprehensions over and over
again, calculate the potenital hosts for a play once, then reduce from
it the unavailable hosts when necessary.
Also moves how the %fail is done. The host count is a play level count
of available hosts, which then is compared after each task to the
current number of available hosts for the play. This used to get a new
count every task which was also time expensive.
2014-01-20 16:22:28 -08: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
d21281ff43
Resolve rebase conflicts
2014-01-20 11:46:05 -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
Rutger Spiertz
dec6345fe6
PlayBook: better error message
...
When a PlayBook has missing arguments the error message now shows which ones are missing.
2014-01-17 10:30:57 +01:00
Matt Martz
f99500d65c
Expose the playbook to callback plugins
2014-01-08 14:40:37 -06:00
Michael DeHaan
c039e276a2
Fact gathering on a second play against the same hosts should not be implicitly off since this is an undocumented beheavior and potentially
...
rather unwanted when a play could change a fact.
gather_facts: True/False can still be explicitly used per play.
Reverts 564a212b3c
2014-01-04 14:03:58 -05:00
Michael DeHaan
87258f6d42
Resolve merge commit
2014-01-04 14:03:42 -05:00
Michael DeHaan
a3d90e8a87
Merge pull request #5498 from j2sol/exit_setup_early
...
Return early from setup step when possible
2014-01-04 10:47:35 -08:00
Michael DeHaan
10350d1639
Update various copyrights. Not complete, but sufficient.
2014-01-04 13:32:04 -05:00
Jesse Keating
35328ed503
Return early from setup step when possible
...
The _list_available_hosts call can be lengthy, and in the case where
gather_facts is disabled the call is pointless. So re-arrange the logic
to return early from _do_setup_step when gather_facts is false.
2014-01-03 16:39:13 -08: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
993e0f057e
Allow for no role dependencies in role metadata
2013-12-19 14:19:14 -05:00
James Tanner
1ef9930b80
Addresses #5341 Expand home directories when searching for roles in ansible-playbook
2013-12-18 23:31:03 -05:00
Michael Vogt
bef5ee2c3b
improve error on invalid vars file (if its a list instead of a dict)
2013-12-12 09:56:30 +01:00
James Tanner
dc41bb8085
Merge pull request #4207 from ashorin/ansible
...
Fail playbook when serial is set and hadlers fail on set.
2013-11-12 14:37:07 -05:00
Alan Descoins
bb6f02d0e8
Support running handler parametrized by name.
2013-11-07 16:54:06 -02:00
James Tanner
d93780bc8a
Addresses #4635 add list instead of join
2013-11-05 14:44:27 -05:00
James Tanner
2b5005687a
Fixes #4635 pass role conditionals to dependent roles
2013-11-05 14:38:21 -05:00
James Tanner
91aa7b51df
Remove invalid ipv6 parameter from setup execution
2013-11-04 17:23:32 -05:00
James Tanner
c1ed47933b
Fixes #4485 add an ipv6 parameter to accelerate so that the daemon will bind to an ipv6 port instead of ipv4
2013-11-04 17:20:03 -05:00
James Tanner
d154bf8781
Revert templating enhancements from 73dbab70
e6c28658
d409352c
9858b1f2
4587528b
9b1fe455
214b0b05
8d3db803
7f9504d1
5031104c
35cb9dc2
2bd8cb57
1e85c754
2013-10-30 10:50:16 -04:00
James Tanner
9b1fe455c6
Fixes #4549 Do not call lookup plugins when templating a task's name
2013-10-25 10:27:38 -04:00
Serge van Ginderachter
6277e770a1
include basedir as 'playbook_dir' variable
...
closes #4246
2013-10-25 07:53:52 +02: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
4125b05bf3
Allow a defaults file to solely define a role. Some typo fixes.
2013-10-19 14:01:20 -04:00
Michael DeHaan
21d4400c96
Misc pep8 fixes
2013-10-19 13:03:15 -04:00
James Tanner
8478e82647
Fixes #4583 enforce that vars_files is a list
2013-10-18 11:19:16 -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
Thomas Omans
632232259a
Adding config flag role_path for common/global roles
...
Using ANSIBLE_ROLE_PATH environment variable or role_path in ansible.cfg
can configure paths where roles will be searched for
extra paths will only be used as a backup once regular locations are exhausted
2013-10-12 10:15:30 -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
6febc97104
Add a warning about include + with_items so nobody uses it.
2013-10-08 18:12:18 -04:00
James Cammarata
98f6bc1f63
Apply tags to dependent roles correctly
...
Fixes #4339
2013-10-08 15:13:02 -05:00
Michael DeHaan
f081c68a65
Prevent duplicately loaded handlers from running more than once.
...
Fixes #3863
2013-10-07 17:15:19 -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
James Cammarata
912e3a7b0b
Merge branch 'accelerate_improvements' into devel
...
Conflicts:
library/utilities/accelerate
2013-10-01 21:22:17 -05:00
James Cammarata
8c17711247
Removing accelerate_timeout as a playbook option
...
This will remain in ansible.cfg only.
2013-10-01 15:33:18 -05:00
James Cammarata
59a5ce23d9
Adding an accelerate_timeout parameter for plays
...
This setting makes the timeout for each play configurable, rather than
hard-coding it at 300 seconds (now the default if left unspecified)
Fixes #4162
2013-10-01 15:26:50 -05:00
James Cammarata
8a3f8b757b
Make sure yaml data loaded for role is valid before using it
...
Fixes #4322
2013-10-01 10:52:39 -05:00
James Cammarata
7aad576f5f
Minor change to add a space around role name/task delimiter
2013-09-30 21:51:39 -05:00
bennojoy
482cb72128
role report fix
2013-09-26 19:20:14 +05:30
bennojoy
53e48b63a9
dountil feature commit 1
2013-09-24 13:59:38 +05:30
James Cammarata
47b9cc6311
Merge branch 'meta-roles' of https://github.com/eggsby/ansible into eggsby-meta-roles
...
Conflicts:
lib/ansible/playbook/play.py
2013-09-20 16:17:40 -05:00
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
98cfcec5e2
Correct role name detection
2013-09-20 12:10:24 -05:00
James Cammarata
8dcf386def
Don't set the role name on handlers as this breaks notifications
2013-09-20 09:34:14 -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
Thomas Omans
91a4ba2248
allowing a roles to do be made out of dependencies alone
2013-09-18 21:29:37 -07:00
James Cammarata
458f71b53c
Merge branch 'issue_4129_role_defaults_empty_yaml' into devel
...
Conflicts:
lib/ansible/playbook/play.py
2013-09-16 16:21:06 -05:00
James Cammarata
091a90ee8b
Allow includes to follow the standard format
...
Previously, includes had to receive variables via a special 'vars'
field. With this patch, the include syntax becomes a more natural
datastructure without special fields and is more akin to the way
role includes/dependencies work.
Tested with the following playbook:
---
- hosts: localhost
connection: local
tasks:
- { include: inc1.yml, a: 1 }
- include: inc2.yml
b: 2
- include: inc3.yml
with_items:
- x
- y
- z
Fixes #3481
2013-09-16 16:12:36 -05:00
James Cammarata
c5bb1394b9
Check to make sure default_vars in the datastructure isn't empty
...
Fixes #4129
2013-09-16 13:16:06 -05:00
James Cammarata
3b801dec72
Merge branch 'failed_when' of https://github.com/hnakamur/ansible into hnakamur-failed_when
2013-09-16 07:35:34 -05:00
James Cammarata
aac3090909
Merge branch 'play_remote_user' of https://github.com/bcoca/ansible into bcoca-play_remote_user
2013-09-16 05:55:14 -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
75a9357e5e
Fixing role variable precedence for top-level roles
...
Fixes #4026
Fixes #3989
2013-09-09 15:14:03 -05:00
James Cammarata
bcc2a4b513
Minor fix so the any_errors_fatal value is checked properly
2013-09-09 10:20:41 -05:00
Brian Coca
d47c48e30a
Added remote_user to plays
...
Still compatible with user: but deprecating it so we can have
a matching remote_user: in tasks, cannot be user: because of the
module of the same name. #3932
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-09-07 16:34:22 -04: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
7b13b1e03e
Minor fix to dependency dupe patch
2013-09-04 11:26:49 -05:00
smoothify
5337397abd
Second Attempt: Ensure duplicate roles are not loaded in the case of a missing meta/main.yml file.
2013-09-04 15:50:39 +01:00
smoothify
0411ea2867
Ensure duplicate roles are not loaded in the case of a missing meta/main.yml file.
2013-09-04 12:38:42 +01:00
James Cammarata
2e49d2003d
Fix bug where accelerate keyword was not checked for boolean value
...
The play was just checking for the presence of the keyword in the
YAML datastructure, and not the value of the field, so doing something
like variable substitution was always causing the play to be accelerated
2013-09-03 14:20:56 -05: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
50f54f6bda
Making variable names more descriptive for the default variables work
2013-09-02 21:37:50 -05: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
266d2008d8
Reverting the role default variables change
...
Loading the default variables in _build_role_dependencies() lead to
a side-effect where those variables were over-riding inventory variables.
2013-09-01 08:53:59 -05:00
James Cammarata
47a89a57fa
Fixing bug in playbook use of default variables in roles
2013-09-01 08:49:41 -05:00
James Cammarata
e0df5b5888
A couple more tweaks to role default variables/dependencies
...
* Default variables are now fed directly into roles, just like the
other variables, so that roles see their unique values rather
than those set at the global level.
* Role dependency duplicates are now determined by checking the params used
when specifying them as dependencies rather than just on the name of the
role. For example, the following would be included twice without having
to specify "allow_duplicates: true":
dependencies:
- { role: foo, x: 1 }
- { role: foo, x: 2 }
2013-09-01 00:43:16 -05:00
James Cammarata
736c8b19d3
Added ability to limit role dependencies to just one inclusion
2013-08-30 12:42:27 -05:00
James Cammarata
25e3eed519
Fixing a bug in variable precedence for roles and dependencies
2013-08-30 01:20:45 -05:00
James Cammarata
637d3070dc
Allow default variables to be overridden by inventory variables
2013-08-29 17:21:28 -05:00
James Cammarata
f66683863e
Merge branch 'defaults' of https://github.com/smoothify/ansible into smoothify-defaults
2013-08-28 16:24:37 -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
Wincent Colaiuta
fc4307a9c4
Fix minor typo in playbook error message
2013-08-25 11:29:07 -07: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
James Cammarata
157b697a83
Merge branch 'always_run-6' of https://github.com/stoned/ansible into stoned-always_run-6
2013-08-22 12:10:28 -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
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
Kavin Kankeshwar
7ac3bbc198
resolved #3609 Change max_fail_pct to max_fail_percentage as recommended
2013-08-20 13:55:34 -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
smoothify
494043947d
Add support for role defaults. These are variables on a per role basis with lowest precedence.
2013-08-20 10:11:39 +01: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
James Cammarata
5847720746
Fixing a small bug with the new role dependency feature
...
The block that added the original list of roles was indented too far,
and was only being reached if a role had dependencies. This resulted
in roles without dependencies from being added to the list of roles.
Credit goes to looped for reporting and diagnosing the issue.
2013-08-17 00:06:24 -05:00
James Cammarata
d8a7a2d1b2
Adding evaluation of role vars as the dep tree is built
...
This allows variables to be inserted into the role scope specifically
while also being inserted into the global scope.
2013-08-15 20:53:23 -05:00
James Cammarata
e12b99dba6
Small cleanup, no need to call _get_role_path a second time
2013-08-15 09:29:51 -05:00
James Cammarata
9a401e73a6
Adding support for role dependencies.
...
Fixes #3686
Dependencies are enabled by adding a new directory/file named
meta/main.yml to the role. The format of the dependencies are:
dependencies:
- { role: foo, x: 1, y: 2 }
- { role: bar, x: 3, y: 4 }
...
Dependencies inherit variables as they are seen at the time of the
dependency inclusion. For example, if foo(x=1, y=2) has a dependency
on bar(x=3,z=4), then bar will have variables (x=3,y=2,z=4).
Different roles can have dependencies on the same role, and this
variable inheritence allows for the reuse of generic roles quite easily.
For example:
Role 'car' has the following dependencies:
dependencies:
- { role: wheel, n: 1 }
- { role: wheel, n: 2 }
- { role: wheel, n: 3 }
- { role: wheel, n: 4 }
Role 'wheel' has the following dependencies:
dependencies:
- { role: tire }
- { role: brake }
The role 'car' is then used as follows:
- { role: car, type: honda }
And tasks/main.yml in each role simply contains the following:
- name: {{ type }} whatever {{ n }}
command: echo ''
TASK: [honda tire 1]
TASK: [honda brake 1]
TASK: [honda wheel 1]
TASK: [honda tire 2]
TASK: [honda brake 2]
TASK: [honda wheel 2]
TASK: [honda tire 3]
TASK: [honda brake 3]
TASK: [honda wheel 3]
TASK: [honda tire 4]
TASK: [honda brake 4]
TASK: [honda wheel 4]
TASK: [I'm a honda] <- (this is in roles/car/tasks/main.yml)
2013-08-15 09:29:51 -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
Michael DeHaan
4cbfe3be57
Merge pull request #3773 from cchurch/devel
...
Update callbacks used for async tasks
2013-08-06 13:32:53 -07:00
Michael DeHaan
99775176ff
Merge pull request #3623 from ralph-tice/fix_3567_2
...
changed role path template to read all vars instead of just extra_vars
2013-08-06 13:26:59 -07: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
Ralph Tice
2383a8205c
changed role path template to read all vars instead of just extra_vars
2013-07-22 09:59:26 -05: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
bf70dfc1a0
When a role/include has a conditional, add that conditional ahead of any on the task, not behind, so it can short circuit.
2013-07-20 18:34:24 -04:00
Stoned Elipot
e7a733a6be
Quote pathnames of roles' tasks and handlers files so that _load_tasks() can tokenize them properly
...
With the help of AlejandroTrev's eagle eyes. Thanks !
2013-07-20 23:25:46 +02: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
Michael DeHaan
c10c2cae4e
Merge branch 'ansible_sudo_at_role_level' of git://github.com/jeromew/ansible into sudo_role
2013-07-20 11:05:38 -04:00
Michael DeHaan
7d2585caf7
Merge pull request #3577 from Tinche/extra-vars-in-playbook-includes
...
Enabled the use of extra vars in playbook file paths when including play...
2013-07-20 07:37:35 -07:00
Rodney Quillo
a4e829c874
Allow roles to be interpolated from --extra-vars
2013-07-19 18:28:21 +08:00
jeromew
de0bc96b70
Implement sudo/sudo_user at the include and role levels
2013-07-18 22:32:56 +00: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
Ninety Thirty
7b1e87b62d
Added flexible filename handling for main files
...
tasks, handlers, and vars main files can now be any of main, main.yml, or main.yaml
2013-06-20 22:03:17 -06:00
Michael DeHaan
010440dc47
Merge pull request #3114 from laggyluke/roles_combine_vars
...
Added basic support for hash_behaviour=merge in roles
2013-06-19 19:27:27 -07:00
Michael DeHaan
d2721526de
Small tweak, don't merge conditionals, just evaluate each in turn.
2013-06-19 21:18:05 -04:00
George Miroshnykov
c642ba77ae
Added basic support for hash_behaviour=merge in roles
...
Dict vars passed to roles are now properly merged
instead of simply overriding dict vars that are
coming from vars_files.
2013-06-19 09:14:20 +03:00
Michael DeHaan
132c89e681
Merge branch 'callbackinit' of git://github.com/sergevanginderachter/ansible into devel
2013-06-18 20:52:43 -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
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
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
Tim Habermaas
4d24faeeb1
Fix grammatical error in error message
2013-05-13 13:22:57 +02: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
a81089231e
Register skipped tasks so we can at least check their changed/not-changed status.
2013-04-28 10:13:58 -04:00
Stoned Elipot
75b51f79b4
Add module path library/ if it exists in role directory
2013-04-27 18:43:56 +02:00
Michael DeHaan
75cf5c985b
Allow playbook tags to be comma seperated strings as well as lists
2013-04-27 12:29:32 -04:00
Matt Coddington
c83c534a7d
Search for roles in the roles subdir first. Throw an error when no role .yml files are found.
2013-04-25 22:40:04 -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
Michael DeHaan
b08181e9b4
Merge pull request #2731 from stoned/flush_handlers-cleanup
...
handlers must be run once
2013-04-21 14:14:04 -07:00
Michael DeHaan
08324cb5d7
Allow play tagging in context of new meta-tasks.
2013-04-21 17:12:12 -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
37789a852a
Rename set_up and tear_down to pre_tasks and post_tasks
2013-04-20 16:19:01 -04:00
Michael DeHaan
d7623d1f91
Added a 'set_up' and 'tear_down' which are like tasks, but execute before and after roles.
2013-04-20 16:07:06 -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
7c6341718e
Merge branch 'combine_vars' of git://github.com/laggyluke/ansible into exp
...
Conflicts:
lib/ansible/inventory/vars_plugins/group_vars.py
lib/ansible/runner/__init__.py
lib/ansible/utils/__init__.py
test/TestPlayBook.py
2013-04-16 20:06:06 -04:00
Michael DeHaan
0944e7d56a
Make less template calls on playbook objects.
2013-04-12 21:48:01 -04:00
Michael DeHaan
44a9352338
Also template handlers only at the end.
2013-04-12 20:32:35 -04:00
Michael DeHaan
e7f5186dec
Merge pull request #2623 from willthames/when_set_bug
...
Prevent premature variable substitution in tasks
2013-04-12 17:19:25 -07:00
Michael DeHaan
3ab0ed5fd4
Allow 'when' and 'with_items' to be applied to roles.
2013-04-12 19:02:56 -04:00
willthames
377bc31311
Prevent premature substitution of variables into tasks
...
As documented in #2623 , early variable substitution causes when_
tests to fail and possibly other side effects.
I can see the reason for this early substitution, likely introduced
in 1dfe60a6
, to allow many playbook parameters to be templated.
This is a valid goal, but the recursive nature of the utils.template
function means that it goes too far.
At this point removing tasks from the list of parameters to be
substituted seems sufficient to make my tests pass. It may be the
case that other parameters should be excluded, but I suspect not.
Adding a test case. I would prefer to analyse not just the aggregate
statistics but also whether the results are as expected - I can't
see an easy way to do that with the available callbacks at present.
2013-04-12 09:17:03 +10:00
Michael DeHaan
7931597a6a
Fix template call.
2013-04-11 12:15:13 -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
willthames
9d87733f98
Test case and fix for shlex.split unicode bug
...
When operating on a unicode string in python 2.6, shlex.split returns
a result that does not work with the file constructor.
To reproduce this requires a task include that is templated (this is
because the templated string is a unicode result, whereas a non-
templated string is a non-unicode string)
[will@centos6.3] $ python
Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shlex
>>> shlex.split(u'abc')
['a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00']
[will@fedora17] $ python
Python 2.7.3 (default, Jul 24 2012, 10:05:38)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shlex
>>> shlex.split(u'abc')
['abc']
The proposed fix (coercing the include parameters to string before the
shlex.split) may not be ideal but it does fix the bug for my test case.
2013-04-08 14:47:43 +10: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
Stoned Elipot
1ed54b9b3a
when: condition support for tasks include
2013-04-07 00:43:39 +02:00
Michael DeHaan
fffb1a0a9d
Loose tasks not in roles get executed after roles.
2013-04-06 18:36:25 -04:00
Michael DeHaan
f044fc344b
When using roles, or other includes, the path to DWIM inside is the path of the task include
...
file.
2013-04-06 18:32:36 -04:00
Michael DeHaan
5c4ed72571
Demo of parameterized roles!
2013-04-06 12:51:17 -04:00
Michael DeHaan
f308194b9a
Added examples of how roles work!
2013-04-06 12:35:35 -04:00
Michael DeHaan
892484812e
Much requested feature -- allows relative imports of content within roles or relative to any task or handler include (../templates for template ../files for copy)
2013-04-06 12:13:04 -04:00
Michael DeHaan
95f30f0def
Complete streamlining of vars handling in playbooks and how those are templated to avoid
...
repeat template calls at playbook intialization time.
2013-04-06 10:45:09 -04:00
Michael DeHaan
1dfe60a6ea
Allow any parameter in a play to be set by --extra-vars through cleaner use of data structure
...
templating.
2013-04-06 10:09:16 -04:00
George Miroshnykov
6826aa7360
Tweaked merge_hash to also affect Runner behavior
2013-04-06 13:06:38 +03: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
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
David Hughes
c365974117
Added variable expansion to task sudo_user parameter
2013-03-15 11:31:27 -07:00
milan
80dbab3cf0
check type of task explicitly
2013-03-14 13:06:55 +01: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
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