ansible/test/integration/targets/module_defaults/test_defaults.yml
Sloane Hertel 51f6d129cb
support hard coded module_defaults.yml groups for collections (#69919)
* Only allow groups which were hardcoded in module_defaults.yml

only load action groups from the collection if module_defaults contains a potential group for the action

* Fix tests using modules that override those whitelisted in lib/ansible/config/module_defaults.yml

Third party modules should not be using group/ - use the action name instead

* add externalized module_defaults tests

add the missing group and collections

ci_complete

Co-authored-by: Matt Davis <mrd@redhat.com>

* changelog

ci_complete

* Fix import in tests

ci_complete

* Update with requested changes

ci_complete

* don't traceback since we don't validate the contents of module_defaults

ci_complete

Co-authored-by: Matt Davis <mrd@redhat.com>
2020-06-09 15:38:57 -07:00

60 lines
2.4 KiB
YAML

- hosts: localhost
gather_facts: no
collections:
- testns.testcoll
- testns.othercoll
module_defaults:
testns.testcoll.echoaction:
explicit_module_default: from playbook
testns.testcoll.echo1:
explicit_module_default: from playbook
group/testgroup:
group_module_default: from playbook
tasks:
- testns.testcoll.echoaction:
task_arg: from task
register: echoaction_fq
- echoaction:
task_arg: from task
register: echoaction_unq
- testns.testcoll.echo1:
task_arg: from task
register: echo1_fq
- echo1:
task_arg: from task
register: echo1_unq
- testns.testcoll.echo2:
task_arg: from task
register: echo2_fq
- echo2:
task_arg: from task
register: echo2_unq
- testns.othercoll.other_echoaction:
task_arg: from task
register: other_echoaction_fq
- other_echoaction:
task_arg: from task
register: other_echoaction_unq
- testns.othercoll.other_echo1:
task_arg: from task
register: other_echo1_fq
- other_echo1:
task_arg: from task
register: other_echo1_unq
- debug: var=echo1_fq
- assert:
that:
- "echoaction_fq.args_in == {'task_arg': 'from task', 'explicit_module_default': 'from playbook', 'group_module_default': 'from playbook' }"
- "echoaction_unq.args_in == {'task_arg': 'from task', 'explicit_module_default': 'from playbook', 'group_module_default': 'from playbook' }"
- "echo1_fq.args_in == {'task_arg': 'from task', 'explicit_module_default': 'from playbook', 'group_module_default': 'from playbook' }"
- "echo1_unq.args_in == {'task_arg': 'from task', 'explicit_module_default': 'from playbook', 'group_module_default': 'from playbook' }"
- "echo2_fq.args_in == {'task_arg': 'from task', 'group_module_default': 'from playbook' }"
- "echo2_unq.args_in == {'task_arg': 'from task', 'group_module_default': 'from playbook' }"
- "other_echoaction_fq.args_in == {'task_arg': 'from task', 'group_module_default': 'from playbook' }"
- "other_echoaction_unq.args_in == {'task_arg': 'from task', 'group_module_default': 'from playbook' }"
- "other_echo1_fq.args_in == {'task_arg': 'from task', 'group_module_default': 'from playbook' }"
- "other_echo1_unq.args_in == {'task_arg': 'from task', 'group_module_default': 'from playbook' }"
- include_tasks: tasks/main.yml