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

Allow usage of Ansible module group defaults - for Ansible 2.12+ #15

Merged
merged 1 commit into from
Oct 27, 2021
Merged

Allow usage of Ansible module group defaults - for Ansible 2.12+ #15

merged 1 commit into from
Oct 27, 2021

Conversation

zeten30
Copy link
Contributor

@zeten30 zeten30 commented Aug 11, 2021

SUMMARY

Allow usage of Ansible module group defaults

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html

ADDITIONAL INFORMATION

Allows usage of module defaults like:

- hosts: localhost
  connection: local
  gather_facts: false
  collections:
    - netapp.ontap
  module_defaults:
    group/netapp.ontap.netapp_ontap:
      hostname: "my.filer"
      https: "true"
      password: "{{ secrets.pwd }}"
      use_rest: "true"
      username: "{{ secrets.user }}"
      validate_certs: "false"

  tasks:
    - na_ontap_info:
        gather_subset: "net_interface_info"
        query:
          net-interface-info:
            vserver: "vserver-nfs"
            data-protocols:
              data-protocol: "nfs"
      register: ontap_volume_nfs_interface

    - debug:
        msg: "{{ ontap_volume_nfs_interface.ontap_info.net_interface_info }}"

@lonico
Copy link
Contributor

lonico commented Aug 12, 2021

@zeten30 This is very cool. Would you know which minimum version of Ansible is required to make this work?
I see it on devel.

@zeten30
Copy link
Contributor Author

zeten30 commented Aug 12, 2021

@zeten30 This is very cool. Would you know which minimum version of Ansible is required to make this work?
I see it on devel.

@lonico it should technically work on 2.10+, but works only on devel/future 2.12 for me (same as for you). I'll try to figure it out.
Module groups were 'hardcoded' in ansible core before, but they allowed this new collection level definitions recently.

@zeten30
Copy link
Contributor Author

zeten30 commented Aug 12, 2021

@tremble do you know what is the lowest version of Ansible that is capable of handling collection definition of module group defaults? Thanks in advance.

@lonico
Copy link
Contributor

lonico commented Aug 13, 2021

I'll hold off on this until it's supported on a released version of Ansible in pypi.

@tremble
Copy link

tremble commented Aug 13, 2021

Looks like custom groups for collections is a 2.12 feature: ansible/ansible#74039

It looks like it works for AWS because they had some hard-coded magic for existing groups.

Currently slated for November: https://docs.ansible.com/ansible-core/devel/roadmap/ROADMAP_2_12.html

@lonico lonico added the enhancement New feature or request label Aug 13, 2021
@zeten30
Copy link
Contributor Author

zeten30 commented Aug 14, 2021

TYVM @tremble

@lonico yes, let's wait for 2.12 release :)

@zeten30 zeten30 changed the title Allow usage of Ansible module group defaults Allow usage of Ansible module group defaults - for Ansible 2.12+ Aug 18, 2021
@lonico lonico merged commit 6b3cea6 into ansible-collections:main Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants