How to load an ini file that is on the remote server?

Posted on

Question: How can I load an ini file that is on the remote server?
Goal:
We have an ini/env file on the remote/target servers.
We want to read in the ini/env file on the remote server to provide some variables during the task on that machine.
( FYI: In our process we will not be saving these variables/values into the Tower inventory - even though that would be nice. )

Environment:
We are running playbooks from Ansible Tower 2.5.10,
and Remote /Target servers have Ansible 2.4.2.0 & Python 2.7.5

What I have tried already:
I have tried the with_ini: {{ path to ini file }} type of loop, but that did not work for me. I tried delegating the task to {{ inventory_hostname }}, to try forcing the ini file to be found on the remote host - but that did not help.

This is what the ini file looks like (values changed):
/devops/properties/Admin.properties
username = FooAdmin
password = bar123YZ
activate = no

Thanks in advance for any help.

Responses