summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2018-01-17 11:47:05 -0600
committerBenjamin Copeland <ben.copeland@linaro.org>2018-01-17 20:02:52 +0000
commit30a4b5742d7f4de3f06d1b68479d2a0a0213ccb6 (patch)
treef8f3824fa815fdfce5d09c2e99e98dbef5a53965
parenteeb17cad5b439c3d1e6e68cd52ab6dd6f0116bb6 (diff)
downloadansible-playbooks-master.tar.gz
Vagrant: Setup Vagrantfile to provision images using ansibleHEADmaster
- moves the default provider from virtualbox to libvirt-kvm - sets Ubuntu 16.04 as the default box version - sets default provisioner to include the latest ansible from the official ansible repo - adds the .vagrant/ control directory to .gitignore - establishes vagrant vm targets for several roles to allow playbook testing Change-Id: If592199a2e299087bbc60353ef57bfa4b4a4c90c Reviewed-on: https://review.linaro.org/23441 Reviewed-by: Benjamin Copeland <ben.copeland@linaro.org>
-rw-r--r--.gitignore3
-rw-r--r--Vagrantfile190
2 files changed, 100 insertions, 93 deletions
diff --git a/.gitignore b/.gitignore
index 672141f..843006d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*.swp
.idea
-roles/ansible-elasticsearch/* \ No newline at end of file
+roles/ansible-elasticsearch/*
+.vagrant
diff --git a/Vagrantfile b/Vagrantfile
index 8a4d4c9..d9ebed5 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -1,104 +1,110 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
-#
-# This is vagrant config file for local VM setup of android-build
-#
+# 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|
-Vagrant::Config.run do |config|
- # All Vagrant configuration is done here. The most common configuration
- # options are documented and commented below. For a complete reference,
- # please see the online documentation at vagrantup.com.
+ config.vm.box = "yk0/ubuntu-xenial"
- # Every Vagrant virtual environment requires a box to build off of.
- config.vm.box = "ubuntu/trusty64"
+ config.vm.provision :shell, inline: <<SCRIPT
+ sudo apt-add-repository -y ppa:ansible/ansible
+ sudo apt-get update
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ansible git
+SCRIPT
- # The url from where the 'config.vm.box' box will be fetched if it
- # doesn't already exist on the user's system.
- config.vm.box_url = "https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20150530.0.2/providers/virtualbox.box"
+ config.vm.define "jenkins-master" do |jenkins_master|
+ jenkins_master.vm.provider :libvirt do |domain|
+ domain.memory = 4096
+ end
+ jenkins_master.vm.provision :shell, inline: <<CISCRIPT
+ hostname ci.linaro.org
+ cd /vagrant && \
+ ansible-playbook -i /vagrant/hosts \
+ -l ci.linaro.org \
+ -c local \
+ --skip-tags="letsencrypt,vpn" \
+ --extra-vars='{ \
+ "using_vagrant": True, \
+ "ssl_cert": "/etc/ssl/certs/ssl-cert-snakeoil.pem", \
+ "ssl_key": "/etc/ssl/private/ssl-cert-snakeoil.key" \
+ }' \
+ /vagrant/jenkins-master.yml
+CISCRIPT
+ end
- # Boot with a GUI so you can see the screen. (Default is headless)
- config.vm.boot_mode = :gui
+ #TODO: figure out a way to iterate through hosts in inventory
+ config.vm.define "publishing_docker" do |publishing_docker|
+ publishing_docker.vm.provider :libvirt do |domain|
+ domain.memory = 4096
+ end
+ publishing_docker.vm.provision :shell, inline: <<CISCRIPT
+ hostname publishing-ap.linaro.org
+ cd /vagrant && \
+ ansible-playbook -i /vagrant/hosts \
+ -l publishing-ap.linaro.org \
+ -c local \
+ --skip-tags="letsencrypt" \
+ --extra-vars='{ \
+ "using_vagrant": True, \
+ "ssl_cert": "/etc/ssl/certs/ssl-cert-snakeoil.pem", \
+ "ssl_key": "/etc/ssl/private/ssl-cert-snakeoil.key" \
+ }' \
+ /vagrant/publishing-docker.yml
+CISCRIPT
+ end
- # Assign this VM to a host-only network IP, allowing you to access it
- # via the IP. Host-only networks can talk to the host machine as well as
- # any other machines on the same network, but cannot be accessed (through this
- # network interface) by any external networks.
- config.vm.network :hostonly, "192.168.233.2"
+ #TODO: same as publishing_docker, figure out a way to iterate through hosts
+ # in inventory
+ #TODO: probably don't need the ssl stuff
+ config.vm.define "publishing" do |publishing|
+ publishing.vm.provider :libvirt do |domain|
+ domain.memory = 4096
+ end
+ publishing.vm.provision :shell, inline: <<CISCRIPT
+ hostname publishing-ap.linaro.org
+ cd /vagrant && \
+ ansible-playbook -i /vagrant/hosts \
+ -l releases-us.linaro.org \
+ -c local \
+ --skip-tags="db-migrate" \
+ --extra-vars='{ \
+ "using_vagrant": True, \
+ "ssl_cert": "/etc/ssl/certs/ssl-cert-snakeoil.pem", \
+ "ssl_key": "/etc/ssl/private/ssl-cert-snakeoil.key" \
+ }' \
+ /vagrant/publishing.yml
+CISCRIPT
+ end
- # Assign this VM to a bridged network, allowing you to connect directly to a
- # network using the host's network device. This makes the VM appear as another
- # physical device on your network.
- # config.vm.network :bridged
+ config.vm.define "gerrit" do |gerrit|
+ gerrit.vm.provider :libvirt do |domain|
+ domain.memory = 4096
+ end
+ gerrit.vm.provision :shell, inline: <<CISCRIPT
+ hostname review.linaro.org
+ cd /vagrant && \
+ ansible-playbook -i /vagrant/per-service/git-servers/hosts \
+ -l review.linaro.org \
+ -c local \
+ --extra-vars='{ \
+ "inventory_hostname": "review.linaro.org", \
+ "using_vagrant": True, \
+ "ssl_cert": "/etc/ssl/certs/ssl-cert-snakeoil.pem", \
+ "ssl_key": "/etc/ssl/private/ssl-cert-snakeoil.key", \
+ "ssl_ca":"/etc/ssl/certs/ssl-cert-snakeoil.pem" \
+ }' \
+ /vagrant/per-service/git-servers/gerrit.yml
+CISCRIPT
+ end
- # Forward a port from the guest to the host, which allows for outside
- # computers to access the VM, whereas host only networking does not.
- # config.vm.forward_port 80, 6080
- # config.vm.forward_port 443, 6443
+ config.vm.define "blank" do |blank|
+ blank.vm.provider :libvirt do |domain|
+ domain.memory = 4096
+ end
+ # No provisioning. Meant for manually testing out playbooks.
+ end
- # Share an additional folder to the guest VM. The first argument is
- # an identifier, the second is the path on the guest to mount the
- # folder, and the third is the path on the host to the actual folder.
- # config.vm.share_folder "v-data", "/vagrant_data", "../data"
-
- # Enable provisioning with Puppet stand alone. Puppet manifests
- # are contained in a directory path relative to this Vagrantfile.
- # You will need to create the manifests directory and a manifest in
- # the file base.pp in the manifests_path directory.
- #
- # An example Puppet manifest to provision the message of the day:
- #
- # # group { "puppet":
- # # ensure => "present",
- # # }
- # #
- # # File { owner => 0, group => 0, mode => 0644 }
- # #
- # # file { '/etc/motd':
- # # content => "Welcome to your Vagrant-built virtual machine!
- # # Managed by Puppet.\n"
- # # }
- #
- # config.vm.provision :puppet do |puppet|
- # puppet.manifests_path = "manifests"
- # puppet.manifest_file = "base.pp"
- # end
-
- # Enable provisioning with chef solo, specifying a cookbooks path, roles
- # path, and data_bags path (all relative to this Vagrantfile), and adding
- # some recipes and/or roles.
- #
- # config.vm.provision :chef_solo do |chef|
- # chef.cookbooks_path = "../my-recipes/cookbooks"
- # chef.roles_path = "../my-recipes/roles"
- # chef.data_bags_path = "../my-recipes/data_bags"
- # chef.add_recipe "mysql"
- # chef.add_role "web"
- #
- # # You may also specify custom JSON attributes:
- # chef.json = { :mysql_password => "foo" }
- # end
-
- # Enable provisioning with chef server, specifying the chef server URL,
- # and the path to the validation key (relative to this Vagrantfile).
- #
- # The Opscode Platform uses HTTPS. Substitute your organization for
- # ORGNAME in the URL and validation key.
- #
- # If you have your own Chef Server, use the appropriate URL, which may be
- # HTTP instead of HTTPS depending on your configuration. Also change the
- # validation key to validation.pem.
- #
- # config.vm.provision :chef_client do |chef|
- # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
- # chef.validation_key_path = "ORGNAME-validator.pem"
- # end
- #
- # If you're using the Opscode platform, your validator client is
- # ORGNAME-validator, replacing ORGNAME with your organization name.
- #
- # IF you have your own Chef Server, the default validation client name is
- # chef-validator, unless you changed the configuration.
- #
- # chef.validation_client_name = "ORGNAME-validator"
end