forked from FF-RGB/ansible
gre tunnels between gateways
This commit is contained in:
parent
f1b9e3f72c
commit
8d92dc9c82
@ -7,6 +7,24 @@ confluence_dbname: confluence
|
||||
confluence_dbuser: confluence
|
||||
confluence_dbpass: "{{ vault_confluence_dbpass }}"
|
||||
|
||||
gre_prefix: 10.90.232.0/24
|
||||
gre_matrix:
|
||||
# - { id: 1, a: svcs, b: gw11 }
|
||||
# - { id: 2, a: svcs, b: gw12 }
|
||||
# - { id: 3, a: svcs, b: gw21 }
|
||||
# - { id: 4, a: svcs, b: gw22 }
|
||||
# - { id: 5, a: svcs, b: gw31 }
|
||||
# - { id: 9, a: gw11, b: gw12 }
|
||||
- { id: 10, a: gw11, b: gw21 }
|
||||
# - { id: 11, a: gw11, b: gw22 }
|
||||
- { id: 12, a: gw11, b: gw31 }
|
||||
# - { id: 17, a: gw12, b: gw21 }
|
||||
# - { id: 18, a: gw12, b: gw22 }
|
||||
# - { id: 19, a: gw12, b: gw31 }
|
||||
# - { id: 25, a: gw21, b: gw22 }
|
||||
- { id: 26, a: gw21, b: gw31 }
|
||||
# - { id: 33, a: gw22, b: gw31 }
|
||||
|
||||
ntp_servers:
|
||||
- 0.de.pool.ntp.org
|
||||
- 1.de.pool.ntp.org
|
||||
|
@ -12,3 +12,7 @@
|
||||
- name: Configure mesh interfaces
|
||||
template: src=mesh.conf.j2 dest=/etc/network/interfaces.d/mesh.conf
|
||||
notify: Reload interfaces
|
||||
|
||||
- name: Configure backbone interfaces
|
||||
template: src=backbone.conf.j2 dest=/etc/network/interfaces.d/backbone.conf
|
||||
notify: Reload interfaces
|
||||
|
26
roles/mesh-interfaces/templates/backbone.conf.j2
Normal file
26
roles/mesh-interfaces/templates/backbone.conf.j2
Normal file
@ -0,0 +1,26 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for link in gre_matrix %}
|
||||
{% if ansible_hostname.startswith(link.a) or ansible_hostname.startswith(link.b) %}
|
||||
{% if ansible_hostname.startswith(link.a) %}
|
||||
{% set ifname = "tun-%s" % link.b %}
|
||||
{% set address = gre_prefix | ipsubnet(31, link.id * 2) | ipaddr(0) %}
|
||||
{% set peer = "%s.%s" % (link.b, site_domain) %}
|
||||
{% else %}
|
||||
{% set ifname = "tun-%s" % link.a %}
|
||||
{% set address = gre_prefix | ipsubnet(31, link.id * 2) | ipaddr(1) %}
|
||||
{% set peer = "%s.%s" % (link.a, site_domain) %}
|
||||
{% endif %}
|
||||
# {{ ifname }}
|
||||
auto {{ ifname }}
|
||||
iface {{ ifname }} inet tunnel
|
||||
mode gre
|
||||
local {{ ansible_default_ipv4.address }}
|
||||
endpoint {{ peer | resolve('a') }}
|
||||
#
|
||||
address {{ address }}
|
||||
ttl 64
|
||||
mtu 1400
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
Loading…
Reference in New Issue
Block a user