Compare commits

..

8 Commits

Author SHA1 Message Date
Samuel Aubertin
53a3a86403 Display hostname and not hostname+target 2025-04-27 16:45:36 +02:00
Samuel Aubertin
ba48937b12 Variabilize GCE region and zone, only use hostname for cloud, not hostname+target 2025-04-27 16:43:03 +02:00
Samuel Aubertin
6603cc9518 Fixes in README 2025-04-27 16:08:59 +02:00
Samuel Aubertin
13433cd7eb Do not show banner everytime 2024-02-28 15:19:38 +01:00
Samuel Aubertin
9c075ea2f3 dont use libvirt session 2024-02-28 14:25:33 +01:00
Samuel Aubertin
ff22a6dda6 escape %c in Vagrantfile 2024-02-15 18:23:25 +01:00
Samuel Aubertin
ed10ea5bab OPACK_VAGRANT_NETWORK doc 2024-02-14 10:20:00 +01:00
Samuel Aubertin
1d64683963 Define custom networks with OPACK_VAGRANT_NETWORK override 2024-02-14 10:18:52 +01:00
5 changed files with 30 additions and 12 deletions

View File

@@ -28,7 +28,10 @@ To get started with **skz-opack**, follow these steps:
- [libvirt](https://libvirt.org/)
- [Vagrant](https://developer.hashicorp.com/vagrant/downloads)
- [Vagrant-Libvirt module](https://github.com/vagrant-libvirt/vagrant-libvirt)
- [Terraform](https://developer.hashicorp.com/terraform/downloads) (for `opack-cloud`)
Additionally, for `opack-cloud`:
- [Packer googlecompute module](https://developer.hashicorp.com/packer/integrations/hashicorp/googlecompute)
- [Terraform](https://developer.hashicorp.com/terraform/downloads)
3. Use the project by including `path/to/skz-opack/src/opack.mk` and invoking the `opack` target in your Makefile to create a local OpenBSD virtual machine with Packer and Vagrant. Use the 'opack-cloud' target to run the same virtual machine in GCP with Terraform.
@@ -68,6 +71,7 @@ Every default option ending with an `?` in "src/options.mk" can be overrided in
- `OPACK_GCE_PROJECT`: The Google Cloud project name where the VM will be created
- `OPACK_GCE_JSON_KEY`: The filename of the Google Cloud service account JSON key
- `OPACK_GCE_BUCKET`: The Google Cloud Storage bucket name to use for the image import
- `OPACK_VAGRANT_NETWORK`: Define additional custom Vagrant networks
## Examples

View File

@@ -37,7 +37,7 @@ endef
define OPACK_INSTALL_CLOUD_CONTENT =
Choose your keyboard layout = fr
System hostname = $(OPACK_SYS_HOSTNAME)-$(OPACK_TARGET)
System hostname = $(OPACK_SYS_HOSTNAME)
Which network interface = vio0
IPv4 address for vio0 = dhcp
IPv6 address for vio0 = none
@@ -93,8 +93,8 @@ define OPACK_TERRAFORM_CONTENT =
variable "credentials" { default = "../$(OPACK_GCE_JSON_KEY)" }
variable "project" { default = "$(OPACK_GCE_PROJECT)" }
variable "region" { default = "europe-west4" }
variable "zone" { default = "europe-west4-b" }
variable "region" { default = "$(OPACK_GCE_REGION)" }
variable "zone" { default = "$(OPACK_GCE_ZONE)" }
provider "google" {
region = "$${var.region}"

View File

@@ -27,7 +27,9 @@ echo -n "$(2) "
($(1)) & pid=$$!; i=0; while ps -a | awk '{print $$1}' | grep -q "$${pid}"; do c=`expr $${i} % 4`; case $${c} in 0) echo -e "◐\c" ;; 1) echo -e "◓\c" ;; 2) echo -e "◑\c" ;; 3) echo -e "◒\c" ;; esac; i=`expr $${i} + 1`; sleep 0.2; echo -e "\b\c"; done; echo; wait $${pid}; ret=$$?; exit $${ret};
endef
ifdef OPACK_DEBUG
$(info $(OPACK_BANNER))
endif
include $(OPACK_DIR)/options.mk
include $(OPACK_DIR)/defines.mk
@@ -111,7 +113,7 @@ $(OPACK_VAGRANT_FILE):
opack: $(OPACK_META_FILE) $(OPACK_VAGRANT_FILE)
ifndef OPACK_DEBUG
$(call spinner,vagrant up > /dev/null,█ $(shell date +'%H:%M:%S') Starting $(OPACK_HOSTNAME)-$(OPACK_TARGET) with Vagrant)
$(call spinner,vagrant up > /dev/null,█ $(shell date +'%H:%M:%S') Starting $(OPACK_BOX_TAG) with Vagrant)
else
vagrant up
endif

View File

@@ -109,6 +109,10 @@ OPACK_AUTODISKLABEL_FILE?=$(OPACK_DIR)autodisklabel
# Define the Vagrantfile
OPACK_VAGRANT_FILE=Vagrantfile
# Define custom networks for Vagrant
OPACK_VAGRANT_NETWORK?=
#OPACK_VAGRANT_NETWORK=config.vm.network "private_network", auto_config: false
# Define the runtime provisioning script for Vagrant
OPACK_RUNTIME_PROVISION_FILE?=$(OPACK_DIR)vagrant-provision.sh
@@ -125,6 +129,12 @@ OPACK_GCE_JSON_KEY?=
# OPACK_GCE_BUCKET: The Google Cloud Storage bucket name, typically associated with the project, for the image import.
OPACK_GCE_BUCKET?=$(OPACK_GCE_PROJECT)
# OPACK_GCE_REGION: The Google Cloud Compute Engine region.
OPACK_GCE_REGION?=europe-west4
# OPACK_GCE_REGION: The Google Cloud Compute Engine zone.
OPACK_GCE_REGION?=europe-west4-b
# Define the machine type for the VM
OPACK_GCE_MACHINE?=e2-micro
@@ -138,9 +148,9 @@ OPACK_TERRAFORM_DIR?=opack_deploy_$(OPACK_SHORT_REV)
# Terraform module dir
OPACK_TERRAFORM_MODULE_DIR?=$(OPACK_TERRAFORM_DIR)/opack-module
ifdef OPACK_DEBUG
ifndef OPACK_DEBUG
$(infoBOX $(OPACK_BOX_FILE))
$(infoHOSTNAME $(OPACK_SYS_HOSTNAME)-$(OPACK_TARGET))
$(infoHOSTNAME $(OPACK_SYS_HOSTNAME))
$(infoUSER $(OPACK_SYS_USER))
$(infoPASSWORD $(OPACK_SYS_PASSWORD))
$(infoDISK-SIZE $(OPACK_SYS_DISK_SIZE)m)

View File

@@ -9,12 +9,14 @@ Vagrant.configure("2") do |config|
config.ssh.shell = "ksh -l"
config.ssh.username = "$(OPACK_SSH_USER)"
config.ssh.extra_args = "-tt"
config.ssh.sudo_command = "doas env %c"
config.ssh.sudo_command = "doas env %%c"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provision "shell", path: "$(OPACK_RUNTIME_PROVISION_FILE)"
$(OPACK_VAGRANT_NETWORK)
config.vm.provider "libvirt" do |l|
l.cpus = $(OPACK_SYS_CPU)
l.memory = $(OPACK_SYS_MEMORY)
l.qemu_use_session = false
end
end