Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import_playbook - change additional params to deprecation #72987

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,2 @@
bugfixes:
- import_playbook - change warning about extra parameters to deprecation (https://github.com/ansible/ansible/issues/72745)
4 changes: 4 additions & 0 deletions lib/ansible/modules/import_playbook.py
Expand Up @@ -42,6 +42,10 @@
- name: Include a play after another play
import_playbook: otherplays.yaml

- name: Set variables on an imported playbook
import_playbook: otherplays.yml
vars:
service: httpd

- name: This DOES NOT WORK
hosts: all
Expand Down
3 changes: 2 additions & 1 deletion lib/ansible/playbook/playbook_include.py
Expand Up @@ -172,7 +172,8 @@ def _preprocess_import(self, ds, new_ds, k, v):
else:
new_ds['import_playbook'] = items[0].strip()
if len(items) > 1:
display.warning('Additional parameters in import_playbook statements are not supported. This will be an error in version 2.14')
display.deprecated("Additional parameters in import_playbook statements are deprecated. "
"Use 'vars' instead. See 'import_playbook' documentation for examples.", version='2.14')
# rejoin the parameter portion of the arguments and
# then use parse_kv() to get a dict of params back
params = parse_kv(" ".join(items[1:]))
Expand Down
2 changes: 1 addition & 1 deletion test/integration/targets/include_import/runme.sh
Expand Up @@ -17,7 +17,7 @@ ansible -m include_role -a name=role1 localhost
## Import (static)

# Playbook
test "$(ansible-playbook -i ../../inventory playbook/test_import_playbook.yml "$@" 2>&1 | grep -c '\[WARNING\]: Additional parameters in import_playbook')" = 1
test "$(ANSIBLE_DEPRECATION_WARNINGS=1 ansible-playbook -i ../../inventory playbook/test_import_playbook.yml "$@" 2>&1 | grep -c '\[DEPRECATION WARNING\]: Additional parameters in import_playbook')" = 1

ANSIBLE_STRATEGY='linear' ansible-playbook playbook/test_import_playbook_tags.yml -i inventory "$@" --tags canary1,canary22,validate --skip-tags skipme

Expand Down
Expand Up @@ -242,7 +242,7 @@ def visit_call(self, node):
this_collection = collection_name == (self.collection_name or 'ansible.builtin')
if not this_collection:
self.add_message('wrong-collection-deprecated', node=node, args=(collection_name,))
else:
elif self.collection_name is not None:
self.add_message('ansible-deprecated-no-collection-name', node=node)

if date:
Expand Down