Add vagrant-libvirt:
This gets the refactored sandbox back on par with the existing sandbox for vagrant-libvirt functionality. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
OSIE_DOWNLOAD_URL="https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-v0-n=404,c=c35a5f8,b=master.tar.gz"
|
||||
OSIE_DOWNLOAD_URL="https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-1790-23d78ea47f794d0e5c934b604579c26e5fce97f5.tar.gz"
|
||||
TINK_CLI_IMAGE="quay.io/tinkerbell/tink-cli:sha-8ea8a0e5"
|
||||
TINK_SERVER_IMAGE="quay.io/tinkerbell/tink:sha-8ea8a0e5"
|
||||
BOOTS_SERVER_IMAGE="quay.io/tinkerbell/boots:sha-cb0290f8"
|
||||
BOOTS_SERVER_IMAGE="quay.io/tinkerbell/boots:sha-94f43947"
|
||||
HEGEL_SERVER_IMAGE="quay.io/tinkerbell/hegel:sha-9f5da0a8"
|
||||
TINKERBELL_HARDWARE_MANIFEST="/manifests/hardware/hardware.json"
|
||||
TINKERBELL_TEMPLATE_MANIFEST="/manifests/template/ubuntu.yaml"
|
||||
TINKERBELL_HOST_IP=192.168.50.4
|
||||
TINKERBELL_CLIENT_IP=192.168.50.43
|
||||
TINKERBELL_CLIENT_MAC=08:00:27:9E:F5:3A
|
||||
TINKERBELL_CLIENT_MAC=08:00:27:9e:f5:3a
|
||||
|
@ -56,6 +56,10 @@ workflow_exists() {
|
||||
return 0
|
||||
fi
|
||||
local workflow_id=$(cat "${workflow_dir}"/workflow_id.txt)
|
||||
if [ -z "${workflow_id}" ]; then
|
||||
workflow "${workflow_dir}" "${mac_address}"
|
||||
return 0
|
||||
fi
|
||||
tink workflow get | grep -q "${workflow_id}"
|
||||
local result=$?
|
||||
if [ "${result}" -ne 0 ]; then
|
||||
|
32
deploy/compose/manifests/hardware/hardware-libvirt.json
Normal file
32
deploy/compose/manifests/hardware/hardware-libvirt.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"id": "0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94",
|
||||
"metadata": {
|
||||
"facility": {
|
||||
"facility_code": "onprem",
|
||||
"plan_slug": "c2.medium.x86",
|
||||
"plan_version_slug": ""
|
||||
},
|
||||
"instance": {},
|
||||
"state": "provisioning"
|
||||
},
|
||||
"network": {
|
||||
"interfaces": [
|
||||
{
|
||||
"dhcp": {
|
||||
"arch": "x86_64",
|
||||
"ip": {
|
||||
"address": "192.168.50.43",
|
||||
"gateway": "192.168.50.1",
|
||||
"netmask": "255.255.255.0"
|
||||
},
|
||||
"mac": "08:00:27:9e:f5:3a",
|
||||
"uefi": false
|
||||
},
|
||||
"netboot": {
|
||||
"allow_pxe": true,
|
||||
"allow_workflow": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
"address": "192.168.50.43",
|
||||
"netmask": "255.255.255.0"
|
||||
},
|
||||
"mac": "08:00:27:9E:F5:3A",
|
||||
"mac": "08:00:27:9e:f5:3a",
|
||||
"uefi": false
|
||||
},
|
||||
"netboot": {
|
||||
|
74
deploy/compose/manifests/template/ubuntu-libvirt.yaml
Normal file
74
deploy/compose/manifests/template/ubuntu-libvirt.yaml
Normal file
@ -0,0 +1,74 @@
|
||||
version: "0.1"
|
||||
name: debian_Focal
|
||||
global_timeout: 1800
|
||||
tasks:
|
||||
- name: "os-installation"
|
||||
worker: "{{.device_1}}"
|
||||
volumes:
|
||||
- /dev:/dev
|
||||
- /dev/console:/dev/console
|
||||
- /lib/firmware:/lib/firmware:ro
|
||||
actions:
|
||||
- name: "stream-ubuntu-image"
|
||||
image: image2disk:v1.0.0
|
||||
timeout: 600
|
||||
environment:
|
||||
DEST_DISK: /dev/vda
|
||||
IMG_URL: "http://192.168.50.4:8080/focal-server-cloudimg-amd64.raw.gz"
|
||||
COMPRESSED: true
|
||||
- name: "install-openssl"
|
||||
image: cexec:v1.0.0
|
||||
timeout: 90
|
||||
environment:
|
||||
BLOCK_DEVICE: /dev/vda1
|
||||
FS_TYPE: ext4
|
||||
CHROOT: y
|
||||
DEFAULT_INTERPRETER: "/bin/sh -c"
|
||||
CMD_LINE: "apt -y update && apt -y install openssl"
|
||||
- name: "create-user"
|
||||
image: cexec:v1.0.0
|
||||
timeout: 90
|
||||
environment:
|
||||
BLOCK_DEVICE: /dev/vda1
|
||||
FS_TYPE: ext4
|
||||
CHROOT: y
|
||||
DEFAULT_INTERPRETER: "/bin/sh -c"
|
||||
CMD_LINE: "useradd -p $(openssl passwd -1 tink) -s /bin/bash -d /home/tink/ -m -G sudo tink"
|
||||
- name: "enable-ssh"
|
||||
image: cexec:v1.0.0
|
||||
timeout: 90
|
||||
environment:
|
||||
BLOCK_DEVICE: /dev/vda1
|
||||
FS_TYPE: ext4
|
||||
CHROOT: y
|
||||
DEFAULT_INTERPRETER: "/bin/sh -c"
|
||||
CMD_LINE: "ssh-keygen -A; systemctl enable ssh.service; sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||
- name: "disable-apparmor"
|
||||
image: cexec:v1.0.0
|
||||
timeout: 90
|
||||
environment:
|
||||
BLOCK_DEVICE: /dev/vda1
|
||||
FS_TYPE: ext4
|
||||
CHROOT: y
|
||||
DEFAULT_INTERPRETER: "/bin/sh -c"
|
||||
CMD_LINE: "systemctl disable apparmor; systemctl disable snapd"
|
||||
- name: "write-netplan"
|
||||
image: writefile:v1.0.0
|
||||
timeout: 90
|
||||
environment:
|
||||
DEST_DISK: /dev/vda1
|
||||
FS_TYPE: ext4
|
||||
DEST_PATH: /etc/netplan/config.yaml
|
||||
CONTENTS: |
|
||||
network:
|
||||
version: 2
|
||||
renderer: networkd
|
||||
ethernets:
|
||||
ens5:
|
||||
dhcp4: true
|
||||
ens6:
|
||||
dhcp4: true
|
||||
UID: 0
|
||||
GID: 0
|
||||
MODE: 0644
|
||||
DIRMODE: 0755
|
@ -1,4 +1,5 @@
|
||||
quay.io/tinkerbell/tink-worker:latest
|
||||
quay.io/tinkerbell-actions/image2disk:v1.0.0
|
||||
quay.io/tinkerbell-actions/cexec:v1.0.0
|
||||
quay.io/tinkerbell-actions/writefile:v1.0.0
|
||||
quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:latest
|
||||
quay.io/tinkerbell/tink-worker:latest tinkerbell/tink-worker:sha-5e1f0fd8
|
||||
quay.io/tinkerbell-actions/image2disk:v1.0.0 image2disk:v1.0.0
|
||||
quay.io/tinkerbell-actions/cexec:v1.0.0 cexec:v1.0.0
|
||||
quay.io/tinkerbell-actions/writefile:v1.0.0 writefile:v1.0.0
|
@ -10,9 +10,10 @@ main() {
|
||||
local images_file="$4"
|
||||
# this confusing IFS= and the || is to capture the last line of the file if there is no newline at the end
|
||||
while IFS= read -r img || [ -n "${img}" ]; do
|
||||
# trim trailing whitespace
|
||||
local imgr="$(echo "${img}" | sed 's/ *$//g')"
|
||||
skopeo copy --all --dest-tls-verify=false --dest-creds="${reg_user}":"${reg_pw}" docker://"${imgr}" docker://"${reg_url}"/$(basename "${imgr}")
|
||||
# file is expected to have src and dst images delimited by a space
|
||||
local src_img="$(echo "${img}" | cut -d' ' -f1)"
|
||||
local dst_img="$(echo "${img}" | cut -d' ' -f2)"
|
||||
skopeo copy --all --dest-tls-verify=false --dest-creds="${reg_user}":"${reg_pw}" docker://"${src_img}" docker://"${reg_url}"/"${dst_img}"
|
||||
done <"${images_file}"
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,8 @@ services:
|
||||
entrypoint: /manifests/apply_manifests.sh
|
||||
command:
|
||||
[
|
||||
"/manifests/hardware/hardware.json",
|
||||
"/manifests/template/ubuntu.yaml",
|
||||
"$TINKERBELL_HARDWARE_MANIFEST",
|
||||
"$TINKERBELL_TEMPLATE_MANIFEST",
|
||||
"/manifests/workflow",
|
||||
"$TINKERBELL_HOST_IP",
|
||||
"$TINKERBELL_CLIENT_IP",
|
||||
|
77
deploy/vagrant/Vagrantfile
vendored
77
deploy/vagrant/Vagrantfile
vendored
@ -4,6 +4,11 @@
|
||||
PROVISIONER_IP = "192.168.50.4"
|
||||
MACHINE1_IP = "192.168.50.43"
|
||||
|
||||
$script = <<-SCRIPT
|
||||
ip addr add 192.168.50.4/24 dev eth1
|
||||
ip link set dev eth1 up
|
||||
SCRIPT
|
||||
|
||||
unless Vagrant.has_plugin?("vagrant-docker-compose")
|
||||
system("vagrant plugin install vagrant-docker-compose")
|
||||
puts "Dependencies installed, please try the command again."
|
||||
@ -14,20 +19,74 @@ Vagrant.configure("2") do |config|
|
||||
config.vm.define "provisioner" do |provisioner|
|
||||
provisioner.vm.box = "generic/ubuntu2004"
|
||||
provisioner.vm.synced_folder '../', '/vagrant'
|
||||
provisioner.vm.provider "virtualbox" do |v|
|
||||
provisioner.vm.provision :docker
|
||||
provisioner.vm.provision "shell", inline: $script
|
||||
provisioner.vm.network "private_network", ip: PROVISIONER_IP,
|
||||
libvirt__network_name: "tink_network",
|
||||
libvirt__host_ip: '192.168.50.1',
|
||||
libvirt__netmask: "255.255.255.0",
|
||||
libvirt__dhcp_enabled: false,
|
||||
auto_config: false
|
||||
|
||||
provisioner.vm.provider "virtualbox" do |v, override|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
override.vm.synced_folder '../', '/vagrant'
|
||||
# vagrant plugin install vagrant-docker-compose
|
||||
override.vm.provision :docker_compose,
|
||||
compose_version: "1.29.1",
|
||||
yml: "/vagrant/docker-compose.yml",
|
||||
run:"always",
|
||||
env: {
|
||||
"TINKERBELL_HOST_IP": PROVISIONER_IP,
|
||||
"TINKERBELL_CLIENT_IP": MACHINE1_IP,
|
||||
"REPO_TOP_LEVEL": "/vagrant",
|
||||
"TINKERBELL_HARDWARE_MANIFEST": "/manifests/hardware/hardware.json",
|
||||
"TINKERBELL_TEMPLATE_MANIFEST": "/manifests/template/ubuntu.yaml"
|
||||
}
|
||||
end
|
||||
provisioner.vm.network "private_network", ip: PROVISIONER_IP
|
||||
|
||||
provisioner.vm.provision :docker
|
||||
# vagrant plugin install vagrant-docker-compose
|
||||
provisioner.vm.provision :docker_compose, compose_version: "1.29.1", yml: "/vagrant/docker-compose.yml", run:"always", env: {"TINKERBELL_HOST_IP": PROVISIONER_IP, "TINKERBELL_CLIENT_IP": MACHINE1_IP, "REPO_TOP_LEVEL": "/vagrant"}
|
||||
provisioner.vm.provider "libvirt" do |l, override|
|
||||
override.vm.synced_folder '../', '/vagrant', type: "nfs", nfs_version: 4, "nfs_udp": false, mount_options: ["rw", "vers=4", "tcp"]
|
||||
# vagrant plugin install vagrant-docker-compose
|
||||
override.vm.provision :docker_compose,
|
||||
compose_version: "1.29.1",
|
||||
yml: "/vagrant/docker-compose.yml",
|
||||
run:"always",
|
||||
env: {
|
||||
"TINKERBELL_HOST_IP": PROVISIONER_IP,
|
||||
"TINKERBELL_CLIENT_IP": MACHINE1_IP,
|
||||
"REPO_TOP_LEVEL": "/vagrant",
|
||||
"TINKERBELL_HARDWARE_MANIFEST": "/manifests/hardware/hardware-libvirt.json",
|
||||
"TINKERBELL_TEMPLATE_MANIFEST": "/manifests/template/ubuntu-libvirt.yaml"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define :machine1, autostart: false do |machine1|
|
||||
machine1.vm.box = 'jtyr/pxe'
|
||||
machine1.vm.provider "virtualbox" do |v|
|
||||
|
||||
machine1.ssh.insert_key = false
|
||||
machine1.vm.boot_timeout = 10
|
||||
machine1.vm.synced_folder '.', '/vagrant', disabled: true
|
||||
machine1.vm.network :private_network, ip: MACHINE1_IP,
|
||||
mac: "0800279EF53A",
|
||||
adapter: 1,
|
||||
libvirt__network_name: "tink_network",
|
||||
libvirt__dhcp_enabled: false,
|
||||
libvirt__forward_mode: 'nat'
|
||||
|
||||
machine1.vm.provider "libvirt" do |v|
|
||||
v.storage :file, :size => '20G'
|
||||
v.memory = 4096
|
||||
v.cpus = 2
|
||||
v.boot 'hd'
|
||||
v.boot 'network'
|
||||
v.graphics_ip = '0.0.0.0'
|
||||
v.machine_arch = 'x86_64'
|
||||
end
|
||||
|
||||
machine1.vm.provider "virtualbox" do |v, override|
|
||||
override.vm.box = 'jtyr/pxe'
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
v.gui = true
|
||||
@ -35,9 +94,5 @@ Vagrant.configure("2") do |config|
|
||||
v.customize ['setextradata', :id, 'GUI/ScaleFactor', '3.0']
|
||||
v.check_guest_additions = false
|
||||
end
|
||||
machine1.ssh.insert_key = false
|
||||
machine1.vm.boot_timeout = 10
|
||||
machine1.vm.synced_folder '.', '/vagrant', disabled: true
|
||||
machine1.vm.network "private_network", ip: MACHINE1_IP, mac: "0800279EF53A", adapter: 1
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user