ansible-aci icon indicating copy to clipboard operation
ansible-aci copied to clipboard

add action_groups for module_defaults

Open akira6592 opened this issue 1 year ago • 4 comments

add action_groups in meta/runtime.yml.

This allows module_defaults group feature. https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html#module-defaults-groups

It becomes able to specify common options such as host username and password without specifying per tasks or using environment variables.

---
- hosts: apic
  gather_facts: no

  module_defaults:
    group/cisco.aci.aci:
      host: "{{ ansible_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:
    - name: create tenant
      cisco.aci.aci_tenant:
        tenant: test_tenant01
        state: present

    - name: create ap
      cisco.aci.aci_ap:
        tenant: test_tenant01
        ap: test_ap01
        state: present

akira6592 avatar Sep 19 '22 13:09 akira6592

Thank you for your approval!

akira6592 avatar Sep 30 '22 23:09 akira6592

One thing I noticed is that in this PR you have a non-standard module on the list aci_bulk_static_binding_to_epg. Probably needs cleanup before merge.

rafmuller avatar Oct 01 '22 23:10 rafmuller

@rafmuller The following modules including aci_bulk_static_binding_to_epg have been merged into the main branch since the version 2.2.0 release.

  • aci_bulk_static_binding_to_epg #228
  • aci_ntp_policy #229
  • aci_ntp_server #229

Therefore, these modules should be included in the list in the next release.

akira6592 avatar Oct 02 '22 11:10 akira6592

Added the following modules that were added after submitting this PR.

  • aci_aaa_ssh_auth
  • aci_aaa_user_domain
  • aci_aaa_user_role
  • aci_l3out_logical_interface_profile_ospf_policy

akira6592 avatar Oct 15 '22 05:10 akira6592

@akira6592 is there a way to just have a wildcard? This looks like it will be a pain to manage this list.

lhercot avatar Oct 17 '22 15:10 lhercot

@akira6592 Have you seen my question above?

lhercot avatar Oct 24 '22 18:10 lhercot

@lhercot Sorry for the delay in replying.

Unfortunately there does not seem to be a way to specify a module with wildcards.

Other collections (e.g., amazon.aws) also maintain listings.

If there is a workaround, it would be to add an explanation in the Contributing to this collection section of the README.md, something like "When adding a module, also add it to meta/runtime.yml".

akira6592 avatar Oct 25 '22 05:10 akira6592