Vagrantfile 1.2 KB

123456789101112131415161718192021222324252627282930
  1. Vagrant.configure("2") do |config|
  2. config.vm.box = "debian/bullseye64"
  3. config.vm.provision "install dependencies", type: "shell", inline: <<-SHELL
  4. apt-get update
  5. apt-get install -y wget expect gpg asciinema ssh adduser
  6. SHELL
  7. config.vm.provision "record install", type: "shell", inline: <<-SHELL
  8. gpg --recv-keys "6D5B EF9A DD20 7580 5747 B70F 9F88 FB52 FAF7 B393"
  9. asciinema rec -c 'expect /vagrant/install.tcl' --overwrite /vagrant/install.json
  10. SHELL
  11. config.vm.provision "record basic usage", type: "shell", inline: <<-SHELL
  12. # `rm` below allows quick re-exec via:
  13. # vagrant vagrant provision --provision-with "record basic usage"
  14. # this is useful when testing changes
  15. rm -r /media/backup/borgdemo || true
  16. rm -r ~/.ssh/ || true
  17. deluser --remove-home borgdemo || true
  18. mkdir -p /media/backup/borgdemo
  19. adduser borgdemo
  20. echo '127.0.0.1 remoteserver.example' >> /etc/hosts
  21. ssh-keygen -f ~/.ssh/id_rsa -N ''
  22. ssh-keyscan remoteserver.example > ~/.ssh/known_hosts
  23. runuser -u borgdemo mkdir ~borgdemo/.ssh
  24. runuser -u borgdemo tee ~borgdemo/.ssh/authorized_keys < ~/.ssh/id_rsa.pub
  25. asciinema rec -c 'expect /vagrant/basic.tcl' --overwrite /vagrant/basic.json
  26. SHELL
  27. end