From f528c665d761031500b83e161ec91e787a307dad Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 5 Jul 2019 23:01:29 +0200 Subject: fix vm-install role --- inventory/group_vars/all/main.yml | 10 ++++++++++ inventory/host_vars/ch-keyserver.yml | 4 ++++ roles/preseed/tasks/main.yml | 1 + roles/preseed/templates/preseed_debian-buster.cfg.j2 | 4 ++-- roles/preseed/templates/preseed_debian-stretch.cfg.j2 | 4 ++-- roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 4 ++-- roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 4 ++-- .../templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 | 4 ++-- roles/vm/network/templates/interfaces.j2 | 6 ++++++ roles/vm/network/templates/netplan.yaml.j2 | 7 ++++++- 10 files changed, 37 insertions(+), 11 deletions(-) diff --git a/inventory/group_vars/all/main.yml b/inventory/group_vars/all/main.yml index c87fd57c..d3693b76 100644 --- a/inventory/group_vars/all/main.yml +++ b/inventory/group_vars/all/main.yml @@ -8,6 +8,16 @@ global_files_dir: "{{ inventory_dir }}/../files" ssh_keys_root: "{{ ssh_keys.equinox[env_group] }}" + +apt_repo_providers: + default: + debian: deb.debian.org + ubuntu: archive.ubuntu.com + ffgraz: + debian: debian.ffgraz.net + ubuntu: debian.ffgraz.net + + equinox_user: name: equinox password: "{{ vault_equinox_password }}" diff --git a/inventory/host_vars/ch-keyserver.yml b/inventory/host_vars/ch-keyserver.yml index b81455eb..b99ea06e 100644 --- a/inventory/host_vars/ch-keyserver.yml +++ b/inventory/host_vars/ch-keyserver.yml @@ -1,4 +1,6 @@ --- +apt_repo_provider: ffgraz + vm_host: ch-atlas install: @@ -27,3 +29,5 @@ network: ip: "{{ hostvars[vm_host].vm_host.network.prefix | ipaddr(hostvars[vm_host].vm_host.network.offsets[inventory_hostname]) | ipaddr('address') }}" mask: "{{ hostvars[vm_host].vm_host.network.prefix | ipaddr('netmask') }}" gateway: "{{ hostvars[vm_host].vm_host.network.gw }}" + prefix6: "{{ hostvars[vm_host].vm_host.network.prefix6 | ipaddr(hostvars[vm_host].vm_host.network.offsets[inventory_hostname]) | ipaddr('address/prefix') }}" + gateway6: "{{ hostvars[vm_host].vm_host.network.gw6 }}" diff --git a/roles/preseed/tasks/main.yml b/roles/preseed/tasks/main.yml index d8898460..8e00fb82 100644 --- a/roles/preseed/tasks/main.yml +++ b/roles/preseed/tasks/main.yml @@ -1,3 +1,4 @@ +--- - name: Copy initramfs into position copy: remote_src: yes diff --git a/roles/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/preseed/templates/preseed_debian-buster.cfg.j2 index 91cd687a..7dbeb680 100644 --- a/roles/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/preseed/templates/preseed_debian-buster.cfg.j2 @@ -31,7 +31,7 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string deb.debian.org +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} d-i mirror/http/directory string /debian d-i mirror/http/proxy string @@ -116,7 +116,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string deb.debian.org +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python3 python3-apt diff --git a/roles/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/preseed/templates/preseed_debian-stretch.cfg.j2 index a5bef09e..d99a7626 100644 --- a/roles/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -31,7 +31,7 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string deb.debian.org +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} d-i mirror/http/directory string /debian d-i mirror/http/proxy string @@ -116,7 +116,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string deb.debian.org +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt diff --git a/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index d2188392..9d0b13ee 100644 --- a/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -35,7 +35,7 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string archive.ubuntu.com +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} d-i mirror/http/directory string /ubuntu d-i mirror/http/proxy string @@ -121,7 +121,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string archive.ubuntu.com +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt diff --git a/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index e49a3886..9e18c2ee 100644 --- a/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -35,7 +35,7 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string archive.ubuntu.com +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} d-i mirror/http/directory string /ubuntu d-i mirror/http/proxy string @@ -121,7 +121,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string archive.ubuntu.com +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt diff --git a/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 b/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 index cc4c4714..13c30e93 100644 --- a/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 +++ b/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 @@ -33,7 +33,7 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string debian.ffgraz.net +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} d-i mirror/http/directory string /ubuntu d-i mirror/http/proxy string @@ -118,7 +118,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string debian.ffgraz.net +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} tasksel tasksel/first multiselect xubuntu-desktop d-i pkgsel/include string openssh-server python python-apt diff --git a/roles/vm/network/templates/interfaces.j2 b/roles/vm/network/templates/interfaces.j2 index 829a3e7d..d59d53e1 100644 --- a/roles/vm/network/templates/interfaces.j2 +++ b/roles/vm/network/templates/interfaces.j2 @@ -15,3 +15,9 @@ iface {{ network.primary.interface }} inet static gateway {{ network.primary.gateway }} pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf +{% if 'prefix6' in network.primary %} + +iface {{ network.primary.interface }} inet6 static + address {{ network.primary.prefix6 }} + gateway {{ network.primary.gateway6 }} +{% endif %} diff --git a/roles/vm/network/templates/netplan.yaml.j2 b/roles/vm/network/templates/netplan.yaml.j2 index 0d78ab46..7725f15f 100644 --- a/roles/vm/network/templates/netplan.yaml.j2 +++ b/roles/vm/network/templates/netplan.yaml.j2 @@ -5,6 +5,11 @@ network: renderer: networkd ethernets: {{ network.primary.interface }}: - addresses: [ {{ (network.primary.ip + '/' + network.primary.mask) | ipaddr('address/prefix') }} ] + addresses: + - {{ (network.primary.ip + '/' + network.primary.mask) | ipaddr('address/prefix') }} +{% if 'prefix6' in network.primary %} + - {{ network.primary.prefix6 }} + gateway6: {{ network.primary.gateway6 }} +{% endif %} gateway4: {{ network.primary.gateway }} accept-ra: false -- cgit v1.2.3