ansible-experiments/package_updates/Vagrantfile
Serge van Ginderachter dac2298622
Update packages on ubuntu and freebsd
Fixes #1

The Vagrant file being used is a copy from
`https://github.com/stationgroup/vagrant-labs/tree/master/imperialspeculate`.

Two roles are being used: debian-upgrade (an upstream Galaxy role) and
freebsd-upgrade (a small role based on what was proposed in the comments of #1
and extended with proper support for check mode.)

The upgrade process is contained in the playbook os_upgrade.yml, which will
automatically create proper groups for Ubuntu and FreeBSD hosts. If unneeded,
this first play can be left out, and the target hosts: in the second play can be
replaced by the relevant groups you have in the inventory (e.g. ec2 tags.)

A local ansible.cfg is defined, and needed for these scripts to run out of the
box. This implies that all ansible commands must be run from the
`ansible-experiments/package_updates` folder.

A small script `setup-requirements` is provided, that initializes everything,
to be executed after the vagrant boxes came online. It will generate an
ssh-config for said vagrant boxes, download roles from galaxy, and make a
base-install for the hosts (installing python dependencies, ansible itself
on ubuntu1, a deploying an ssh key to all nodes to be used from the vagrant box
`ubuntu1`, as ansible controller machine.)

When deploying and setting up from the machine where vagrant runs, you need to
add some extra arguments:
`--ssh-extra-args "-F ./vagrant-ssh-config" --inventory hosts-vagrant`
to ansible execution. These are not necessary once running ansible from
`ubuntu1`.

The vagrant setup seems to have a provisioning bug, that kicks in with the
latest 18.04 Ubuntu. The FreeBSD boxes also experience a provisioning problem,
with the same result: the second, private network interface does not get
configured. As these interfaces are used to run ansible from `ubuntu1`, I could
not fully test the scripts from there.
2018-05-11 16:37:03 +02:00

57 lines
1.9 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
# https://github.com/hashicorp/vagrant/issues/9442#issuecomment-363080565
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.define "ubuntu1" do |ubuntu1|
ubuntu1.vm.box = "ubuntu/xenial64"
ubuntu1.vm.hostname = "ubuntu1"
ubuntu1.vm.network "private_network", ip: "192.168.33.110"
end
config.vm.define "ubuntu2" do |ubuntu2|
ubuntu2.vm.box = "ubuntu/xenial64"
ubuntu2.vm.hostname = "ubuntu2"
ubuntu2.vm.network "private_network", ip: "192.168.33.120"
end
config.vm.define "ubuntu3" do |ubuntu3|
ubuntu3.vm.box = "ubuntu/bionic64"
ubuntu3.vm.hostname = "ubuntu3"
ubuntu3.vm.network "private_network", ip: "192.168.33.130"
end
config.vm.define "ubuntu4" do |ubuntu4|
ubuntu4.vm.box = "ubuntu/bionic64"
ubuntu4.vm.hostname = "ubuntu4"
ubuntu4.vm.network "private_network", ip: "192.168.33.140"
end
config.vm.define "freebsd5" do |freebsd5|
freebsd5.vm.box = "freebsd/FreeBSD-11.1-RELEASE"
freebsd5.vm.box_version = "2017.07.21"
freebsd5.vm.hostname = "freebsd5"
freebsd5.vm.network "private_network", ip: "192.168.33.150"
freebsd5.ssh.shell = "sh"
freebsd5.vm.base_mac = "080027D14C55"
freebsd5.vm.synced_folder ".", "/vagrant", type: "rsync"
end
config.vm.define "freebsd6" do |freebsd6|
freebsd6.vm.box = "freebsd/FreeBSD-11.1-RELEASE"
freebsd6.vm.box_version = "2017.07.21"
freebsd6.vm.hostname = "freebsd6"
freebsd6.vm.network "private_network", ip: "192.168.33.160"
freebsd6.ssh.shell = "sh"
freebsd6.vm.base_mac = "080027D14C66"
freebsd6.vm.synced_folder ".", "/vagrant", type: "rsync"
end
end