Compare commits

...

2 Commits

Author SHA1 Message Date
Samuel Aubertin
a7330ce9e7 Add OPACK_SSH_USER for weird cases like when OPACK_SYS_USER is already used by the base system 2023-10-17 09:22:00 +02:00
Samuel Aubertin
d39b4bd362 remove the box json on clean 2023-10-17 09:21:20 +02:00
5 changed files with 9 additions and 6 deletions

View File

@ -128,12 +128,12 @@ opack-cloud: | $(OPACK_TERRAFORM_DIR)/terraform.tfstate
opack-clean:
ifndef OPACK_DEBUG
-$(call spinner,vagrant destroy -f >/dev/null; cd opack_deploy_$(OPACK_SHORT_REV) 2>/dev/null && terraform destroy -auto-approve >> opack.log && cd .. && rm -rf opack_deploy_$(OPACK_SHORT_REV); rm -rf $(OPACK_VAGRANT_FILE) opack_installer_$(OPACK_SHORT_REV) *.log ssh-config .vagrant opack-cloud,█ $(shell date +'%H:%M:%S') Cleaning up)
-$(call spinner,vagrant destroy -f >/dev/null; cd opack_deploy_$(OPACK_SHORT_REV) 2>/dev/null && terraform destroy -auto-approve >> opack.log && cd .. && rm -rf opack_deploy_$(OPACK_SHORT_REV); rm -rf $(OPACK_VAGRANT_FILE) opack_installer_$(OPACK_SHORT_REV) *.log ssh-config .vagrant opack-cloud $(OPACK_TARGET).json,█ $(shell date +'%H:%M:%S') Cleaning up)
else
-vagrant destroy -f
-cd opack_deploy_$(OPACK_SHORT_REV) 2>/dev/null && terraform destroy -auto-approve >> opack.log
-rm -rf opack_deploy_$(OPACK_SHORT_REV)
-rm -rf $(OPACK_VAGRANT_FILE) opack_installer_$(OPACK_SHORT_REV) *.log ssh-config .vagrant opack-cloud
-rm -rf opack_deploy_$(OPACK_SHORT_REV)
-rm -rf $(OPACK_VAGRANT_FILE) opack_installer_$(OPACK_SHORT_REV) *.log ssh-config .vagrant opack-cloud $(OPACK_TARGET).json
endif
opack-cleancache:

View File

@ -4,6 +4,9 @@ OPACK_SYS_HOSTNAME?= opack
# Set the username for the virtual machine to 'opack' if not specified
OPACK_SYS_USER?= opack
# Set the username for the virtual machine to 'opack' if not specified
OPACK_SSH_USER?= $(OPACK_SYS_USER)
# Set the password for the virtual machine to 'opack' if not specified
OPACK_SYS_PASSWORD?= opack

View File

@ -52,7 +52,7 @@ define OPACK_PACKER_CLOUD_CONTENT =
},
{
"type": "shell",
"inline": ["cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"]
"inline": ["mkdir -p /home/$(OPACK_SYS_USER)/.ssh; cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"]
}
],
"post-processors": [ [

View File

@ -48,7 +48,7 @@ define OPACK_PACKER_CONTENT =
},
{
"type": "shell",
"inline": ["cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"]
"inline": ["mkdir -p /home/$(OPACK_SYS_USER)/.ssh; cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"]
}
],
"post-processors": [ [

View File

@ -7,7 +7,7 @@ Vagrant.configure("2") do |config|
config.vm.define "$(OPACK_TARGET)"
config.vm.box = "$(OPACK_BOX_TAG)"
config.ssh.shell = "ksh -l"
config.ssh.username = "$(OPACK_SYS_USER)"
config.ssh.username = "$(OPACK_SSH_USER)"
config.ssh.extra_args = "-tt"
config.ssh.sudo_command = "doas env %c"
config.vm.synced_folder ".", "/vagrant", disabled: true