Skip to content

Conversation

@akira6592
Copy link
Contributor

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

rafmuller
rafmuller previously approved these changes Sep 30, 2022
Copy link

@rafmuller rafmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this and works as advertised. This solves a big problem for us in large Ansible automation executions

@akira6592
Copy link
Contributor Author

Thank you for your approval!

@rafmuller
Copy link

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.

@akira6592
Copy link
Contributor Author

@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.

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

@akira6592
Copy link
Contributor Author

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 akira6592 requested a review from rafmuller October 15, 2022 06:38
@lhercot
Copy link
Member

lhercot commented Oct 17, 2022

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

@lhercot
Copy link
Member

lhercot commented Oct 24, 2022

@akira6592 Have you seen my question above?

@akira6592
Copy link
Contributor Author

akira6592 commented Oct 25, 2022

@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".

Copy link
Member

@lhercot lhercot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lhercot lhercot merged commit d9807fa into CiscoDevNet:master Jan 21, 2023
@lhercot
Copy link
Member

lhercot commented Jan 21, 2023

Thanks for the contribution!

To avoid having to manually modify the list, I have added a small function to our release script (which also build our changelog for new releases) which compile the list and output it in the meta/runtime.yml file.

You can see more details here: ciscoecosystem/release_script@4f693d3

@akira6592 akira6592 deleted the add-action-groups branch January 22, 2023 02:50
@akira6592
Copy link
Contributor Author

Thank you for merging and adding the process to generate action_groups.

@lhercot
Copy link
Member

lhercot commented Jan 23, 2023

FYI, we have decided to rename the group to all so it will be group/cisco.aci.all which will be more logical if we decide to introduce other groups and avoid the repetition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants