infobloxopen / infoblox-ansible

Ansible modules for interfacing to Infoblox systems
GNU General Public License v3.0
54 stars 61 forks source link

Feature: add module groups for module_defaults #195

Open ebirn opened 11 months ago

ebirn commented 11 months ago

see https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_module_defaults.html#module-defaults-groups

This would allow setting certain parameters (i.e. provider/credentials) on playbook level using module_defaults:

# collections/ansible_collections/infoblox/nios_modules/meta/runtime.yml
action_groups:
  api_calls:
    - nios_srv_record
    - nios_aaaa_record
    - other_module
    - [...]

would allow setting defaults in the playbook

- hosts: localhost
  module_defaults:
    group/infoblox.nios_modules.api_calls:
      provider:
        host: my.host
        username: some_user
        password: secret
  tasks:
    # default credentials will be applied
    - infoblox.nios_modules.nios_srv_record:
        name: "my-srv"
        domain: "example.com"
        target: "{{ inventory_hostname }}"
        port: 1234
        state: present
        comment: "some SRV record"