Qarik-Group / bucc

The fastest way to get a BUCC (BOSH, UAA Credhub and Concourse)
Apache License 2.0
135 stars 46 forks source link

Add --remote flag to virtualbox #164

Closed bodymindarts closed 5 years ago

bodymindarts commented 5 years ago

This enables running bucc from a different box than where VirtualBox is installed. The virtualbox CPI will then ssh onto the remote host to perform the VirtualBox specific tasks.

See https://github.com/cloudfoundry/bosh-deployment/blob/master/virtualbox/remote.yml

bodymindarts commented 5 years ago

There is an issue when running this with --lite flag.

when using flags --lite, --remote there is a merge error (due to the ordering that remote gets added after lite)

vagrant@ubuntu-xenial:~/bucc$ bin/bucc up --cpi virtualbox --lite --remote --debug
Using flags: --cpi virtualbox --lite --remote
Flag files: '/home/vagrant/bucc/state/{cpi,lite,flags}'

bosh create-env --skip-drain /home/vagrant/bucc/src/bosh-deployment/bosh.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/0-cpi.yml \
 -o /home/vagrant/bucc/ops/0-jumpbox-user.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/0-outbound-network.yml \
 -o /home/vagrant/bucc/ops/lite/1-bosh-lite.yml \
 -o /home/vagrant/bucc/ops/lite/2-bosh-lite-runc.yml \
 -o /home/vagrant/bucc/ops/2-uaa.yml \
 -o /home/vagrant/bucc/ops/3-concourse-release.yml \
 -o /home/vagrant/bucc/ops/3-concourse.yml \
 -o /home/vagrant/bucc/ops/3-credhub.yml \
 -o /home/vagrant/bucc/ops/3-garden-runc-release.yml \
 -o /home/vagrant/bucc/ops/3-garden-runc.yml \
 -o /home/vagrant/bucc/ops/4-concourse-credhub.yml \
 -o /home/vagrant/bucc/ops/4-credhub-bbr.yml \
 -o /home/vagrant/bucc/ops/4-credhub-importer.yml \
 -o /home/vagrant/bucc/ops/4-vault-credhub-proxy.yml \
 -o /home/vagrant/bucc/ops/5-bucc-version.yml \
 -o /home/vagrant/bucc/ops/5-cf-postgres-release.yml \
 -o /home/vagrant/bucc/ops/5-cf-postgres.yml \
 -o /home/vagrant/bucc/ops/6-bucc-bbr.yml \
 -o /home/vagrant/bucc/ops/6-bucc-creds-bbr.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/8-importer.yml \
 -o /home/vagrant/bucc/ops/9-bucc-bbr-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-concourse-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-credhub-importer-compiled-release.yml \
 -o /home/vagrant/bucc/ops/lite/9-importer.yml \
 -o /home/vagrant/bucc/ops/9-os-conf-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-postgres-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-vault-credhub-proxy-compiled-release.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/flags/remote.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/vm-size.yml \
 --vars-store /home/vagrant/bucc/state/creds.yml \
 --vars-file /home/vagrant/bucc/vars.yml \
 --state /home/vagrant/bucc/state/state.json

invalid argument for flag `-o, --ops-file' (expected []cmd.OpsFileArg): Reading ops file '/home/vagrant/bucc/ops/cpis/virtualbox/flags/remote.yml': Opening file /home/vagrant/bucc/ops/cpis/virtualbox/flags/remote.yml: open /home/vagrant/bucc/ops/cpis/virtualbox/flags/remote.yml: no such file or directory

Exit code 1

When renaming the file to 0-remote.yml (to fix the ordering) things work fine, but I don't know the correct pattern to pick up 0-remote.yml via the --remote flag.

bin/bucc up --cpi virtualbox --lite --0-remote --debug
Using flags: --cpi virtualbox --lite --0-remote --remote
Flag files: '/home/vagrant/bucc/state/{cpi,lite,flags}'

bosh create-env --skip-drain /home/vagrant/bucc/src/bosh-deployment/bosh.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/0-cpi.yml \
 -o /home/vagrant/bucc/ops/0-jumpbox-user.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/0-outbound-network.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/flags/0-remote.yml \
 -o /home/vagrant/bucc/ops/lite/1-bosh-lite.yml \
 -o /home/vagrant/bucc/ops/lite/2-bosh-lite-runc.yml \
 -o /home/vagrant/bucc/ops/2-uaa.yml \
 -o /home/vagrant/bucc/ops/3-concourse-release.yml \
 -o /home/vagrant/bucc/ops/3-concourse.yml \
 -o /home/vagrant/bucc/ops/3-credhub.yml \
 -o /home/vagrant/bucc/ops/3-garden-runc-release.yml \
 -o /home/vagrant/bucc/ops/3-garden-runc.yml \
 -o /home/vagrant/bucc/ops/4-concourse-credhub.yml \
 -o /home/vagrant/bucc/ops/4-credhub-bbr.yml \
 -o /home/vagrant/bucc/ops/4-credhub-importer.yml \
 -o /home/vagrant/bucc/ops/4-vault-credhub-proxy.yml \
 -o /home/vagrant/bucc/ops/5-bucc-version.yml \
 -o /home/vagrant/bucc/ops/5-cf-postgres-release.yml \
 -o /home/vagrant/bucc/ops/5-cf-postgres.yml \
 -o /home/vagrant/bucc/ops/6-bucc-bbr.yml \
 -o /home/vagrant/bucc/ops/6-bucc-creds-bbr.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/8-importer.yml \
 -o /home/vagrant/bucc/ops/9-bucc-bbr-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-concourse-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-credhub-importer-compiled-release.yml \
 -o /home/vagrant/bucc/ops/lite/9-importer.yml \
 -o /home/vagrant/bucc/ops/9-os-conf-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-postgres-compiled-release.yml \
 -o /home/vagrant/bucc/ops/9-vault-credhub-proxy-compiled-release.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/flags/remote.yml \
 -o /home/vagrant/bucc/ops/cpis/virtualbox/vm-size.yml \
 --vars-store /home/vagrant/bucc/state/creds.yml \
 --vars-file /home/vagrant/bucc/vars.yml \
 --state /home/vagrant/bucc/state/state.json
bodymindarts commented 5 years ago

here is the error:

vagrant@ubuntu-xenial:~/bucc$ bin/bucc up --cpi virtualbox --lite --remote
installing bosh cli '5.3.1' into: /home/vagrant/bucc/bin/
Using flags: --cpi virtualbox --lite --remote
Flag files: '/home/vagrant/bucc/state/{cpi,lite,flags}'

Deployment manifest: '/home/vagrant/bucc/src/bosh-deployment/bosh.yml'
Deployment state: '/home/vagrant/bucc/state/state.json'

Started validating
Failed validating (00:00:00)

Parsing release set manifest '/home/vagrant/bucc/src/bosh-deployment/bosh.yml':
  Evaluating manifest:
    Expected to find exactly one matching array item for path '/instance_groups/name=bosh/jobs/name=virtualbox_cpi' but found 0

Exit code 1
bodymindarts commented 5 years ago

I have removed the variable because I don't want an ssh key to be created by default (needs to be an ssh key that is already present on the VirtualBox host.

and flattened the variable path

Together with your fix those are 3 differences.