Fix types for new ansible
Is more strict about types. See https://docs.ansible.com/projects/ansible/latest/porting_guides/porting_guide_core_2.19.html#broken-conditionals
This commit is contained in:
parent
e93cdfd1dd
commit
88061d97b2
3 changed files with 9 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ class FilterModule(object):
|
||||||
return {
|
return {
|
||||||
'defaultattr': self.defaultattr,
|
'defaultattr': self.defaultattr,
|
||||||
'list2dict': self.list2dict,
|
'list2dict': self.list2dict,
|
||||||
|
'any': self.any,
|
||||||
}
|
}
|
||||||
|
|
||||||
def defaultattr(self, objects, attr, val=None):
|
def defaultattr(self, objects, attr, val=None):
|
||||||
|
|
@ -19,3 +20,9 @@ class FilterModule(object):
|
||||||
Like items2dict but keep entire dictionaries as values.
|
Like items2dict but keep entire dictionaries as values.
|
||||||
'''
|
'''
|
||||||
return {item[key]: item for item in items}
|
return {item[key]: item for item in items}
|
||||||
|
|
||||||
|
def any(self, items):
|
||||||
|
'''
|
||||||
|
Return True if any item in the list is True.
|
||||||
|
'''
|
||||||
|
return any(items)
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@
|
||||||
when: not is_proxmox # proxmox has its own firewall configuration
|
when: not is_proxmox # proxmox has its own firewall configuration
|
||||||
|
|
||||||
- name: Run SSH instance in management VRF
|
- name: Run SSH instance in management VRF
|
||||||
when: interfaces | selectattr('vrf') | selectattr('vrf.name', '==', 'mgmt')
|
when: interfaces | selectattr('vrf') | selectattr('vrf.name', '==', 'mgmt') | any
|
||||||
block:
|
block:
|
||||||
- name: Configure SSH instance in management VRF
|
- name: Configure SSH instance in management VRF
|
||||||
copy:
|
copy:
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
services: '{{
|
services: '{{
|
||||||
query("netbox.netbox.nb_lookup", "services", raw_data=true,
|
query("netbox.netbox.nb_lookup", "services", raw_data=true,
|
||||||
api_filter=("virtual_machine_id" if is_virtual else "device_id")+"="+id) }}'
|
api_filter=("virtual_machine_id" if is_virtual else "device_id")~"="~id) }}'
|
||||||
|
|
||||||
- when: 'cluster is defined and not is_virtual'
|
- when: 'cluster is defined and not is_virtual'
|
||||||
block:
|
block:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue