Skip to content
This repository was archived by the owner on Oct 10, 2023. It is now read-only.

Commit c0bcd1c

Browse files
authored
Merge pull request #491 from puppetlabs/IMAGES-1217
(IMAGES-1217) Fix double interface ip on ubuntu-1804+
2 parents 519b3ae + 51720bb commit c0bcd1c

File tree

12 files changed

+41
-71
lines changed

12 files changed

+41
-71
lines changed

manifests/modules/packer/manifests/vsphere/networking.pp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@
2323
enable_dhcp => true,
2424
}
2525
}
26-
if ($facts['operatingsystemmajrelease'] in ['9', '16.04', '18.04', '18.10']) {
26+
if ($facts['operatingsystemmajrelease'] in ['9', '16.04']) {
2727
network::interface { 'ens160':
2828
enable_dhcp => true,
2929
}
3030
}
31-
if $facts['operatingsystemmajrelease'] in ['10', '20.04'] {
31+
if $facts['operatingsystemmajrelease'] in ['10'] {
3232
network::interface { 'ens192':
3333
enable_dhcp => true,
3434
}
3535
}
36+
# ubuntu '18.04', '18.10', '20.04' includes a /etc/netplan that already configures the network with dhcp. Adding a network::interface
37+
# here sets up two interfaces each with an IP. https://tickets.puppetlabs.com/browse/IMAGES-1217
3638
}
3739

3840
redhat: {

manifests/modules/packer/manifests/vsphere/repos.pp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@
8585
priority => 1001,
8686
}
8787
}
88+
89+
# IMAGES-1217, for some reason the rebuild of ubuntu 18.04 was missing bionic-updates
90+
if $facts['operatingsystem'] == 'Ubuntu' and $facts['operatingsystemrelease'] == '18.04' {
91+
apt::source { "${facts['lsbdistcodename']}-updates":
92+
release => $updates_release,
93+
location => "${repo_mirror}/${repo_name}",
94+
repos => $repo_list,
95+
include => {
96+
'src' => true,
97+
'deb' => true,
98+
},
99+
}
100+
}
88101
}
89102

