|
176 | 176 | type: boolean
|
177 | 177 | version_added: "0.2.0"
|
178 | 178 | query_filters:
|
179 |
| - description: List of parameters passed to the query string for both devices and VMs (Multiple values may be separated by commas) |
| 179 | + description: |
| 180 | + - List of parameters passed to the query string for both devices and VMs (Multiple values may be separated by commas). |
| 181 | + - You can also use Jinja2 templates. |
180 | 182 | type: list
|
181 | 183 | default: []
|
182 | 184 | device_query_filters:
|
183 |
| - description: List of parameters passed to the query string for devices (Multiple values may be separated by commas) |
| 185 | + description: |
| 186 | + - List of parameters passed to the query string for devices (Multiple values may be separated by commas). |
| 187 | + - You can also use Jinja2 templates. |
184 | 188 | type: list
|
185 | 189 | default: []
|
186 | 190 | vm_query_filters:
|
187 |
| - description: List of parameters passed to the query string for VMs (Multiple values may be separated by commas) |
| 191 | + description: |
| 192 | + - List of parameters passed to the query string for VMs (Multiple values may be separated by commas). |
| 193 | + - You can also use Jinja2 templates. |
188 | 194 | type: list
|
189 | 195 | default: []
|
190 | 196 | timeout:
|
@@ -1941,6 +1947,7 @@ def parse(self, inventory, loader, path, cache=True):
|
1941 | 1947 | super(InventoryModule, self).parse(inventory, loader, path)
|
1942 | 1948 | self._read_config_data(path=path)
|
1943 | 1949 | self.use_cache = cache
|
| 1950 | + self.templar.available_variables = self._vars |
1944 | 1951 |
|
1945 | 1952 | # NetBox access
|
1946 | 1953 | token = self.templar.template(self.get_option("token"), fail_on_undefined=False)
|
@@ -1974,9 +1981,13 @@ def parse(self, inventory, loader, path, cache=True):
|
1974 | 1981 | # Filter and group_by options
|
1975 | 1982 | self.group_by = self.get_option("group_by")
|
1976 | 1983 | self.group_names_raw = self.get_option("group_names_raw")
|
1977 |
| - self.query_filters = self.get_option("query_filters") |
1978 |
| - self.device_query_filters = self.get_option("device_query_filters") |
1979 |
| - self.vm_query_filters = self.get_option("vm_query_filters") |
| 1984 | + self.query_filters = self.templar.template(self.get_option("query_filters")) |
| 1985 | + self.device_query_filters = self.templar.template( |
| 1986 | + self.get_option("device_query_filters") |
| 1987 | + ) |
| 1988 | + self.vm_query_filters = self.templar.template( |
| 1989 | + self.get_option("vm_query_filters") |
| 1990 | + ) |
1980 | 1991 | self.virtual_chassis_name = self.get_option("virtual_chassis_name")
|
1981 | 1992 | self.dns_name = self.get_option("dns_name")
|
1982 | 1993 | self.ansible_host_dns_name = self.get_option("ansible_host_dns_name")
|
|
0 commit comments