The variables field is for Ansible extra_vars that will be injected in a playbook run, not an inventory sync. It looks like you want ENV vars injected into your custom inventory script during an inventory sync. For that, you can use a custom credential type. https://docs.ansible.com/ansible-tower/latest/html/userguide/credential_types.html