Skip to content

Commit

Permalink
Merge pull request #11 from EuroPython/test_environment
Browse files Browse the repository at this point in the history
Test environment
  • Loading branch information
alexsavio authored Aug 1, 2018
2 parents fe82487 + f0bac74 commit c5335d4
Show file tree
Hide file tree
Showing 23 changed files with 183 additions and 721 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ tag: clean
@echo "Creating git tag v$(tag)"
git tag v$(tag)
git push --tags

runvm:
vagrant up vepcon
32 changes: 8 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,22 @@ TODO: add introduction, and a brief description
How to run this Ansible playbook
--------------------------------

Vagrant Manager
---------------
1. Create a `vault-pass.txt` file with the provision password.
2. Install Ansible and other dependencies with:

This project includes a Vagrantfile to create a virtual machine which you
can use to develop, test, and mainly run the Ansible playbook.
To start it, `cd` to the root of this project and run:

```
vagrant up manager
vagrant ssh manager
```bash
pip install -r requirements.txt
```

If everything went okay, you can now use Ansible to deploy:
```
cd /vagrant
ansible-playbook site.yml -i inventory/prod -l europython
```

Testing
-------

There is a Vagrant machine called `test`. This is used to deploy in a safe test environment.
There is a Vagrant machine called `vepcon`. This is used to deploy in a safe test environment.
Launch it with:

```bash
vagrant up
```
vagrant up test
```

Once it is provisioned by Vagrant, do:

```
vagrant ssh manager
cd /vagrant
ansible-playbook site.yml -i inventory -l test
```
It will run the Ansible playbook for the `vepcon` host.
42 changes: 9 additions & 33 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,16 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure("2") do |config|

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.define :manager, :autostart => true do |node|
node.vm.box = 'ubuntu/trusty64'
node.vm.hostname = "manager"
node.vm.network :private_network, ip: "10.0.11.10", hostsupdater: "skip"
node.vm.provider "virtualbox" do |vb|
vb.memory = "512"
vb.gui = false
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
end

node.vm.provision :shell, path: "vagrant/upgrade_ansible.sh", privileged: false
node.vm.provision "ansible_local" do |ansible|
ansible.playbook = "site.yml"
ansible.verbose = true
ansible.install = true
ansible.limit = "manager"
ansible.inventory_path = "inventory"
config.vm.define :vepcon, :autostart => true do |node|
node.vm.box = "ubuntu/bionic64"
node.vm.hostname = 'vepcon'
node.vm.network :private_network, ip: "10.0.11.10"
node.vm.synced_folder ".", "/vagrant", type: "virtualbox"
node.vm.provision "ansible" do |ansible|
ansible.limit = "vepcon"
ansible.playbook = "playbook.yml"
end
end

config.vm.define :test, :autostart => true do |node|
node.vm.box = 'ubuntu/trusty64'
node.vm.hostname = 'test'
node.vm.network :private_network, ip: "10.0.11.11", hostsupdater: "skip"
node.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
vb.gui = false
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
end
node.vm.provision :shell, path: "vagrant/test.sh", privileged: false
end

end
Loading

0 comments on commit c5335d4

Please sign in to comment.