forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the module redirect_list when getting defaults for action plugins (…
…ansible#73864) * Fix module-specific defaults in the gather_facts, package, and service action plugins. * Handle ansible.legacy actions better in get_action_args_with_defaults * Add tests for each action plugin * Changelog Fixes ansible#72918 (cherry picked from commit 5640093)
- Loading branch information
Showing
10 changed files
with
228 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- gather_facts, package, service - fix using module_defaults for the modules in addition to the action plugins. (https://github.com/ansible/ansible/issues/72918) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
test/integration/targets/gathering_facts/test_module_defaults.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
- hosts: localhost | ||
# The gather_facts keyword has default values for its | ||
# options so module_defaults doesn't have much affect. | ||
gather_facts: no | ||
tags: | ||
- default_fact_module | ||
tasks: | ||
- name: set defaults for the action plugin | ||
gather_facts: | ||
module_defaults: | ||
gather_facts: | ||
gather_subset: min | ||
|
||
- assert: | ||
that: "gather_subset == ['min']" | ||
|
||
- name: set defaults for the module | ||
gather_facts: | ||
module_defaults: | ||
setup: | ||
gather_subset: '!all' | ||
|
||
- assert: | ||
that: "gather_subset == ['!all']" | ||
|
||
# Defaults for the action plugin win because they are | ||
# loaded first and options need to be omitted for | ||
# defaults to be used. | ||
- name: set defaults for the action plugin and module | ||
gather_facts: | ||
module_defaults: | ||
setup: | ||
gather_subset: '!all' | ||
gather_facts: | ||
gather_subset: min | ||
|
||
- assert: | ||
that: "gather_subset == ['min']" | ||
|
||
# The gather_facts 'smart' facts module is 'ansible.legacy.setup' by default. | ||
# If 'setup' (the unqualified name) is explicitly requested, FQCN module_defaults | ||
# would not apply. | ||
- name: set defaults for the fqcn module | ||
gather_facts: | ||
module_defaults: | ||
ansible.legacy.setup: | ||
gather_subset: '!all' | ||
|
||
- assert: | ||
that: "gather_subset == ['!all']" | ||
|
||
- hosts: localhost | ||
gather_facts: no | ||
tags: | ||
- custom_fact_module | ||
tasks: | ||
- name: set defaults for the module | ||
gather_facts: | ||
module_defaults: | ||
ansible.legacy.setup: | ||
gather_subset: '!all' | ||
|
||
- assert: | ||
that: | ||
- "gather_subset == ['!all']" | ||
|
||
# Defaults for the action plugin win. | ||
- name: set defaults for the action plugin and module | ||
gather_facts: | ||
module_defaults: | ||
gather_facts: | ||
gather_subset: min | ||
ansible.legacy.setup: | ||
gather_subset: '!all' | ||
|
||
- assert: | ||
that: | ||
- "gather_subset == ['min']" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters