feat: use adfinis mirror

This commit is contained in:
2024-09-29 23:29:39 +02:00
parent f43fd10515
commit 6e53206fbb
2 changed files with 14 additions and 74 deletions

75
example/Vagrantfile vendored
View File

@@ -2,88 +2,19 @@ ENV['VAGRANT_EXPERIMENTAL'] = 'typed_triggers'
require 'open3'
VM_CPU = 4
VM_CPU = 2
VM_MEMORY_GB = 4
VM_ROOT_DISK_SIZE_GB = 128
VM_ROOT_DISK_SIZE_GB = 15
Vagrant.configure('2') do |config|
config.vm.box = 'proxmox-ve-amd64'
#config.vm.box = 'proxmox-ve-uefi-amd64'
config.vm.provider :libvirt do |lv, config|
lv.memory = VM_MEMORY_GB*1024
lv.cpus = VM_CPU
lv.cpu_mode = 'host-passthrough'
lv.nested = true
lv.keymap = 'pt'
lv.keymap = 'ch'
lv.machine_virtual_size = VM_ROOT_DISK_SIZE_GB
config.vm.synced_folder '.', '/vagrant', type: 'nfs', nfs_version: '4.2', nfs_udp: false
end
config.vm.provider :hyperv do |hv, config|
hv.vmname = "#{File.basename(File.dirname(File.dirname(__FILE__)))}-example"
hv.linked_clone = true
hv.enable_virtualization_extensions = true # nested virtualization.
hv.memory = VM_MEMORY_GB*1024
hv.cpus = VM_CPU
hv.vlan_id = ENV['HYPERV_VLAN_ID']
# set the management network adapter.
# see https://github.com/hashicorp/vagrant/issues/7915
# see https://github.com/hashicorp/vagrant/blob/10faa599e7c10541f8b7acf2f8a23727d4d44b6e/plugins/providers/hyperv/action/configure.rb#L21-L35
config.vm.network :private_network, bridge: ENV['HYPERV_SWITCH_NAME'] if ENV['HYPERV_SWITCH_NAME']
config.vm.synced_folder '.', '/vagrant',
type: 'smb',
smb_username: ENV['VAGRANT_SMB_USERNAME'] || ENV['USER'],
smb_password: ENV['VAGRANT_SMB_PASSWORD']
# further configure the VM (e.g. add the secondary network adapter for
# the :private_network that is defined bellow).
config.trigger.before :'VagrantPlugins::HyperV::Action::StartInstance', type: :action do |trigger|
trigger.ruby do |env, machine|
system(
'PowerShell',
'-NoLogo',
'-NoProfile',
'-ExecutionPolicy',
'Bypass',
'-File',
'configure-hyperv.ps1',
machine.id
)
end
end
end
config.vm.provider :vsphere do |vsphere, config|
vsphere.name = ENV['VSPHERE_VM_NAME']
vsphere.notes = "Created from #{__FILE__}"
vsphere.cpu_count = VM_CPU
vsphere.memory_mb = VM_MEMORY_GB*1024
vsphere.user = ENV['GOVC_USERNAME']
vsphere.password = ENV['GOVC_PASSWORD']
vsphere.insecure = true
vsphere.host = ENV['GOVC_HOST']
vsphere.data_center_name = ENV['GOVC_DATACENTER']
vsphere.compute_resource_name = ENV['GOVC_CLUSTER']
vsphere.data_store_name = ENV['GOVC_DATASTORE']
vsphere.template_name = ENV['VSPHERE_TEMPLATE_NAME']
vsphere.vm_base_path = ENV['VSPHERE_VM_FOLDER']
vsphere.vlan = ENV['VSPHERE_VLAN']
if ENV['VAGRANT_SMB_PASSWORD']
config.vm.synced_folder '.', '/vagrant',
type: 'smb',
smb_username: ENV['VAGRANT_SMB_USERNAME'] || ENV['USER'],
smb_password: ENV['VAGRANT_SMB_PASSWORD']
end
config.trigger.after :'VagrantPlugins::VSphere::Action::Clone', type: :action do |trigger|
trigger.ruby do |env, machine|
stdout, stderr, status = Open3.capture3(
'bash',
'configure-vsphere.sh',
machine.id,
"#{VM_ROOT_DISK_SIZE_GB}",
"#{ENV['VSPHERE_VLAN']}")
if status.exitstatus != 0
raise "failed to configure vsphere. status=#{status.exitstatus} stdout=#{stdout} stderr=#{stderr}"
end
end
end
end
ip = '10.10.10.2'
config.vm.network :private_network,

View File

@@ -11,8 +11,17 @@ dpkg-divert --divert /etc/apt/sources.list.d/ceph.list.distrib.disabled --rename
echo "deb http://download.proxmox.com/debian/pve $(. /etc/os-release && echo "$VERSION_CODENAME") pve-no-subscription" >/etc/apt/sources.list.d/pve.list
echo "deb http://download.proxmox.com/debian/ceph-reef $(. /etc/os-release && echo "$VERSION_CODENAME") no-subscription" >/etc/apt/sources.list.d/ceph.list
# switch the apt mirror from us to nl.
sed -i -E 's,ftp\.us\.debian,ftp.nl.debian,' /etc/apt/sources.list
# switch the apt mirror to adfinis
cat >/etc/apt/sources.list <<'EOF'
deb http://pkg.adfinis-on-exoscale.ch/debian/ bookworm main non-free non-free-firmware contrib
deb-src http://pkg.adfinis-on-exoscale.ch/debian/ bookworm main non-free non-free-firmware contrib
deb http://security.debian.org/ bookworm-security main
deb-src http://security.debian.org/ bookworm-security main
deb http://pkg.adfinis-on-exoscale.ch/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://pkg.adfinis-on-exoscale.ch/debian/ bookworm-updates main contrib non-free non-free-firmware
EOF
# update only (no upgrade since we want to use this image to test automated cluster upgrades)
apt-get update