I am developing an Ansible Role, which provides a lookup plugin, but I am struggling to access the Role Variables from within the lookup function.
The relevant part of my Ansible Playbook looks like this:
tasks:
- ansible.builtin.import_role:
name: my_lookup_role
vars:
lookup_url: "https://lookup.url"
I am trying to access the value of lookup_url from within my lookup plugin - the relevant part of my lookup plugin is (which is located at ./roles/my_lookup_role/lookup_plugins/my_lookup_role.py):
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
def run(self, terms, variables=None, **kwargs):
# variables['lookup_url'] is None
I can see that variables is set to lots of variables associated with my playbook, but not the Role Variables - are pointers?