Ansible lookup plugin throws TypeError: encoding without a string argument

For sake of completeness and in case you want to add this to the documentation of the plugin. To be able to use the plugin with AWX, these are the steps you have to perform:

  • Build a custom AWX Execution Environment using Ansible Builder:
    • add
      py-passbolt
      
      to requirements.txt
    • add
      collections:
          - name: anatomicjc.passbolt
      
      to requirements.yml
  • Add a new Custom Credential Type to AWX:
    • Name: Passbolt Credentials
    • Description: Passbolt credentials for accessing Passbolt
    • Configuration input:
    fields:
      - id: passbolt_url
        type: string
        label: Passbolt Base URL
      - id: passbolt_private_key
        type: string
        label: Passbolt Private GPG Key
        secret: true
        multiline: true
      - id: passbolt_passphrase
        type: string
        label: Passbolt Private GPG Key Passphrase
        secret: true
    required:
      - passbolt_url
      - passbolt_private_key
      - passbolt_passphrase
    
    • Configuration injector:
      env:
        PASSBOLT_BASE_URL: '{{ passbolt_url }}'
        PASSBOLT_PASSPHRASE: '{{ passbolt_passphrase }}'
        PASSBOLT_PRIVATE_KEY: '{{ passbolt_private_key }}'
      
  • Add a new credential of the type Passbolt Credentials to AWX:
    • Set the url and passphrase
    • Upload or paste the contents of the Private key file into the Passbolt Private GPG Key field without any modifications
  • Create or update an AWX template to use the custom EE and add the above defined Passbolt Credentails. The playbook executed by this template will now have access to passbolt using the lookup plugin.