Hi,

I have a playbook which imports custom role and passes required attributes.
My requirement is to pass only required attributes and role specify
remaining. below is explained in detail.

playbook
------------

---
- hosts: remote
  gather_facts: yes
  tasks:
    - import_role: {name: xaas}
    - name: call action
      xaasaction:
        id: "{{id}}"
        action: "{{action}}"
      register: output

    - name: print values
      debug: var=output

the role task as below:
---
# tasks file for testrole
- xaasaction:
  module_defaults:
    xaasaction:
      username: "{{username}}"
      password: "{{password}}"

username and password are picked from vars/main.yml inside the role


The issue is module_defaults doesnot take effect.
output is

"invocation": {
      "*module_args":*
*              "id": 12,*
*              "action": create,*

*              "username": null,*
*              "password": null*

Any advice how to make it work so that module_defaults values are passed to
the module along with other arguments?

Thanks and Regards,
Punit

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFXWBQLrTZYB-RYEVk9pkmaYeT7rDtQSgb71gh1bFOLT0HMsww%40mail.gmail.com.

Reply via email to