Skip to content

Commit 3eff646

Browse files
committed
fixing ansible.utils.ipaddr FQCN
1 parent f50e73a commit 3eff646

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

collections/requirements.yml

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
collections:
33
- name: amazon.aws
44
version: 3.1.1
5+
- name: ansible.utils
6+
version: 2.5.2
57
- name: ansible.network
68
version: 1.2.0
79
- name: ansible.posix

galaxy.yml

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ dependencies:
4949
# version 19.1.0 introduced a breaking change, fix likely to be released in 19.3.0
5050
# https://github.com/ansible/awx/pull/10336
5151
"amazon.aws": "3.1.1"
52+
"ansible.utils": "2.5.2"
5253
"ansible.netcommon": "2.0.2"
5354
"ansible.posix": "1.3.0"
5455
"ansible.product_demos": "1.2.12"

provisioner/tests/security_verify.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
- name: Fail if eth0 is not in 172.16. or eth1 is not in 172.17.
4141
fail:
4242
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
43-
when: (((hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] | ansible.netcommon.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] | ansible.netcommon.ipaddr('172.17.0.0/16') | string) is not search('172')))
43+
when: (((hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] | ansible.utils.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] | ansible.utils.ipaddr('172.17.0.0/16') | string) is not search('172')))
4444

4545
- name: Fail if private_ip is not in 172.16. or private_ip2 is not in 172.17.
4646
fail:
4747
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
48-
when: (((hostvars[inventory_hostname]['private_ip'] | ansible.netcommon.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['private_ip2'] | ansible.netcommon.ipaddr('172.17.0.0/16') | string) is not search('172')))
48+
when: (((hostvars[inventory_hostname]['private_ip'] | ansible.utils.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['private_ip2'] | ansible.utils.ipaddr('172.17.0.0/16') | string) is not search('172')))
4949

5050
when: '"attack" in inventory_hostname'
5151

@@ -63,12 +63,12 @@
6363
- name: Fail if eth0 is not in 172.16. or eth1 is not in 172.17.
6464
fail:
6565
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
66-
when: (((hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] | ansible.netcommon.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] | ansible.netcommon.ipaddr('172.17.0.0/16') | string) is not search('172')))
66+
when: (((hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] | ansible.utils.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] | ansible.utils.ipaddr('172.17.0.0/16') | string) is not search('172')))
6767

6868
- name: Fail if private_ip is not in 172.16. or private_ip2 is not in 172.17.
6969
fail:
7070
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
71-
when: (((hostvars[inventory_hostname]['private_ip'] | ansible.netcommon.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['private_ip2'] | ansible.netcommon.ipaddr('172.17.0.0/16') | string) is not search('172')))
71+
when: (((hostvars[inventory_hostname]['private_ip'] | ansible.utils.ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['private_ip2'] | ansible.utils.ipaddr('172.17.0.0/16') | string) is not search('172')))
7272
when: '"snort" in inventory_hostname'
7373

7474
- name: Check Point - Windows part

roles/configure_routers/templates/eos_core.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ router bgp {{ device[short_name].local_as }}
3737
address-family ipv4
3838
neighbor {{ device[neighbor].bgp_tunnel_ip }} activate
3939
network 192.168.{{site}}.{{site}} mask 255.255.255.255
40-
network {{ (device[short_name].ospf_tunnel_ip ~ '/24') | ansible.netcommon.ipaddr('network') }} mask 255.255.255.0
40+
network {{ (device[short_name].ospf_tunnel_ip ~ '/24') | ansible.utils.ipaddr('network') }} mask 255.255.255.0
4141
network 10.200.200.0 mask 255.255.255.0
42-
network {{ (private_ip ~ '/16') | ansible.netcommon.ipaddr('network') }}/16
42+
network {{ (private_ip ~ '/16') | ansible.utils.ipaddr('network') }}/16

roles/configure_routers/templates/ios_core.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ router bgp {{ device[short_name].local_as }}
3333
redistribute ospf 1
3434
neighbor {{ device[neighbor].bgp_tunnel_ip }} activate
3535
network 192.168.{{site}}.{{site}} mask 255.255.255.255
36-
network {{ (device[short_name].ospf_tunnel_ip ~ '/24') | ansible.netcommon.ipaddr('network') }} mask 255.255.255.0
36+
network {{ (device[short_name].ospf_tunnel_ip ~ '/24') | ansible.utils.ipaddr('network') }} mask 255.255.255.0
3737
network 10.200.200.0 mask 255.255.255.0
38-
network {{ (private_ip ~ '/16') | ansible.netcommon.ipaddr('network') }}
38+
network {{ (private_ip ~ '/16') | ansible.utils.ipaddr('network') }}
3939
exit-address-family

roles/manage_ec2_instances/tasks/inventory/addhost_security.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
ansible_user: "{{ item.tags.username }}"
7777
ansible_port: "{{ ssh_port }}"
7878
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem"
79-
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.16.0.0/16')|first }}"
80-
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.17.0.0/16')|first }}"
79+
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.utils.ipaddr('172.16.0.0/16')|first }}"
80+
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.utils.ipaddr('172.17.0.0/16')|first }}"
8181
groups:
8282
- security
8383
- security_connection_check
@@ -111,8 +111,8 @@
111111
ansible_user: "{{ item.tags.username }}"
112112
ansible_port: "{{ ssh_port }}"
113113
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem"
114-
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.16.0.0/16')|first }}"
115-
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.17.0.0/16')|first }}"
114+
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.utils.ipaddr('172.16.0.0/16')|first }}"
115+
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.utils.ipaddr('172.17.0.0/16')|first }}"
116116
groups:
117117
- security
118118
- security_connection_check
@@ -164,8 +164,8 @@
164164
ansible_user: "{{ item.tags.username }}"
165165
ansible_port: "{{ ssh_port }}"
166166
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem"
167-
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.16.0.0/16')|first }}"
168-
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.17.0.0/16')|first }}"
167+
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.utils.ipaddr('172.16.0.0/16')|first }}"
168+
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.utils.ipaddr('172.17.0.0/16')|first }}"
169169
groups:
170170
- security
171171
- checkpoint

0 commit comments

Comments
 (0)