90103
redhat: {

manifests/modules/packer/templates/vsphere/ubuntu.rb.erb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ File.open('/etc/dhcp/dhclient.conf', 'w') do |f|
2525
<% if ['15.10', '16.04', '16.10'].include? @operatingsystemrelease -%>
2626
dhc.gsub!(/^(send host-name.*)/, "send host-name \"#{hostname}\";")
2727
<% else -%>
28-
dhc.gsub!(/^(#send host-name.*)/, "send host-name \"#{hostname}\";")
28+
dhc.gsub!(/^(#?send host-name.*)/, "send host-name \"#{hostname}\";")
2929
<% end -%>
3030
f.write(dhc)
3131
end
@@ -42,15 +42,16 @@ puts '- Re-obtaining DHCP lease...'
4242
# NetworkManager
4343
Kernel.system('/usr/sbin/service networking restart')
4444
<% elsif ['18.04', '18.10', '20.04'].include? @operatingsystemrelease -%>
45-
# systemd-networkd's DHCP client uses /etc/machine-id instead of the link layer address (as dhclient does) to generate a client ID
46-
# /etc/machine-id will be the same on VMs cloned from the same template, so regenerate it:
47-
File.delete('/etc/machine-id')
48-
Kernel.system('/bin/systemd-machine-id-setup')
49-
Kernel.system('/bin/systemctl daemon-reload')
45+
# netplan uses machine-id or client-it as identifier by default, but we need a different value for
46+
# each VM, so configure netplan's dhcp to use mac addresses
47+
#open('/etc/netplan/01-netcfg.yaml', 'a') { |f|
48+
# f.puts " dhcp-identifier: mac"
49+
#}
5050
51-
# disable systemd-resolved - more info here: https://tickets.puppetlabs.com/browse/QENG-6928
52-
Kernel.system('rm /etc/resolv.conf')
53-
Kernel.system('ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf')
51+
# NOTE: not needed anymore, disable systemd-resolved - more info here: https://tickets.puppetlabs.com/browse/QENG-6928
52+
# see superseding ticket IMAGES-1217
53+
# Kernel.system('rm /etc/resolv.conf')
54+
# Kernel.system('ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf')
5455
5556
Kernel.system('/bin/systemctl restart systemd-networkd')
5657
<% else -%>

templates/ubuntu/18.04/common/files/preseed.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ d-i preseed/late_command string \
3232
sed -i 's/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*/\1\"\"/g' /target/etc/default/grub; \
3333
in-target bash -c 'update-grub2'; \
3434
in-target sed -i 's/.*PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config ; \
35+
in-target bash -c 'echo " dhcp-identifier: mac" >> /etc/netplan/01-netcfg.yaml' ; \
36+
in-target bash -c 'echo " nameservers:" >> /etc/netplan/01-netcfg.yaml' ; \
37+
in-target bash -c 'echo " search: [delivery.puppetlabs.net, local]" >> /etc/netplan/01-netcfg.yaml' ; \
3538
in-target apt-get -y upgrade
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"boot_command" : "<esc><wait><esc><wait><enter><wait>/install/vmlinuz console-setup/ask_detect=false console-setup/layoutcode=us console-setup/modelcode=pc105 debconf/frontend=noninteractive debian-installer=en_US fb=false initrd=/install/initrd.gz kbd-chooser/method=us keyboard-configuration/layout=USA keyboard-configuration/variant=USA locale=en_US.UTF-8 netcfg/get_domain=vm netcfg/get_hostname=localhost grub-installer/bootdev=/dev/sda noapic preseed/file=/floppy/preseed.cfg -- <wait><enter>",
2+
"boot_command" : "<esc><wait><esc><wait><enter><wait>/install/vmlinuz console-setup/ask_detect=false console-setup/layoutcode=us console-setup/modelcode=pc105 debconf/frontend=noninteractive debian-installer=en_US fb=false initrd=/install/initrd.gz kbd-chooser/method=us keyboard-configuration/layout=USA keyboard-configuration/variant=USA locale=en_US.UTF-8 netcfg/get_domain=vm netcfg/get_hostname=localhost grub-installer/bootdev=/dev/sda preseed/file=/floppy/preseed.cfg -- <wait><enter>",
33
"vmware_base_boot_wait" : "15s"
44
}

templates/ubuntu/18.04/x86_64/vars.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"template_name" : "ubuntu-1804-x86_64",
33
"template_os" : "ubuntu64Guest",
44
"beakerhost" : "ubuntu1804-64",
5-
"version" : "0.0.4",
5+
"version" : "0.0.12",
66
"iso_checksum" : "a7f5c7b0cdd0e9560d78f1e47660e066353bb8a79eb78d1fc3f4ea62a07e6cbc",
77
"iso_checksum_type" : "sha256",
8-
"vmware_vsphere_base_vmx_data_memsize" : "8168",
9-
"vmware_vsphere_base_vmx_data_numvcpus" : "2",
8+
"vmware_base_vmx_data_memsize" : "8168",
9+
"vmware_base_vmx_data_numvcpus" : "2",
1010
"puppet_aio" : "http://apt.puppetlabs.com/pool/stretch/puppet5/p/puppet-agent/puppet-agent_5.3.2-1stretch_amd64.deb",
1111
"iso_name" : "ubuntu-18.04-server-amd64.iso"
1212
}

templates/ubuntu/18.10/common/files/preseed.cfg

Lines changed: 0 additions & 35 deletions
This file was deleted.

templates/ubuntu/18.10/common/vars.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

templates/ubuntu/18.10/x86_64/vars.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

templates/ubuntu/20.04/common/files/preseed.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ d-i preseed/late_command string \
3232
sed -i 's/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*/\1\"\"/g' /target/etc/default/grub; \
3333
in-target bash -c 'update-grub2'; \
3434
in-target sed -i 's/.*PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config ; \
35+
in-target bash -c 'echo " dhcp-identifier: mac" >> /etc/netplan/01-netcfg.yaml' ; \
36+
in-target bash -c 'echo " nameservers:" >> /etc/netplan/01-netcfg.yaml' ; \
37+
in-target bash -c 'echo " search: [delivery.puppetlabs.net, local]" >> /etc/netplan/01-netcfg.yaml' ; \
3538
in-target apt-get -y upgrade
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"http_directory" : "../common/files",
33
"inject_http_seed_in_boot_command" : "true",
4-
"boot_command" : "<esc><wait><esc><wait><enter><wait>/install/vmlinuz console-setup/ask_detect=false console-setup/layoutcode=us console-setup/modelcode=pc105 debconf/frontend=noninteractive debian-installer=en_US fb=false initrd=/install/initrd.gz kbd-chooser/method=us keyboard-configuration/layout=USA keyboard-configuration/variant=USA locale=en_US.UTF-8 netcfg/get_domain=vm netcfg/get_hostname=localhost grub-installer/bootdev=/dev/sda noapic preseed/url=http://%s/preseed.cfg -- <wait><enter>",
4+
"boot_command" : "<esc><wait><esc><wait><enter><wait>/install/vmlinuz console-setup/ask_detect=false console-setup/layoutcode=us console-setup/modelcode=pc105 debconf/frontend=noninteractive debian-installer=en_US fb=false initrd=/install/initrd.gz kbd-chooser/method=us keyboard-configuration/layout=USA keyboard-configuration/variant=USA locale=en_US.UTF-8 netcfg/get_domain=vm netcfg/get_hostname=localhost grub-installer/bootdev=/dev/sda preseed/url=http://%s/preseed.cfg -- <wait><enter>",
55
"vmware_base_boot_wait" : "15s"
66
}

templates/ubuntu/20.04/x86_64/vars.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"template_name" : "ubuntu-2004-x86_64",
33
"template_os" : "ubuntu64Guest",
44
"beakerhost" : "ubuntu2004-64",
5-
"version" : "0.0.2",
5+
"version" : "0.0.8",
66
"iso_url" : "https://artifactory.delivery.puppetlabs.net/artifactory/generic__iso/iso/ubuntu-20.04-live-server-amd64.iso",
77
"iso_checksum" : "caf3fd69c77c439f162e2ba6040e9c320c4ff0d69aad1340a514319a9264df9f",
88
"iso_checksum_type" : "sha256",
9-
"vmware_vsphere_base_vmx_data_memsize" : "8168",
10-
"vmware_vsphere_base_vmx_data_numvcpus" : "2",
9+
"vmware_base_vmx_data_memsize" : "8168",
10+
"vmware_base_vmx_data_numvcpus" : "2",
1111
"puppet_aio" : "http://apt.puppetlabs.com/pool/bionic/puppet5/p/puppet-agent/puppet-agent_5.5.18-1bionic_amd64.deb",
1212
"iso_name" : "focal-server-amd64.iso"
1313
}

0 commit comments

Comments
 (0)