Commit 9f332a2c authored by Reimar Stier's avatar Reimar Stier

hello ansible

parent 25d09e02
...@@ -3,15 +3,17 @@ ...@@ -3,15 +3,17 @@
DISKS = [ DISKS = [
{ "name" => "home", { "name" => "home",
"size" => 5, "size" => 50,
"port" => 1 "port" => 1
}, },
{ "name" => "opt", { "name" => "opt",
"size" => 5, "size" => 15,
"port" => 2 }, "port" => 2 },
{ "name" => "docker",
"size" => 40,
"port" => 3 },
] ]
HTTP_PROXY = "http://192.168.200.1:3128"
BOX_NAME = "devbox" BOX_NAME = "devbox"
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
...@@ -20,12 +22,10 @@ Vagrant.configure("2") do |config| ...@@ -20,12 +22,10 @@ Vagrant.configure("2") do |config|
config.vm.network "private_network", ip: "192.168.200.4", adapter: 2 config.vm.network "private_network", ip: "192.168.200.4", adapter: 2
config.vm.hostname = "devbox.devops.detss.corpintra.net" config.vm.hostname = "devbox.devops.detss.corpintra.net"
# require additional vagrant plugins # requires additional vagrant plugin
config.disksize.size = "20GB" config.disksize.size = "20GB"
config.proxy.http = HTTP_PROXY
config.proxy.https = HTTP_PROXY
config.proxy.no_proxy = "localhost,127.0.0.1"
# configure VM settings and additional disks
config.vm.provider "virtualbox" do |vb| config.vm.provider "virtualbox" do |vb|
vb.memory = "4096" vb.memory = "4096"
vb.cpus = 4 vb.cpus = 4
...@@ -42,6 +42,7 @@ Vagrant.configure("2") do |config| ...@@ -42,6 +42,7 @@ Vagrant.configure("2") do |config|
end end
end end
# add ssh key
config.vm.provision "shell" do |s| config.vm.provision "shell" do |s|
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
s.inline = <<-SHELL s.inline = <<-SHELL
...@@ -50,4 +51,15 @@ Vagrant.configure("2") do |config| ...@@ -50,4 +51,15 @@ Vagrant.configure("2") do |config|
echo #{ssh_pub_key} >> /root/.ssh/authorized_keys echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
SHELL SHELL
end end
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
config.vm.define BOX_NAME do |box|
end
# Run Ansible from the Vagrant VM
config.vm.provision "ansible_local" do |ansible|
# ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook.yml"
ansible.become = true
end
end end
---
- name: playbook
hosts: devbox
tasks:
- debug: msg="hello world"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment