1

Package: awx.awx

Module: credential_type

I am attempting to generate custom AWX credential types using the awx.awx.credential_type.

According to the documentation, this should just work. However, I keep getting the error "undefined variable" (exact error string at the bottom).

Has anyone faced this, or have any clue what I could be doing wrong? We have quite a few custom types that I would like to create using CaaC rather than manually in the UI.

---
- name: Configure AWX
  hosts: localhost
  connection: local
  become: false
  gather_facts: false
  tasks:
  - name: "custom-vault"
    awx.awx.credential_type:
      name: "Custom Vault"
      description: ""
      kind: cloud
      inputs: {
          "fields": [
            {
              "id": "username",
              "type": "string",
              "label": "Username",
              "secret": false
            },
            {
              "id": "password",
              "type": "string",
              "label": "Password",
              "secret": true
            },
            {
              "id": "vault_addr",
              "type": "string",
              "label": "Custom Vault Address"
            }
          ]
        }
      injectors: {
        "env": {
          "VAULT_USERNAME": "{{ username }}",
          "VAULT_PASSWORD": "{{ password }}",
          "VAULT_ADDR": "{{ vault_addr }}"
        }
      }
      state: present
      validate_certs: false

Error:

The task includes an option with an undefined variable. The error was: 'vault_addr' is undefined. 'vault_addr' is undefined

The error appears to be in 'create_creds.yml': line 9, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


. - name: \"custom-vault\"
.  ^ here

FYI - According to the linter in VSCode, the YAML syntax is correct, spacing and all.

Sagar
  • 9,456
  • 6
  • 54
  • 96

0 Answers0