Commit Graph

1119 Commits (97cc0cce7f53b704f8541530e42d5e515584cd95)

Author SHA1 Message Date
Matt Martz 8aea8901c3 Add config to fail on invalid task attributes. Fixes #42479 6 years ago
Matt Martz 50905b980d Support item label in v2_playbook_on_include (#42478)
* Support item label in v2_playbook_on_include. Fixes #42301

* test fixes
6 years ago
Matt Martz d255cf42d7
Fix NameError, value was not available in this context leading to a generic unexpected error. Fixes #33275 (#41856) 6 years ago
Matt Martz 9a18385fab
Validate that rescue and always have an accompanying block. Fixes #26751 (#41822) 6 years ago
Matt Martz e9a5c53512
Handle typing of vars_files in Play.get_vars_files. Fixes #14708 (#41801) 6 years ago
Matt Martz ee221859cd
Load role vars and defaults before parsing tasks (#40982)
* Load role vars and defaults before parsing tasks. Fixes #40163

* Add porting guide note

* Wording clarifications

* typo

* grammar fixes
6 years ago
Matt Martz 3832d04611 Ensure we raise the exception caught _post_validate_environment->_parse_env_kv. Fixes #41322 (#41411) 6 years ago
Matt Martz 76867730bf
Don't ignore a duplicate host for an already processed include (#40361)
* Don't ignore a duplicate host for an already processed include, assume that the repetition indicates a new include. Fixes #40317

* Add intg tests to ensure duplicate items in loop are not deduped

* Add note about relative indexing
6 years ago
Matt Martz c403f01971
Revert #39365, improve error messaging (#41208)
* Revert " Update TaskInclude _raw_params with the expanded/templated path to file (#39365)"

This reverts commit 4b01b92cfe.

* Improve error messaging, catch error templating parent path
6 years ago
Matt Martz da4ff18406
Support 'apply' to apply attributes to included tasks - Impl 1 (#39236)
* Support 'apply' to apply attributes to included tasks

* Cannot validate args for task_include

* Only allow apply on include_

* Re-enable arg validation, but only for include_tasks and import_tasks

* s/task/ir/

* Add tests for include_ apply

* Include context with AnsibleParserError

* Add docs for apply

* version_added

* Add free-form documentation back

* Add example of free-form with apply
6 years ago
Antoine Pietri 313a46744d Add a 'machinectl shell' become_method (#39826)
* Add a 'machinectl shell' become_method

* docs: add explanations for the machinectl become_method

* docs: machinectl become_method: specify this part is specific to Linux+systemd setups
6 years ago
Jordan Borean 070a5557d1
always_run: removed deprecated always_run task option (#40470) 6 years ago
Matt Martz 384a0d8b01
Deprecate private for include_role (#39821) 6 years ago
Jeffrey Forman be3670f528 fix 'doas' become_method support, previously committed patch not submitted to devel branch (#37511)
* fix become_method 'doas' support by properly specifying becomecmd

a repatch of https://github.com/ansible/ansible/pull/13451/ which was never committed to 'devel' branch.

* fix play_context test for become_method doas to match new becomecmd
6 years ago
Matt Martz 72ebd1bf46
Add IncludeRole.get_name to provide better name for include_role. Fixes #36343 (#39807) 6 years ago
Matt Martz 5ec34f65d9
Pass obj=data to AnsibleParserError for context in IncludeRole. Fixes #31374 (#39805) 6 years ago
Matt Martz 3d5a7d6dc2
Allow using action/local_action on includes and imports (#37260)
* Prevent using action/local_action on includes and imports. Fixes #28822

* Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include

* Add to_native

* switch back to block in task_ds, use ModuleArgsParse otherwise

* var should be task_ds

* Add test validating action+include_tasks
6 years ago
Brian Coca df1001577f
rebase base playbook base (#39533)
* rebase base playbook base

fixes issues with loop control allowing generic attributes it shouldn't
6 years ago
Matt Martz 6acdc36317
Ensure we don't overwrite handlers from include_role when loading a play. Fixes #18140 (#39563) 7 years ago
Brian Coca b9f7f582d1
remove properties from vars in include_role (#38968)
* remove properties from vars in include_role
* also from_ args
7 years ago
Matt Martz cca96b8c9d
Pass vars from import_playbook in early (#39521)
* Pass vars from import_playbook in early, as they may be needed to parse the imported plays. Fixes #33693

* Add test for import_playbook vars
7 years ago
Matt Martz c0043444c9
Remove unneeded imports in load_list_of_blocks (#39523) 7 years ago
Matt Martz 240b060c02
Use the computed role name instead of 'role'. Fixes #38838 (#39516) 7 years ago
Matt Martz 7db5ce2c86
Ensure handlers have proper parent (#39426)
* Ensure role handlers are parented correctly. Fixes #36518

* Add delegate_to test for include_role handlers
7 years ago
Matt Martz 4b01b92cfe
Update TaskInclude _raw_params with the expanded/templated path to file (#39365)
* Update TaskInclude _raw_params with the expanded/templated path to file

* Add tests to validate host vars include paths
7 years ago
Martin Krizek 1c49cc4377
Actually check for import_role when loop detected (#39218) 7 years ago
Matt Clay c262dbfd30 Use https for links to ansible.com domains. 7 years ago
Matt Martz afcc9ddf8c
Cache task_vars to speed up IncludedFile.process_include_results (#39026) 7 years ago
Matt Martz cdb79b0e3a
Consider parent also when comparing IncludedFile (#37083)
* Consider parent also when comparing IncludedFile

* Add new tests for IncludedFile and convert to pytest
7 years ago
Mat Wilson 8eb94ccbd5 Add support for dzdo flags Fixes #38766 7 years ago
Matt Martz 354aa8d602
Skip self._parent on dynamic, defer to grandparent for attr lookup (#38827)
* Skip self._parent on dynamic, defer to grandparent for attr lookup

* Revert _inheritable

* Add tests for include inheritance from static blocks

Fixes #38037 #36194
7 years ago
Matt Martz f474195a3b
Attempt 4: Prevent reparenting a block with itself (#38747)
* More concisely reparent, ensuring we don't go too shallow or too deep in this process. Fixes #38357

* More explicit reparenting, with a short circuit for a common case

* We need new_block to have a parent, otherwise we lose context with this approach

* Remove duplicate parent assignment

* Change callers of Block.copy to not use exclude_parent=True, when including the parent, exclude tasks
7 years ago
Brian Coca a4046d3424
better error when wrong type passed to import_play (#36592)
fixes #36576
7 years ago
Brian Coca fda9312379
actual error reporting on failed galaxy clone (#36788)
actual error reprting on failed galaxy clone

also allow debugging to see stdout/stderr from command
handle output for all commands on error
also use std temp dir instead of random
7 years ago
Andrew Gaffney 95ce00ff00 Allow loading dirs from role defaults/vars (#36357)
This commit moves code to look for vars files/dirs to a common place and
uses it for loading role defaults/vars. This allows things such as
'defaults/main' or 'vars/main' being a directory in a role, allowing
splitting of defaults/vars into multiple files. This commit also fixes
the role loading unit tests for py3 when bytestrings are used for paths
instead of utf8 strings.

This fixes #14248 and #11639.
7 years ago
Andrew Gaffney 8673e1e661 Support for module param defaults (#22648) 7 years ago
Martin Krizek fd96bcd22f Use correct action in warning about missing name 7 years ago
Matt Martz 1f824bd620 Don't overwrite builtin jinja2 filters with tests (#37881)
* Don't overwrite builtin jinja2 filters with tests. Fixes #37856

* Fix tests and other callers of _get_filters
7 years ago
Phil Nelson 54e70fc783 Fix name parameter templating in include_role module (#36372)
An IncludedFile() object built using the original_task will have
its _task bound to the original_task. The iterative reassignment of
original_task._role_name during with_item loops leaves all returned
included_files with the same ._task._role_name (the final name from
the with_items list). This commit builds IncludedFile() objects
from an original_task.copy() to avoid the problematic binding.
7 years ago
Adrian Likins e166946a0a Fix redundant yaml error blurbs on ModArgs parse errors (#36923)
* Fix redundant yaml error blurbs on ModArgs parse errors

Some of the AnsibleParserErrors from parsing.mod_args
are created with the obj=some_yaml_ds options but
some are not.

If they were, we don't want to add another yaml_ds to
it, because that will result in double yaml error blurbs.
And since we dont need to add info, we can just re raise it.

But if there is no ._obj, add it here so we get the extra
detail in the error message (see issue #14790) and raise
a new AnsibleParserError instance.

Fixes #36848

* cleanup existing test_tasks pep8/sanity issues
7 years ago
Leigh Jenkin e224039586 Fixes #12353 #20977 adds new option to galaxy cli to preserve scm meta (#34642) 7 years ago
Brian Coca 8de4f7cd9f
fix loop_control templating (#36124)
* fix loop_control templating

- properly template ALL properites for loop_control
- loop_control inherits from base, it should not, but needs validate/attribute functionality

fixes #24719
7 years ago
Matt Martz 76ff3e9efc
Prevent reparenting a block with itself (#36075)
* Prevent reparenting a block with itself

* Move __eq__ to Block, to avoid some unexpected problems
7 years ago
Matt Martz 7d1eb88ecf Address memory ballooning caused by task caching changes (#35921)
* Exclude parent when copying included task to avoid memory issues. Fixes #35796

* Simplify implicit block squashing to pre-group, instead of post re-parenting
7 years ago
Brian Coca 0bd9b3019f caller to preprocess must be None aware (#33653)
also removed unused copy of method

fixes #33650
7 years ago
Brian Coca 6340d58cd1 add 'never' tag (#34104)
* add 'never' tag

skips a task unless a tag on the task is explicitly targeted

* never also affects untagged, clearer layout
7 years ago
Brian Coca 02a7e9fb88 remove runtime msg also 7 years ago
Andrew Gaffney e9b0a4ccb4 Add support for defining index var for task loops 7 years ago
Martin Krizek 24c6de7c49
Use value of delegated transport for var lookup (#35658) 7 years ago
kiorky 9001a8794f FIX: multiple nested tasks include levels (#35165)
* Test for include_tasks & include_role bug

Related to ansible/ansible:#21890

* Fix nested include_tasks called from role

This fixes the path of included files when you want
to call include_task inside a role's task file and this
role is itself called from multiple level of playbook include_tasks

Related to ansible/ansible:#21890
This fixes ansible/ansible:#35109
7 years ago