ansibleansible-factsansible-awxansible-tower

Ansible Tower: Custom Credential Type


I created a Custom Credential in Ansible Tower and need to use it in a role.

The credential name is custom_cred -> this has 2 keys custom username and custom password.

I've tried hostvars[inventory_hostname][custom_cred]['custom username'] but its not working.


Solution

  • To debug your Custom Credential Types you could use

    - hosts: localhost
      gather_facts: yes
    
      tasks:
    
      - name: Get environment
        debug:
          msg: "{{ ansible_env }}"
    

    resulting into an output of

    TASK [Get environment] *********************************************************
    ok: [localhost] => {
        "msg": [
            {
                ...
                "custom_username": "username", 
                "custom_password": "********", 
                ...
            }
            ...
    

    if such Custom Test Credentials are configured. This is working for AWX/Tower. You can then follow up with