Commit 98100c7c09f6bcda1a6840e0204f17cfd3f9febf

Authored by Georg Hopp
1 parent e0318caa

store machine id, so that ansible provisioner can create inventory file

@@ -7,9 +7,9 @@ @@ -7,9 +7,9 @@
7 "providers": [ 7 "providers": [
8 { 8 {
9 "name": "lxd", 9 "name": "lxd",
10 - "url": "file:///data/ghopp/projects/vagrant/vagrant-lxd/gentoo_001_lxd.box", 10 + "url": "file:///home/hopp/projects/vagrant/vagrant-lxd/gentoo_001_lxd.box",
11 "checksum_type": "sha1", 11 "checksum_type": "sha1",
12 - "checksum": "303573ec033c0eb1939df486f444c5bcc3f82d1e" 12 + "checksum": "279b73b0a0f51368376a89283c842c5b474f9274"
13 } 13 }
14 ] 14 ]
15 } 15 }
No preview for this file type
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 }, 11 },
12 "packages": { 12 "packages": {
13 "exec": [ 13 "exec": [
14 - ["emerge", "--update", "sudo"] 14 + ["emerge", "--update", "sudo", "dhcpcd"]
15 ] 15 ]
16 }, 16 },
17 "sudo": { 17 "sudo": {
@@ -49,6 +49,13 @@ module Vagrant @@ -49,6 +49,13 @@ module Vagrant
49 b.use SSHExec 49 b.use SSHExec
50 end 50 end
51 end 51 end
  52 +
  53 + def self.action_provision
  54 + Vagrant::Action::Builder.new.tap do |b|
  55 + #b.use CheckAccessible
  56 + b.use Provision
  57 + end
  58 + end
52 end 59 end
53 end 60 end
54 end 61 end
@@ -18,6 +18,12 @@ module Vagrant @@ -18,6 +18,12 @@ module Vagrant
18 env[:ui].info "--- #{driver.name} created ---", :prefix => false 18 env[:ui].info "--- #{driver.name} created ---", :prefix => false
19 end 19 end
20 20
  21 + # TODO maybe not optimal, check if it would be better to include the
  22 + # pid of the init process to the id of the machine.
  23 + # Well, in that case the id changes with every restart which might
  24 + # not be feasable...
  25 + env[:machine].id = driver.name
  26 +
21 @app.call(env) 27 @app.call(env)
22 end 28 end
23 end 29 end
@@ -7,6 +7,9 @@ module Vagrant @@ -7,6 +7,9 @@ module Vagrant
7 7
8 def execute 8 def execute
9 @env.ui.info("my own plugin", :prefix => false) 9 @env.ui.info("my own plugin", :prefix => false)
  10 + @env.ui.info("--- #{@env.inspect} ---", :prefix => false)
  11 + @env.ui.info("--- #{@local_data_path} ---", :prefix => false)
  12 + @env.ui.info("--- #{@env.active_machines} ---", :prefix => false)
10 end 13 end
11 end 14 end
12 end 15 end
  1 +module Vagrant
  2 + module Lxd
  3 + class Config < Vagrant.plugin("2", :config)
  4 + end
  5 + end
  6 +end
@@ -16,10 +16,10 @@ module Vagrant @@ -16,10 +16,10 @@ module Vagrant
16 Provider 16 Provider
17 end 17 end
18 18
19 - #config(:lxd, :provider) do  
20 - # require File.expand_path("../config", __FILE__)  
21 - # Config  
22 - #end 19 + config(:lxd, :provider) do
  20 + require_relative "config"
  21 + Config
  22 + end
23 23
24 #synced_folder(:virtualbox) do 24 #synced_folder(:virtualbox) do
25 # require File.expand_path("../synced_folder", __FILE__) 25 # require File.expand_path("../synced_folder", __FILE__)
  1 +---
  2 +- hosts: all
  3 + become: true
  4 + tasks:
  5 + - name: test connection
  6 + ping:
@@ -7,9 +7,9 @@ @@ -7,9 +7,9 @@
7 "providers": [ 7 "providers": [
8 { 8 {
9 "name": "lxd", 9 "name": "lxd",
10 - "url": "file:///data/ghopp/projects/vagrant/vagrant-lxd/sid_001_lxd.box", 10 + "url": "file:///home/hopp/projects/vagrant/vagrant-lxd/sid_001_lxd.box",
11 "checksum_type": "sha1", 11 "checksum_type": "sha1",
12 - "checksum": "a533654e7577931659c1cb457b13e6b184d4013d" 12 + "checksum": "21d7376327acdb7f36aa25ed89039248c6562415"
13 } 13 }
14 ] 14 ]
15 } 15 }
No preview for this file type
@@ -10,7 +10,8 @@ @@ -10,7 +10,8 @@
10 "packages": { 10 "packages": {
11 "exec": [ 11 "exec": [
12 ["apt-get", "install", "-y", "sudo"], 12 ["apt-get", "install", "-y", "sudo"],
13 - ["apt-get", "install", "-y", "openssh-server"] 13 + ["apt-get", "install", "-y", "openssh-server"],
  14 + ["apt-get", "install", "-y", "python"]
14 ] 15 ]
15 }, 16 },
16 "sudo": { 17 "sudo": {
Please register or login to post a comment