diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-03 21:20:44 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-03 21:20:44 +0200 |
commit | 696a621e873a4a431ef182dab4b25817080587bc (patch) | |
tree | 080b1c89a3690aabfc3ad913aaf51e20783cf787 | |
parent | d6ab246986fc8bbc482f78e411adbd10f1bca113 (diff) | |
download | infra-696a621e873a4a431ef182dab4b25817080587bc.tar.gz infra-696a621e873a4a431ef182dab4b25817080587bc.tar.bz2 infra-696a621e873a4a431ef182dab4b25817080587bc.tar.xz infra-696a621e873a4a431ef182dab4b25817080587bc.zip |
lxc-host: Supporting gateway and dns too.
-rw-r--r-- | ansible/group_vars/all/host_database.yml | 6 | ||||
-rw-r--r-- | ansible/roles/lxc-host/tasks/networkd.yml | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/ansible/group_vars/all/host_database.yml b/ansible/group_vars/all/host_database.yml index 654ef18..7a38e20 100644 --- a/ansible/group_vars/all/host_database.yml +++ b/ansible/group_vars/all/host_database.yml @@ -19,9 +19,9 @@ host_database: ipv4: address: 192.168.10.3 netmask: 24 - ipv6: - address: cafe::1 - netmask: 64 + gateway: 192.168.10.1 + dns: + - 8.8.8.8 # Birgitte nextcloud: diff --git a/ansible/roles/lxc-host/tasks/networkd.yml b/ansible/roles/lxc-host/tasks/networkd.yml index 39d8a69..7ddfaed 100644 --- a/ansible/roles/lxc-host/tasks/networkd.yml +++ b/ansible/roles/lxc-host/tasks/networkd.yml @@ -50,10 +50,18 @@ [Network] {% if internal_if.ipv4 is defined %} Address={{ internal_if.ipv4.address }}/{{ internal_if.ipv4.netmask }} + {% if internal_if.ipv4.gateway is defined %} + Gateway={{ internal_if.ipv4.gateway }} + {% endif %} {% endif %} {% if internal_if.ipv6 is defined %} Address={{ internal_if.ipv6.address }}/{{ internal_if.ipv6.netmask }} {% endif %} + {% if internal_if.dns is defined %} + {% for dns in internal_if.dns %} + DNS={{ dns }} + {% endfor %} + {% endif %} - name: "{{ file_prefix }}-3-{{ lxc_host__internal_if }}.netdev" notify: systemctl restart systemd-networkd |