lookup_plugins package¶
Submodules¶
lookup_plugins.application_gid module¶
- class lookup_plugins.application_gid.LookupModule(loader: _dataloader.DataLoader | None = None, templar: _template.Templar | None = None, **kwargs)¶
Bases:
LookupBase- run(terms, variables=None, **kwargs)¶
When the playbook specifies a lookup, this method is run. The arguments to the lookup become the arguments to this method. One additional keyword argument named
variablesis added to the method call. It contains the variables available to ansible at the time the lookup is templated. For instance:"{{ lookup('url', 'https://toshio.fedorapeople.org/one.txt', validate_certs=True) }}"- would end up calling the lookup plugin named url’s run method like this::
run([’https://toshio.fedorapeople.org/one.txt’], variables=available_variables, validate_certs=True)
Lookup plugins can be used within playbooks for looping. When this happens, the first argument is a list containing the terms. Lookup plugins can also be called from within playbooks to return their values into a variable or parameter. If the user passes a string in this case, it is converted into a list.
Errors encountered during execution should be returned by raising AnsibleError() with a message describing the error.
Any strings returned by this method that could ever contain non-ascii must be converted into python’s unicode type as the strings will be run through jinja2 which has this requirement. You can use:
from ansible.module_utils.common.text.converters import to_text result_string = to_text(result_string)
lookup_plugins.colorscheme module¶
- class lookup_plugins.colorscheme.LookupModule(loader: _dataloader.DataLoader | None = None, templar: _template.Templar | None = None, **kwargs)¶
Bases:
LookupBase- run(terms, variables=None, **kwargs)¶
When the playbook specifies a lookup, this method is run. The arguments to the lookup become the arguments to this method. One additional keyword argument named
variablesis added to the method call. It contains the variables available to ansible at the time the lookup is templated. For instance:"{{ lookup('url', 'https://toshio.fedorapeople.org/one.txt', validate_certs=True) }}"- would end up calling the lookup plugin named url’s run method like this::
run([’https://toshio.fedorapeople.org/one.txt’], variables=available_variables, validate_certs=True)
Lookup plugins can be used within playbooks for looping. When this happens, the first argument is a list containing the terms. Lookup plugins can also be called from within playbooks to return their values into a variable or parameter. If the user passes a string in this case, it is converted into a list.
Errors encountered during execution should be returned by raising AnsibleError() with a message describing the error.
Any strings returned by this method that could ever contain non-ascii must be converted into python’s unicode type as the strings will be run through jinja2 which has this requirement. You can use:
from ansible.module_utils.common.text.converters import to_text result_string = to_text(result_string)
lookup_plugins.local_mtime_qs module¶
- class lookup_plugins.local_mtime_qs.LookupModule(loader: _dataloader.DataLoader | None = None, templar: _template.Templar | None = None, **kwargs)¶
Bases:
LookupBaseReturn a cache-busting string based on the LOCAL file’s mtime.
- Usage (single path → string via Jinja):
{{ lookup(‘local_mtime_qs’, ‘/path/to/file.css’) }} -> “?version=1712323456”
- Options:
param (str): query parameter name (default: “version”) mode (str): “qs” (default) → returns “?<param>=<mtime>”
“epoch” → returns “<mtime>”
- Multiple paths (returns list, one result per term):
{{ lookup(‘local_mtime_qs’, ‘/a.js’, ‘/b.js’, param=’v’) }}
- run(terms, variables=None, **kwargs)¶
When the playbook specifies a lookup, this method is run. The arguments to the lookup become the arguments to this method. One additional keyword argument named
variablesis added to the method call. It contains the variables available to ansible at the time the lookup is templated. For instance:"{{ lookup('url', 'https://toshio.fedorapeople.org/one.txt', validate_certs=True) }}"- would end up calling the lookup plugin named url’s run method like this::
run([’https://toshio.fedorapeople.org/one.txt’], variables=available_variables, validate_certs=True)
Lookup plugins can be used within playbooks for looping. When this happens, the first argument is a list containing the terms. Lookup plugins can also be called from within playbooks to return their values into a variable or parameter. If the user passes a string in this case, it is converted into a list.
Errors encountered during execution should be returned by raising AnsibleError() with a message describing the error.
Any strings returned by this method that could ever contain non-ascii must be converted into python’s unicode type as the strings will be run through jinja2 which has this requirement. You can use:
from ansible.module_utils.common.text.converters import to_text result_string = to_text(result_string)