install docker and other things
diff --git a/xos/tools/imagebuilder/files/docker.list b/xos/tools/imagebuilder/files/docker.list
new file mode 100644
index 0000000..0ee9ae0
--- /dev/null
+++ b/xos/tools/imagebuilder/files/docker.list
@@ -0,0 +1 @@
+deb https://get.docker.com/ubuntu docker main
diff --git a/xos/tools/imagebuilder/files/vm-resolv.conf b/xos/tools/imagebuilder/files/vm-resolv.conf
new file mode 100644
index 0000000..cae093a
--- /dev/null
+++ b/xos/tools/imagebuilder/files/vm-resolv.conf
@@ -0,0 +1 @@
+nameserver 8.8.8.8
diff --git a/xos/tools/imagebuilder/vsg_image.yaml b/xos/tools/imagebuilder/vsg_image.yaml
index d74b14f..5be8182 100644
--- a/xos/tools/imagebuilder/vsg_image.yaml
+++ b/xos/tools/imagebuilder/vsg_image.yaml
@@ -31,17 +31,63 @@
- name: write a file
shell: echo > /tmp/foobar creates=/tmp/foobar
- # The chrooted environment needs /run/resolvconf/resolv.conf for the
- # Internet to work
- - name: make /run/resolvconf
- shell: mkdir /run/resolvconf creates=/run/resolvconf
+ - name: Stop resolvconf service
+ service: name=resolvconf state=stopped
- - name: setup resolv.conf
- copy: src=resolv.conf dest=/run/resolvconf/resolv.conf
+ - name: Disable resolvconf service
+ copy: dest=/etc/init/resolvconf.override content="manual"
+
+ - name: Install resolv.conf
+ copy: src=files/vm-resolv.conf
+ dest=/etc/resolv.conf
- name: install bridge-utils
apt: name=bridge-utils state=present
- - name: cleanup /run/resolvconf
- shell: rm -rf /run/resolvconf removes=/run/resolvconf
+ - name: Docker repository
+ copy: src=files/docker.list
+ dest=/etc/apt/sources.list.d/docker.list
+
+ - name: Import the repository key
+ apt_key: keyserver=keyserver.ubuntu.com id=36A1D7869245C8950F966E92D8576A8BA88D21E9
+
+ - name: Update cache
+ apt: update_cache=yes
+
+ - name: install Docker
+ apt: name=lxc-docker state=present
+
+ - name: install python-setuptools
+ apt: name=python-setuptools state=present
+
+ - name: install pip
+ easy_install: name=pip
+
+ - name: install docker-py
+ pip: name=docker-py version=0.5.3
+
+ - name: install Pipework
+ get_url: url=https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework
+ dest=/usr/local/bin/pipework
+ mode=0755
+
+# now unmount the image file
+
+- hosts: localhost
+ connection: local
+ tasks:
+ - name: sync the filesystem
+ shell: sync
+
+ - name: Unmount proc, if it is mounted
+ shell: umount /image/inside/proc removes=/image/inside/proc/cmdline
+
+ - name: Unmount the image, if it is mounted
+ shell: umount /image/inside removes=/image/inside/root
+
+ - name: Unconnect the nbd device, if it is connected
+ shell: qemu-nbd --disconnect /dev/nbd0 removes=/dev/nbd0p1
+
+ - name: Tell the user what to do
+ shell: echo "Find your image in /image/vsg.qcow2"