semaphore
semaphore copied to clipboard
Workaround for missing shll enviroment variables?
I want to use the nb_inventory_inventory and therefore need to pass in the API endpoint and token as "shell enviroments". What currently probably does not work with semaphore.
AWX/TOWER has the same problem and the following solution:
# For use in Ansible Tower (AWX), please see this blog from RedHat: https://www.ansible.com/blog/using-an-inventory-plugin-from-a-collection-in-ansible-tower
# The credential for NetBox will need to expose NETBOX_API and NETBOX_TOKEN as environment variables.
# Example Ansible Tower credential Input Configuration:
fields:
- id: NETBOX_API
type: string
label: NetBox Host URL
- id: NETBOX_TOKEN
type: string
label: NetBox API Token
secret: true
required:
- NETBOX_API
- NETBOX_TOKEN
# Example Ansible Tower credential Injector Configuration:
env:
NETBOX_API: '{{ NETBOX_API }}'
NETBOX_TOKEN: '{{ NETBOX_TOKEN }}'
I couldn't find a suitable equivalent for this on your end.
Any idea or solution?
You could pass the ENV variable through the Semaphore unit file, although that's problematic, especially if you have several inventories that need different keys (which is the case that I have).
To be honest, we keep recommending Semaphore to our clients as a lightweight Ansible GUI and almost every time we have to abandon it because it lacks the support for environment variables.
I'm currently considering re-adding this functionality: https://github.com/ansible-semaphore/semaphore/pull/458 but am not sure whether it would get merged.