add vagrant file and adjust stuff.

This commit is contained in:
Víðir Valberg Guðmundsson 2018-06-24 01:44:30 +02:00
parent 6ee5a4fc25
commit 795d5585b1
4 changed files with 30 additions and 28 deletions

24
Vagrantfile vendored Normal file
View File

@ -0,0 +1,24 @@
Vagrant.require_version ">= 1.7.0"
Vagrant.configure(2) do |config|
config.vm.define "datacoop" do |datacoop|
datacoop.vm.box = "ubuntu/bionic64"
datacoop.vm.hostname = "datacoop"
datacoop.vm.provider "virtualbox" do |v|
v.memory = 4096
end
datacoop.vm.network "private_network", ip: "192.168.0.42"
datacoop.vm.provision "ansible" do |ansible|
ansible.verbose = "v"
ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook.yml"
ansible.host_vars = {
"datacoop" => {"ansible_python_interpreter" => "/usr/bin/python3.6"}
}
ansible.groups = {
"all" => ["datacoop"]
}
end
end
end

View File

@ -5,7 +5,7 @@
######################################
### Application servers
[all_servers]
[servers]
10.1.1.198
10.1.1.199
@ -13,4 +13,4 @@
10.1.1.198
[datacoop2]
10.1.1.199
10.1.1.199

View File

@ -1,30 +1,8 @@
---
- hosts: all
gather_facts: False
pre_tasks:
- name: install python for Ansible
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
register: output
changed_when: output.stdout != ""
- setup:
become: true
- name: "Include host secrets where applicable"
hosts: "all"
tasks:
- include_vars: "host_vars/{{ ansible_nodename }}-secrets.yml"
ignore_errors: yes
tags:
- "always"
- name: "Run base config on all ubuntu hosts"
hosts: "all"
become: yes
roles:
- "ubuntu_base"
- name: "Install docker on all servers"
hosts: "all_servers"
become: yes
roles:
- "docker"
- ubuntu_base
- docker

View File

@ -1,4 +1,4 @@
---
- import_tasks: base.yml
- import_tasks: upgrade.yml
- import_tasks: base.yml
- import_tasks: users.yml