Skip to content

Commit

Permalink
syncing ansible.netcommon.ipaddr FQCN
Browse files Browse the repository at this point in the history
  • Loading branch information
IPvSean committed Mar 10, 2022
1 parent 1697f91 commit f50e73a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions demos/networking/dmvpn/ios_hub.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ crypto ipsec transform-set {{ dmvpn_transform_set | default('xform')}} esp-aes 2
mode transport
!
router ospf 1
network {{ dmvpn_network | ipaddr('network')}} 0.0.0.255 area 1
network {{ dmvpn_network | ansible.netcommon.ipaddr('network')}} 0.0.0.255 area 1
!
crypto ipsec profile {{ dmvpn_ipsec_profile | default('ipsec-prof')}}
set transform-set {{ dmvpn_transform_set | default('xform')}}
!
interface Tunnel2
ip address {{ dmvpn_network | ipaddr(254) | ipaddr('address') }} {{ dmvpn_network | ipaddr('netmask') }}
ip address {{ dmvpn_network | ansible.netcommon.ipaddr(254) | ansible.netcommon.ipaddr('address') }} {{ dmvpn_network | ansible.netcommon.ipaddr('netmask') }}
no ip redirects
ip mtu 1400
ip ospf network broadcast
Expand Down
8 changes: 4 additions & 4 deletions provisioner/tests/security_verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
- name: Fail if eth0 is not in 172.16. or eth1 is not in 172.17.
fail:
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
when: (((hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] | ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] | ipaddr('172.17.0.0/16') | string) is not search('172')))
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')))

- name: Fail if private_ip is not in 172.16. or private_ip2 is not in 172.17.
fail:
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
when: (((hostvars[inventory_hostname]['private_ip'] | ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['private_ip2'] | ipaddr('172.17.0.0/16') | string) is not search('172')))
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')))

when: '"attack" in inventory_hostname'

Expand All @@ -63,12 +63,12 @@
- name: Fail if eth0 is not in 172.16. or eth1 is not in 172.17.
fail:
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
when: (((hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] | ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] | ipaddr('172.17.0.0/16') | string) is not search('172')))
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')))

- name: Fail if private_ip is not in 172.16. or private_ip2 is not in 172.17.
fail:
msg: "IP address setup on ethX is not right on {{ inventory_hostname }}."
when: (((hostvars[inventory_hostname]['private_ip'] | ipaddr('172.16.0.0/16') | string) is not search('172')) or ((hostvars[inventory_hostname]['private_ip2'] | ipaddr('172.17.0.0/16') | string) is not search('172')))
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')))
when: '"snort" in inventory_hostname'

- name: Check Point - Windows part
Expand Down
12 changes: 6 additions & 6 deletions roles/manage_ec2_instances/tasks/inventory/addhost_security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
ansible_user: "{{ item.tags.username }}"
ansible_port: "{{ ssh_port }}"
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem"
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ipaddr('172.16.0.0/16')|first }}"
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ipaddr('172.17.0.0/16')|first }}"
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.16.0.0/16')|first }}"
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.17.0.0/16')|first }}"
groups:
- security
- security_connection_check
Expand Down Expand Up @@ -111,8 +111,8 @@
ansible_user: "{{ item.tags.username }}"
ansible_port: "{{ ssh_port }}"
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem"
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ipaddr('172.16.0.0/16')|first }}"
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ipaddr('172.17.0.0/16')|first }}"
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.16.0.0/16')|first }}"
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.17.0.0/16')|first }}"
groups:
- security
- security_connection_check
Expand Down Expand Up @@ -164,8 +164,8 @@
ansible_user: "{{ item.tags.username }}"
ansible_port: "{{ ssh_port }}"
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem"
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ipaddr('172.16.0.0/16')|first }}"
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ipaddr('172.17.0.0/16')|first }}"
private_ip: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.16.0.0/16')|first }}"
private_ip2: "{{ item['network_interfaces']|map(attribute='private_ip_address')|list|ansible.netcommon.ipaddr('172.17.0.0/16')|first }}"
groups:
- security
- checkpoint
Expand Down

0 comments on commit f50e73a

Please sign in to comment.