Hello,
is there a way to get to current Task/Runner object from inside AnsibleModule? My playbook use case goes like this:
- name: My custom environment module
myenvmodule: some_param=some_value
environment: some_env_param: some_env_value1
In myenvmodule code i want to see what was declared in ‘environment: some_env_param: some_env_value1’ part of my playbook.
Anyone know how to access this data?
What was declared in environment would be available as environment
variables, so you could query those.
I think you could also pass environment as a module parameter if you need
the exact set of it.
Yep, the os.getenv typical Python stuff would be your friend here.
The Runner class is not available for normal ansible modules (save Action plugins – which are a special beast and are there to implement special server side glue), as that is a programming construct that only exists on the remote end.