community.rabbitmq icon indicating copy to clipboard operation
community.rabbitmq copied to clipboard

Define Default Action Group

Open wandersonwhcr opened this issue 1 year ago • 2 comments

SUMMARY

This PR defines an action group for all collection modules.

When same module is frequently called with same arguments, we can use module_defaults to avoid duplications. Since Ansible 2.7, we can group modules that share common sets of parameters. And since ansible-core 2.12, collections can define its own groups via action_groups on runtime.yml.

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

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • rabbitmq action group
ADDITIONAL INFORMATION

Before:

# playbook.yaml
- name: rabbitmq
  hosts: all
  module_defaults:
    community.rabbitmq.rabbitmq_exchanges:
      login_user: "admin"
      login_password: "admin"
    community.rabbitmq.rabbitmq_queues:
      login_user: "admin"
      login_password: "admin"
    # ...
  roles:
    - "exchanges"
    - "queues"

After:

# playbook.yaml
- name: rabbitmq
  hosts: all
  module_defaults:
    group/rabbitmq:
      login_user: "admin"
      login_password: "admin"
  roles:
    - "exchanges"
    - "queues"

wandersonwhcr avatar Aug 15 '23 01:08 wandersonwhcr

hi @wandersonwhcr thanks for this contribution! I'm wondering whether the group can be set to rabbitmq rather than the FQDN? If so, this might make it a little more clean?

csmart avatar Mar 17 '24 01:03 csmart

Hi @csmart! Of course!

Changed as requested.

But I think these pipeline errors are not caused because of my changes.

wandersonwhcr avatar Apr 29 '24 21:04 wandersonwhcr