summaryrefslogtreecommitdiff
path: root/dan/ele-mur.yml
blob: 967a4c0169c7a5d33ecf371a44dc2c944b71717c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
- name: Basic Setup
  hosts: ele-mur
  roles:
  - role: apt-repo/base
  - role: core/base
  - role: core/sshd/base
  - role: core/zsh
  post_tasks:
  - name: install interface config for guest vlan
    copy:
      content: |
        auto funkfeuer0
        iface funkfeuer0 inet static
          address {{ network_zones.murat_transfer.prefix | ipaddr(network_zones.murat_transfer.offsets[inventory_hostname]) | ipaddr('address/prefix') }}
          up ip route add {{ network_zones.funkfeuer.prefix | ipaddr('network/prefix') }} via {{ network_zones.murat_transfer.prefix | ipaddr(network_zones.murat_transfer.offsets['ele-tub']) | ipaddr('address') }}
          up iptables -t nat -A POSTROUTING -s {{ network_zones.funkfeuer.prefix | ipaddr('network/prefix') }} -o {{ ansible_default_ipv4.interface }} -j SNAT --to {{ ansible_default_ipv4.address }}
          up ip route add {{ hostvars['glt-gw-r3'].network_zones.r3_ff.prefix | ipaddr(hostvars['glt-gw-r3'].network_zones.r3_ff.offsets['glt-gw-r3']) | ipaddr('address') }} via {{ network_zones.murat_transfer.prefix | ipaddr(network_zones.murat_transfer.offsets['ff-10g']) | ipaddr('address') }}
          up iptables -t nat -A POSTROUTING -s {{ hostvars['glt-gw-r3'].network_zones.r3_ff.prefix | ipaddr(hostvars['glt-gw-r3'].network_zones.r3_ff.offsets['glt-gw-r3']) | ipaddr('address') }} -o {{ ansible_default_ipv4.interface }} -j SNAT --to {{ ansible_default_ipv4.address }}
          up sysctl net.ipv4.ip_forward=1
          down ip route del {{ hostvars['glt-gw-r3'].network_zones.r3_ff.prefix | ipaddr(hostvars['glt-gw-r3'].network_zones.r3_ff.offsets['glt-gw-r3']) | ipaddr('address') }} via {{ network_zones.murat_transfer.prefix | ipaddr(network_zones.murat_transfer.offsets['ff-10g']) | ipaddr('address') }}
          down iptables -t nat -D POSTROUTING -s {{ hostvars['glt-gw-r3'].network_zones.r3_ff.prefix | ipaddr(hostvars['glt-gw-r3'].network_zones.r3_ff.offsets['glt-gw-r3']) | ipaddr('address') }} -o {{ ansible_default_ipv4.interface }} -j SNAT --to {{ ansible_default_ipv4.address }}
          down iptables -t nat -D POSTROUTING -s {{ network_zones.funkfeuer.prefix | ipaddr('network/prefix') }} -o {{ ansible_default_ipv4.interface }} -j SNAT --to {{ ansible_default_ipv4.address }}
          down ip route del {{ network_zones.funkfeuer.prefix | ipaddr('network/prefix') }} via {{ network_zones.murat_transfer.prefix | ipaddr(network_zones.murat_transfer.offsets['ele-tub']) | ipaddr('address') }}
      dest: /etc/network/interfaces.d/funkfeuer0