diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-01-12 18:12:03 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-01-12 18:12:03 +0100 |
commit | 8d8db0ea6d43914553ca83bada037bb90f8de469 (patch) | |
tree | 2dedb199bc93cfda330dbc00eb777f9fcb351199 /roles | |
parent | nicer firewall script (diff) |
ele-media: added simple network setup
Diffstat (limited to 'roles')
-rw-r--r-- | roles/elevate/media/handlers/main.yml | 3 | ||||
-rw-r--r-- | roles/elevate/media/tasks/main.yml | 3 | ||||
-rw-r--r-- | roles/elevate/media/tasks/network.yml | 35 | ||||
-rw-r--r-- | roles/elevate/media/templates/netplan/lan-only.yaml.j2 | 11 | ||||
-rw-r--r-- | roles/elevate/media/templates/netplan/r3-with-lan.yaml.j2 | 18 | ||||
-rw-r--r-- | roles/elevate/media/templates/netplan/r3.yaml.j2 | 12 |
6 files changed, 82 insertions, 0 deletions
diff --git a/roles/elevate/media/handlers/main.yml b/roles/elevate/media/handlers/main.yml index 6deed0cd..c0c1be37 100644 --- a/roles/elevate/media/handlers/main.yml +++ b/roles/elevate/media/handlers/main.yml @@ -1,4 +1,7 @@ --- +- name: netplan apply + command: netplan apply + - name: restart nginx service: name: nginx diff --git a/roles/elevate/media/tasks/main.yml b/roles/elevate/media/tasks/main.yml index 9633a0e1..b2a93999 100644 --- a/roles/elevate/media/tasks/main.yml +++ b/roles/elevate/media/tasks/main.yml @@ -8,6 +8,9 @@ - python-openssl state: present +- name: configure network + import_tasks: network.yml + - name: configure nginx import_tasks: nginx.yml diff --git a/roles/elevate/media/tasks/network.yml b/roles/elevate/media/tasks/network.yml new file mode 100644 index 00000000..e1651ab5 --- /dev/null +++ b/roles/elevate/media/tasks/network.yml @@ -0,0 +1,35 @@ +--- +- name: create netplan conf-available directory + file: + path: /etc/netplan/conf-available + state: directory + +- name: install netplan configs + template: + src: "netplan/{{ item }}.yaml.j2" + dest: "/etc/netplan/conf-available/{{ item }}.yaml" + with_items: + - lan-only + - r3 + - r3-with-lan + # - festival + # - elevate-office + # - dhcp + notify: netplan apply + +- name: remove default netplan config + file: + path: /etc/netplan/01-netcfg.yaml + state: absent + notify: netplan apply + +- name: set active netwok setup + file: + state: link + dest: /etc/netplan/01-active.yaml + src: "conf-available/{{ network_setup }}.yaml" + notify: netplan apply + +- name: make sure network config has been applied + meta: flush_handlers + diff --git a/roles/elevate/media/templates/netplan/lan-only.yaml.j2 b/roles/elevate/media/templates/netplan/lan-only.yaml.j2 new file mode 100644 index 00000000..689c3118 --- /dev/null +++ b/roles/elevate/media/templates/netplan/lan-only.yaml.j2 @@ -0,0 +1,11 @@ +network: + version: 2 + renderer: networkd + ethernets: + {{ network.primary.interface }}: + addresses: [ {{ (network.primary.ip + '/' + network.primary.mask) | ipaddr('address/prefix') }} ] + gateway4: {{ network.primary.gateway }} + accept-ra: false + nameservers: + search: [ {{ network.domain }} ] + addresses: {{ network.nameservers | to_json }} diff --git a/roles/elevate/media/templates/netplan/r3-with-lan.yaml.j2 b/roles/elevate/media/templates/netplan/r3-with-lan.yaml.j2 new file mode 100644 index 00000000..087c9b54 --- /dev/null +++ b/roles/elevate/media/templates/netplan/r3-with-lan.yaml.j2 @@ -0,0 +1,18 @@ +network: + version: 2 + renderer: networkd + ethernets: + {{ network.primary.interface }}: + addresses: [ {{ (network.primary.ip + '/' + network.primary.mask) | ipaddr('address/prefix') }} ] + accept-ra: false + vlans: + {{ network.primary.interface }}.{{ network_zones.dom.vlan }}: + id: {{ network_zones.dom.vlan }} + link: {{ network.primary.interface }} + addresses: [ 89.106.211.61/27 ] + gateway4: 89.106.211.33 + accept-ra: false + nameservers: + search: [ elevate.at ] + addresses: + - "89.106.211.33" diff --git a/roles/elevate/media/templates/netplan/r3.yaml.j2 b/roles/elevate/media/templates/netplan/r3.yaml.j2 new file mode 100644 index 00000000..2429a4b7 --- /dev/null +++ b/roles/elevate/media/templates/netplan/r3.yaml.j2 @@ -0,0 +1,12 @@ +network: + version: 2 + renderer: networkd + ethernets: + {{ network.primary.interface }}: + addresses: [ 89.106.211.61/27 ] + gateway4: 89.106.211.33 + accept-ra: false + nameservers: + search: [ elevate.at ] + addresses: + - "89.106.211.33" |