You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by ba...@apache.org on 2015/08/16 19:47:20 UTC
[03/23] couchdb-ci git commit: working Veewee - Vagrant - Ansible
setup
working Veewee - Vagrant - Ansible setup
Ansible provisioning currently does nothing, though
Project: http://git-wip-us.apache.org/repos/asf/couchdb-ci/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ci/commit/cfa05d9d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ci/tree/cfa05d9d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ci/diff/cfa05d9d
Branch: refs/heads/master
Commit: cfa05d9da1e9a370570d1ece8ab230a016362fbf
Parents: b916ea8
Author: Bastian Krol <ba...@web.de>
Authored: Fri Jul 3 22:52:40 2015 +0200
Committer: Bastian Krol <ba...@web.de>
Committed: Fri Jul 3 22:52:42 2015 +0200
----------------------------------------------------------------------
ansible/roles/common/tasks/main.yml | 2 ++
ansible/roles/jenkins-master/tasks/main.yml | 2 ++
ansible/roles/ubuntu/tasks/main.yml | 11 ++++++
ansible/site.yml | 18 ++++++++++
.../couchdb-ci-ubuntu-14.04/vagrant.sh | 8 +++++
vagrant/couchdb-jenkins-master/.gitignore | 1 +
vagrant/couchdb-jenkins-master/Vagrantfile | 35 ++++++++++++++++++++
vagrant/readme.markdown | 25 ++++++++++++++
8 files changed, 102 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/ansible/roles/common/tasks/main.yml
----------------------------------------------------------------------
diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml
new file mode 100644
index 0000000..d7878ac
--- /dev/null
+++ b/ansible/roles/common/tasks/main.yml
@@ -0,0 +1,2 @@
+---
+# currently there are no common tasks ¯\_(ツ)_/¯
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/ansible/roles/jenkins-master/tasks/main.yml
----------------------------------------------------------------------
diff --git a/ansible/roles/jenkins-master/tasks/main.yml b/ansible/roles/jenkins-master/tasks/main.yml
new file mode 100644
index 0000000..d02a671
--- /dev/null
+++ b/ansible/roles/jenkins-master/tasks/main.yml
@@ -0,0 +1,2 @@
+---
+# currently there are no tasks for Jenkins master ¯\_(ツ)_/¯
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/ansible/roles/ubuntu/tasks/main.yml
----------------------------------------------------------------------
diff --git a/ansible/roles/ubuntu/tasks/main.yml b/ansible/roles/ubuntu/tasks/main.yml
new file mode 100644
index 0000000..b5e575b
--- /dev/null
+++ b/ansible/roles/ubuntu/tasks/main.yml
@@ -0,0 +1,11 @@
+---
+ - name: install some basic apt packages
+ apt: name={{item}} state=present
+ with_items:
+ - binutils
+ - bzip2
+ - curl
+ - sudo
+ - unzip
+ - vim # you'll want a decent editor on the box, don't you?
+ - wget
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/ansible/site.yml
----------------------------------------------------------------------
diff --git a/ansible/site.yml b/ansible/site.yml
new file mode 100644
index 0000000..74c8fd5
--- /dev/null
+++ b/ansible/site.yml
@@ -0,0 +1,18 @@
+---
+# Apply common configuration to all hosts
+- hosts: all
+ remote_user: root
+ roles:
+ - common
+
+# Apply common configuration for all Ubuntu systems
+- hosts: ubuntu
+ remote_user: root
+ roles:
+ - ubuntu
+
+# Configure and deploy database servers.
+- hosts: jenkins-master
+ remote_user: root
+ roles:
+ - jenkins-master
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/baseboxes/definitions/couchdb-ci-ubuntu-14.04/vagrant.sh
----------------------------------------------------------------------
diff --git a/baseboxes/definitions/couchdb-ci-ubuntu-14.04/vagrant.sh b/baseboxes/definitions/couchdb-ci-ubuntu-14.04/vagrant.sh
index 10efd34..da0e2c1 100644
--- a/baseboxes/definitions/couchdb-ci-ubuntu-14.04/vagrant.sh
+++ b/baseboxes/definitions/couchdb-ci-ubuntu-14.04/vagrant.sh
@@ -4,3 +4,11 @@ cd /home/vagrant/.ssh
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
chmod 600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
+
+# also add key for root user, so Ansible can do its thing via root instead of user vagrant
+mkdir /root/.ssh
+chmod 700 /root/.ssh
+cd /root/.ssh
+wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
+chmod 600 /root/.ssh/authorized_keys
+chown -R root /root/.ssh
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/vagrant/couchdb-jenkins-master/.gitignore
----------------------------------------------------------------------
diff --git a/vagrant/couchdb-jenkins-master/.gitignore b/vagrant/couchdb-jenkins-master/.gitignore
new file mode 100644
index 0000000..8000dd9
--- /dev/null
+++ b/vagrant/couchdb-jenkins-master/.gitignore
@@ -0,0 +1 @@
+.vagrant
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/vagrant/couchdb-jenkins-master/Vagrantfile
----------------------------------------------------------------------
diff --git a/vagrant/couchdb-jenkins-master/Vagrantfile b/vagrant/couchdb-jenkins-master/Vagrantfile
new file mode 100644
index 0000000..63370e0
--- /dev/null
+++ b/vagrant/couchdb-jenkins-master/Vagrantfile
@@ -0,0 +1,35 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# All Vagrant configuration is done below. The "2" in Vagrant.configure
+# configures the configuration version (we support older styles for
+# backwards compatibility).
+Vagrant.configure(2) do |config|
+ config.vm.box = "couchdb-ci-ubuntu-14.04"
+
+ # How much memory do we need to test the setup? I have no clue.
+ config.vm.provider "virtualbox" do |vb|
+ vb.memory = "1024"
+ end
+
+ # The base box also copies the Vagrant ssh key into root's authorized_keys
+ # so we can ssh into the box via root. This way, there is no mention of the
+ # user vagrant in the Ansible scripts.
+ config.ssh.username = 'root'
+
+ config.vm.define "couchdb-jenkins-master"
+
+ # Workaround for "stdin: is not a tty error" -- make Vagrants ssh shell a
+ # non-login one. See https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042
+ config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
+
+ config.vm.provision "ansible" do |ansible|
+ ansible.playbook = "../../ansible/site.yml"
+ ansible.groups = {
+ "jenkins-master" => ["jenkins-master"],
+ "ubuntu" => ["ubuntu"]
+ }
+ end
+
+ config.vm.network "forwarded_port", guest: 8080, host: 18080
+end
http://git-wip-us.apache.org/repos/asf/couchdb-ci/blob/cfa05d9d/vagrant/readme.markdown
----------------------------------------------------------------------
diff --git a/vagrant/readme.markdown b/vagrant/readme.markdown
new file mode 100644
index 0000000..141127c
--- /dev/null
+++ b/vagrant/readme.markdown
@@ -0,0 +1,25 @@
+Vagrant Configuration for Testing the CouchDB CI Setup Locally
+==============================================================
+
+Each sub folder in this directory contains the Vagrant configuration for one of the machines used in the CouchDB CI setup.
+
+## Prerequesites
+
+You need to have [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) installed.
+
+## Building and Registering the Base Box
+
+Each vagrant configuration requires its respective base box. For example, the configuration couchdb-jenkins-master requires the base box `couchdb-ci-ubuntu-14.04`. You can build the base boxes locally with veewee (see `../baseboxes/readme.markdown`). To make things easier we might upload the base boxes somewhere so people do not have to build them theirselves but can just download them but we are not there yet.
+
+Either way, you have to add the image to the vagrant base image registry with the following command:
+```
+vagrant box add couchdb-ci-ubuntu-14.04 /path/to/your/base-box-file.box
+```
+
+When this has happened, `vagrant box list` should list the base box's name (`couchdb-ci-ubuntu-14.04` in our example).
+
+The base box built with veewee is just a fresh minimal install of the OS. All relevant packages and configurations are provisioned with Ansible. Vagrant is used to make creating, provisioning and destroying these virtual machines easier.
+
+## Launching and Provisioning the Box
+
+Just execute `vagrant up`. This will start the virtual machine and provision it using the scripts in `../ansible`. That's it :-)