From 11e58921d9b33b926aa868f72c501107b2a419ec Mon Sep 17 00:00:00 2001 From: Moritz Heiber Date: Mon, 17 Apr 2017 22:19:32 +0200 Subject: [PATCH] Add insecure Vagrant default key, set a default root password, update Ansible submodule, prepare Vagrant tests --- .gitignore | 1 + Vagrantfile | 5 +++++ ansible | 2 +- packer.json | 16 +++++++++++----- preseeds/preseed.cfg | 9 +++++++-- 5 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 Vagrantfile diff --git a/.gitignore b/.gitignore index 449faea..b4fd43a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /builds /packer_cache +/.vagrant diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..f6ae650 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,5 @@ +Vagrant.configure('2') do |config| + config.vm.box = 'builds/virtualbox-mastodon-ubuntu1604.box' + config.vm.box_check_update = true + config.vm.network 'private_network', type: 'dhcp' +end diff --git a/ansible b/ansible index 92e4cdd..cc8b0b3 160000 --- a/ansible +++ b/ansible @@ -1 +1 @@ -Subproject commit 92e4cdddbc402922b99f7b6cadab858f2bdbed0b +Subproject commit cc8b0b3d51baf2e9eabf7fd0d8e31caa6eb596b7 diff --git a/packer.json b/packer.json index 267d01d..0c50f1d 100644 --- a/packer.json +++ b/packer.json @@ -1,8 +1,14 @@ { + "variables": { + "user": "vagrant", + "password": "vagrant" + }, "provisioners": [ - { - "type": "ansible", - "playbook_file": "ansible/playbook.yml" + { "type": "shell", + "inline": [ + "install -m0700 -o {{user `user`}} -g {{user `user`}} -d /home/{{user `user`}}/.ssh", + "curl -SsL https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o /home/{{user `user`}}/.ssh/authorized_keys" + ] } ], "builders": [ @@ -42,8 +48,8 @@ "iso_urls": "http://releases.ubuntu.com/16.04/ubuntu-16.04.2-server-amd64.iso", "iso_checksum_type": "sha256", "iso_checksum": "737ae7041212c628de5751d15c3016058b0e833fdc32e7420209b76ca3d0a535", - "ssh_username": "vagrant", - "ssh_password": "vagrant", + "ssh_username": "{{user `user`}}", + "ssh_password": "{{user `user`}}", "ssh_wait_timeout": "20m", "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now", "vm_name": "packer-ubuntu-16.04-amd64", diff --git a/preseeds/preseed.cfg b/preseeds/preseed.cfg index 2e4f7a0..1a738fe 100644 --- a/preseeds/preseed.cfg +++ b/preseeds/preseed.cfg @@ -16,7 +16,7 @@ d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i partman/confirm_write_new_label boolean true -d-i pkgsel/include string openssh-server linux-source dkms nfs-common +d-i pkgsel/include string openssh-server linux-source dkms nfs-common curl d-i pkgsel/install-language-support boolean false d-i pkgsel/update-policy select none d-i pkgsel/upgrade select full-upgrade @@ -28,7 +28,12 @@ d-i keyboard-configuration/layoutcode string us d-i keyboard-configuration/modelcode string pc105 d-i debian-installer/locale string en_US -# Create vagrant user account. +# Set the root password +d-i passwd/root-login boolean true +d-i passwd/root-password password vagrant +d-i passwd/root-password-again password vagrant + +# Setup the user account d-i passwd/user-fullname string vagrant d-i passwd/username string vagrant d-i passwd/user-password password vagrant