From f99715f3319515de3effe6f29ed492b7a336e7ba Mon Sep 17 00:00:00 2001 From: Sebastian Schulze Date: Mon, 20 Feb 2017 12:46:00 +0100 Subject: [PATCH] Set box hostname to actual Customer directory. --- Vagrantfile | 9 ++++++--- ansible/group_vars/all | 1 + ansible/tasks/base.yml | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index aa6b824..23fd376 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,8 +1,10 @@ # -*- mode: ruby -*- +VM_NAME=File.basename(File.dirname(__FILE__)) + Vagrant.configure(2) do |config| config.vm.box = "bascht/vm" - config.vm.box_version = ">= 0.5.0" - + config.vm.box_version = ">= 0.7.1" + config.vm.hostname = "DevVm" config.ssh.username = "bascht" config.ssh.password = "bascht" config.ssh.insert_key = true @@ -14,7 +16,7 @@ Vagrant.configure(2) do |config| libvirt.cpu_mode = "host-model" libvirt.nested = true libvirt.storage :file, - :path => "#{File.basename(File.dirname(__FILE__))}Home", + :path => "#{VM_NAME}Home", :device => "vdh", :size => "15G", :allow_existing => true @@ -22,6 +24,7 @@ Vagrant.configure(2) do |config| config.vm.provision "ansible" do |ansible| ansible.playbook = "ansible/playbook.yml" + ansible.extra_vars = { vm_hostname: VM_NAME } end config.vm.synced_folder '~/Documents', '/home/bascht/Documents', type: 'sshfs' diff --git a/ansible/group_vars/all b/ansible/group_vars/all index 17800a0..29502a3 100644 --- a/ansible/group_vars/all +++ b/ansible/group_vars/all @@ -52,5 +52,6 @@ apt_ppas: - ppa:webupd8team/atom - ppa:adrozdoff/emacs vm_user: 'bascht' +vm_hostname: "BaseVm" docker_compose_version: '1.11.1' docker_machine_version: '0.9.0' diff --git a/ansible/tasks/base.yml b/ansible/tasks/base.yml index 31cc073..45398fc 100644 --- a/ansible/tasks/base.yml +++ b/ansible/tasks/base.yml @@ -50,3 +50,5 @@ command: homesick link public --force become: yes become_user: "{{ vm_user }}" +- hostname: + name: "{{ vm_hostname }}"