Commit Graph

1132 Commits (501503f4cb424d01c030e14cb5e5f8445fcdada3)

Author SHA1 Message Date
Matt Martz 509e92ef72
Swap default for INVALID_TASK_ATTRIBUTE_FAILED to True, add additional info to exception (#44138) 6 years ago
Matt Martz 0beaea22a4
Bump deprecation for include to 2.12 (#44230) 6 years ago
Sam Doran 6d38167d49
Only template values in vars_prompt rather than all vars (#39304)
* Only template values in vars_prompt rather than all vars

This allows the use of variables in vars_prompt fields but allows variables entered in the prompt to affect play vars rather than throwing an undefined error.

Only post validate if there was a vars_prompt

* Add tests for vars_prompt
6 years ago
Brian Coca 9be3a7dde5
handle env exception in gathering even no inject (#43569)
* handle env exception in gathering even no inject

(cherry picked from commit 60e3b9b3527daea6d9fb75a80cc14b35923748f3)
6 years ago
Robert Bo Davis a452a92199 Fix referenced before assignment in role requirements 6 years ago
Robert Bo Davis 298d73a1a7 Fix referenced before assignment in role requirements 6 years ago
Matt Martz dc908f4cb5 Prefer name of include_role. Fixes #43332 6 years ago
Brian Coca 222c907ffb
actually check we can run scm command for roles (#43315)
* actually check we can run scm command for roles
* a better error message than file not found
* more narrow exception hanlding
* refactor common functions for more extended use and further 'basic.py' separation
6 years ago
Joren Vrancken 350dbaf457 Correct default value of always_post_validate in docstring 6 years ago
Andrew Gaffney dbff49dee0
Remove dead 'vault_password' play attribute (#41847) 6 years ago
Andrey Laguta 2e62e36590 Fix multiple var files combining (followup to #36357) 6 years ago
Matt Martz 27b4d7ed31
Add feature to expose vars/defaults with include/import_role (#41330)
* First pass at making 'private' work on include_role, imports are always public

* Prevent dupe task execution and overwriting handlers

* New functionality will use public instead of deprecated private

* Add tests for public exposure

* Validate vars before import/include to ensure they don't expose too early

* Add porting guide docs about public argument and change to import_role

* Add additional docs about public and vars exposure to module docs

* Insert role handlers at parse time, exposing them globally
6 years ago
Toshio Kuratomi a0748c0837 Don't use deepcopy when creating attributes unless really needed 6 years ago
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) 7 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
7 years ago
Matt Martz 72ebd1bf46
Add IncludeRole.get_name to provide better name for include_role. Fixes #36343 (#39807) 7 years ago
Matt Martz 5ec34f65d9
Pass obj=data to AnsibleParserError for context in IncludeRole. Fixes #31374 (#39805) 7 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
7 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
7 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