Skip to content

Instantly share code, notes, and snippets.

@konstruktoid
Created November 30, 2025 00:58
Show Gist options
  • Select an option

  • Save konstruktoid/c098f4596aca74b800095a8eb54cee02 to your computer and use it in GitHub Desktop.

Select an option

Save konstruktoid/c098f4596aca74b800095a8eb54cee02 to your computer and use it in GitHub Desktop.
Vagrantfile for testing CyberArk Conjur - https://www.conjur.org/
$prep = <<SCRIPT
set -e -o pipefail
apt-get update
apt-get install --assume-yes --no-install-recommends curl git jq
curl -fsSL get.docker.com | sh
apt-get update
apt-get install --assume-yes --no-install-recommends docker-compose-plugin
usermod -aG docker vagrant
mkdir -p /home/vagrant/.local/bin
echo 'export PATH="/home/vagrant/.local/bin:${PATH}"' >> /home/vagrant/.bashrc
CONJUR_VERSION_LATEST="$(curl -fSsL https://api.github.com/repos/cyberark/conjur-cli-go/releases/latest | jq -r '.tag_name')"
CONJUR_URL_LATEST="https://github.com/cyberark/conjur-cli-go/releases/download/${CONJUR_VERSION_LATEST}/conjur_linux_amd64"
curl -fSsL "${CONJUR_URL_LATEST}" -o "/home/vagrant/.local/bin/conjur"
chown -R vagrant:vagrant /home/vagrant/.local
chmod +x /home/vagrant/.local/bin/conjur*
if [ ! -d /home/vagrant/conjur-quickstart ]; then
git clone "https://github.com/cyberark/conjur-quickstart" /home/vagrant/conjur-quickstart
fi
chown -R vagrant:vagrant /home/vagrant/conjur-quickstart
echo '#!/bin/bash
set -e -o pipefail
cd /home/vagrant/conjur-quickstart || exit 1
docker compose pull
docker compose run --no-deps --rm conjur data-key generate > data_key
export CONJUR_DATA_KEY="$(< data_key)"
docker compose up -d
sleep 10
docker compose restart proxy
sleep 10
docker compose exec conjur conjurctl --version
docker compose exec conjur conjurctl account create myConjurAccount > admin_data
export CONJUR_ADMIN_API=$(grep API admin_data | cut -d " " -f5)
echo "CONJUR_ADMIN_API=${CONJUR_ADMIN_API}" >> /home/vagrant/.bashrc
cd .. || exit 1
export PATH="/home/vagrant/.local/bin:${PATH}"
source /home/vagrant/.bashrc
conjur --version
conjur init oss -u https://localhost:8443 -a myConjurAccount --self-signed --force
conjur login -d -i admin -p "${CONJUR_ADMIN_API}"
conjur whoami
conjur logout
'> /home/vagrant/start-conjur.sh
chown vagrant:vagrant /home/vagrant/start-conjur.sh
chmod +x /home/vagrant/start-conjur.sh
SCRIPT
Vagrant.configure("2") do |config|
config.vbguest.installer_options = { allow_kernel_upgrade: false }
config.vbguest.auto_update = false
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
vb.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL]
vb.memory = "2048"
end
hosts = [
{ name: "noble", box: "bento/ubuntu-24.04" },
]
hosts.each do |host|
config.vm.define host[:name] do |node|
node.vm.box = host[:box]
node.ssh.insert_key = true
node.ssh.key_type = "ed25519"
node.vm.hostname = host[:name]
node.vm.boot_timeout = 600
node.vm.provision "shell",
inline: $prep
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment