From cc0b88ff6c3b35903dcc8a81d5b04d63b81c2fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Leo=CC=81n?= Date: Fri, 24 Jun 2016 16:10:27 +0200 Subject: [PATCH] Add Vagrantfile for testing locally --- .gitignore | 5 +++++ Vagrantfile | 13 +++++++++++++ tests/test.yml | 3 ++- tests/vagrant.yml | 16 ++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Vagrantfile create mode 100644 tests/vagrant.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bccdf40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Ignore Vagrant cache files +/.vagrant/ + +# Ignore retry files +*.retry diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..1e14d4c --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,13 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "centos/7" + config.vm.provider "virtualbox" do |vb| + vb.memory = "512" + end + + config.vm.provision "ansible" do |ansible| + ansible.playbook = "tests/vagrant.yml" + end +end diff --git a/tests/test.yml b/tests/test.yml index 14d2c49..352cff1 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -1,5 +1,6 @@ --- - hosts: localhost - remote_user: root + become: yes + become_user: root roles: - . diff --git a/tests/vagrant.yml b/tests/vagrant.yml new file mode 100644 index 0000000..f6932e9 --- /dev/null +++ b/tests/vagrant.yml @@ -0,0 +1,16 @@ +--- +- hosts: all + become: yes + become_user: root + vars: + - clusterstore: yes + roles: + - ../docker + tasks: + - name: check consul state + command: docker ps -q -f name=consul + register: consulcheck + + - name: ensure consul is running + command: docker run -d --name consul -p "8500:8500" progrium/consul -server -bootstrap + when: consulcheck.stdout_lines | length == 0