From 795d5585b181eb83f19ed57f893284e21de0abe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 24 Jun 2018 01:44:30 +0200 Subject: [PATCH] add vagrant file and adjust stuff. --- Vagrantfile | 24 ++++++++++++++++++++++++ datacoop_hosts | 4 ++-- playbook.yml | 28 +++------------------------- roles/ubuntu_base/tasks/main.yml | 2 +- 4 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 Vagrantfile diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..bb32fef --- /dev/null +++ b/Vagrantfile @@ -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 diff --git a/datacoop_hosts b/datacoop_hosts index 5fd8e2b..0929020 100644 --- a/datacoop_hosts +++ b/datacoop_hosts @@ -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 \ No newline at end of file +10.1.1.199 diff --git a/playbook.yml b/playbook.yml index da0def6..76d0871 100644 --- a/playbook.yml +++ b/playbook.yml @@ -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" \ No newline at end of file + - ubuntu_base + - docker diff --git a/roles/ubuntu_base/tasks/main.yml b/roles/ubuntu_base/tasks/main.yml index ca18d96..1db59dd 100644 --- a/roles/ubuntu_base/tasks/main.yml +++ b/roles/ubuntu_base/tasks/main.yml @@ -1,4 +1,4 @@ --- -- import_tasks: base.yml - import_tasks: upgrade.yml +- import_tasks: base.yml - import_tasks: users.yml