[re2o_lookup] New examples, more documentation. Not enough yet though.

certbot_on_virtu
_pollion 2020-05-17 19:23:12 +02:00
parent 3436590acf
commit 4319ab1a88
1 changed files with 38 additions and 0 deletions

View File

@ -340,6 +340,18 @@ class LookupModule(LookupBase):
Queries the re2o API and returns the list of
all machines whose role_type is role_name.
- cidrs, a list of subnet_names: Will get back the list of all cidrs
corresponding to this particular
subnet.
- prefixv6, a list of subnet_names: Will get back the list of all ipv6
prefixes corresponding to this
particular subnet.
- A simple endpoint: Will make a raw query to the API using this
this endpoint.
If a term is not in the previous list, make a raw query to the API
with endpoint term.
@ -358,6 +370,32 @@ class LookupModule(LookupBase):
dnszones: "{{ lookup('re2oapi', 'dnszones') }}"
tasks:
- debug: var=dnszones
The following play will use the debug module to output
all the ipv6 corresponding to adherents and adm networks
- hosts: sputnik.adm.crans.org
vars:
prefixv6: "{{ lookup('re2oapi', 'previxv6', 'adherents', 'adm') }}"
tasks:
- debug:
msg: "{{ prefixv6 | ipwrap }}"
The following will get the ip addresses of all servers with role
dns-authorithary-master on vlan 2.
- hosts: sputnik.adm.crans.org
vars:
bind:
masters: "{{ lookup('re2oapi', 'get_role', 'dns-authoritary-master')[0] }}"
tasks:
- name: Display ipv6
debug:
ipv6: "{{ masters | json_query('servers[].interface[?vlan_id==`2`].ipv6[][].ipv6') }}"
- name: Display ipv4
debug:
ipv4: "{{ masters | json_query('servers[].interface[?vlan_id==`2`].ipv4[]') }}"
"""
def _readconfig(self, section="re2o", key=None, default=None,