kameleon-builder 2.2.5 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.rst +21 -0
  4. data/{templates → contrib}/steps/bootstrap/debian/debootstrap_arm.yaml +1 -1
  5. data/{templates → contrib}/steps/export/clean_appliance.yaml +0 -0
  6. data/{templates → contrib}/steps/export/compact_qcow_img.yaml +0 -0
  7. data/{templates → contrib}/steps/setup/archlinux/configure_ruby.yaml +0 -0
  8. data/{templates → contrib}/steps/setup/archlinux/install_dev_tools.yaml +0 -0
  9. data/{templates → contrib}/steps/setup/archlinux/install_gnome.yaml +0 -0
  10. data/{templates → contrib}/steps/setup/archlinux/install_yaourt.yaml +0 -0
  11. data/{templates → contrib}/steps/setup/centos/6.5/configure_repo.yaml +0 -0
  12. data/{templates → contrib}/steps/setup/debian/install_gnome.yaml +0 -0
  13. data/{templates → contrib}/steps/setup/debian/install_kde.yaml +0 -0
  14. data/{templates → erb}/extend.erb +2 -2
  15. data/erb/userconf.erb +5 -0
  16. data/kameleon-builder.gemspec +6 -1
  17. data/lib/kameleon.rb +53 -3
  18. data/lib/kameleon/cli.rb +146 -99
  19. data/lib/kameleon/engine.rb +20 -8
  20. data/lib/kameleon/environment.rb +11 -10
  21. data/lib/kameleon/persistent_cache.rb +1 -9
  22. data/lib/kameleon/recipe.rb +52 -24
  23. data/lib/kameleon/repository.rb +46 -0
  24. data/lib/kameleon/utils.rb +49 -0
  25. data/{templates → tests/recipes}/steps/aliases/defaults.yaml +0 -0
  26. data/tests/recipes/steps/bootstrap/linux/bootstrap.yaml +2 -0
  27. data/tests/recipes/steps/checkpoints/test.yaml +14 -0
  28. data/tests/recipes/steps/enable_something.yaml +2 -0
  29. data/tests/recipes/steps/export/save_appliance.yaml +10 -0
  30. data/tests/recipes/steps/setup/linux/software_install.yaml +7 -0
  31. data/tests/recipes/test_recipe.yaml +41 -0
  32. data/version.txt +1 -1
  33. metadata +34 -139
  34. data/templates/COPYRIGHT +0 -21
  35. data/templates/chroot/debian7-amd64.yaml +0 -119
  36. data/templates/docker/debian7.yaml +0 -107
  37. data/templates/grid5000/debian7.yaml +0 -97
  38. data/templates/qemu/archlinux-desktop-i686.yaml +0 -25
  39. data/templates/qemu/archlinux-desktop-x86_64.yaml +0 -25
  40. data/templates/qemu/archlinux-i686.yaml +0 -25
  41. data/templates/qemu/archlinux-x86_64.yaml +0 -109
  42. data/templates/qemu/centos6.5-x86_64.yaml +0 -122
  43. data/templates/qemu/centos7-x86_64.yaml +0 -122
  44. data/templates/qemu/debian7-amd64.yaml +0 -134
  45. data/templates/qemu/debian7-desktop-amd64.yaml +0 -24
  46. data/templates/qemu/debian7-kameleon-amd64.yaml +0 -40
  47. data/templates/qemu/debian7-oar-amd64.yaml +0 -51
  48. data/templates/qemu/debian8-amd64.yaml +0 -25
  49. data/templates/qemu/fedora20-desktop-x86_64.yaml +0 -21
  50. data/templates/qemu/fedora20-x86_64.yaml +0 -119
  51. data/templates/qemu/ubuntu-12.04-amd64.yaml +0 -132
  52. data/templates/qemu/ubuntu-12.04-desktop-amd64.yaml +0 -25
  53. data/templates/qemu/ubuntu-14.04-amd64.yaml +0 -25
  54. data/templates/qemu/ubuntu-14.04-desktop-amd64.yaml +0 -27
  55. data/templates/steps/bootstrap/archlinux/arch_bootstrap.yaml +0 -211
  56. data/templates/steps/bootstrap/centos/6.5/yum_bootstrap.yaml +0 -67
  57. data/templates/steps/bootstrap/debian/debootstrap.yaml +0 -20
  58. data/templates/steps/bootstrap/fedora/init_pxeboot.yaml +0 -13
  59. data/templates/steps/bootstrap/fedora/yum_bootstrap.yaml +0 -45
  60. data/templates/steps/bootstrap/g5k_reserv.yaml +0 -70
  61. data/templates/steps/bootstrap/initialize_disk.yaml +0 -16
  62. data/templates/steps/bootstrap/initialize_disk_chroot.yaml +0 -80
  63. data/templates/steps/bootstrap/install_requirements.yaml +0 -3
  64. data/templates/steps/bootstrap/prepare_chroot.yaml +0 -126
  65. data/templates/steps/bootstrap/prepare_docker.yaml +0 -51
  66. data/templates/steps/bootstrap/prepare_qemu.yaml +0 -41
  67. data/templates/steps/bootstrap/prepare_virtualbox.yaml +0 -67
  68. data/templates/steps/bootstrap/start_chroot.yaml +0 -51
  69. data/templates/steps/bootstrap/start_docker.yaml +0 -16
  70. data/templates/steps/bootstrap/start_qemu.yaml +0 -74
  71. data/templates/steps/bootstrap/start_virtualbox.yaml +0 -38
  72. data/templates/steps/bootstrap/switch_context_qemu.yaml +0 -84
  73. data/templates/steps/bootstrap/switch_context_virtualbox.yaml +0 -86
  74. data/templates/steps/breakpoint.yaml +0 -3
  75. data/templates/steps/checkpoints/docker.yaml +0 -17
  76. data/templates/steps/checkpoints/qcow2.yaml +0 -40
  77. data/templates/steps/checkpoints/qemu.yaml +0 -33
  78. data/templates/steps/checkpoints/virtualbox.yaml +0 -21
  79. data/templates/steps/disable_checkpoint.yaml +0 -3
  80. data/templates/steps/enable_checkpoint.yaml +0 -5
  81. data/templates/steps/export/qemu_save_appliance.yaml +0 -52
  82. data/templates/steps/export/save_appliance_from_g5k.yaml +0 -47
  83. data/templates/steps/export/vagrant_save_appliance.yaml +0 -14
  84. data/templates/steps/export/virtualbox_save_appliance.yaml +0 -61
  85. data/templates/steps/setup/archlinux/configure_keyboard.yaml +0 -9
  86. data/templates/steps/setup/archlinux/configure_network.yaml +0 -9
  87. data/templates/steps/setup/archlinux/configure_system.yaml +0 -20
  88. data/templates/steps/setup/archlinux/install_bootloader.yaml +0 -23
  89. data/templates/steps/setup/archlinux/install_software.yaml +0 -9
  90. data/templates/steps/setup/autologin.yaml +0 -16
  91. data/templates/steps/setup/centos/6.5/configure_network.yaml +0 -33
  92. data/templates/steps/setup/centos/6.5/configure_system.yaml +0 -46
  93. data/templates/steps/setup/centos/6.5/minimal_install.yaml +0 -3
  94. data/templates/steps/setup/centos/6.5/setup_vagrant_box.yaml +0 -77
  95. data/templates/steps/setup/create_group.yaml +0 -12
  96. data/templates/steps/setup/create_user.yaml +0 -11
  97. data/templates/steps/setup/debian/configure_apt.yaml +0 -73
  98. data/templates/steps/setup/debian/configure_kernel.yaml +0 -13
  99. data/templates/steps/setup/debian/configure_keyboard.yaml +0 -10
  100. data/templates/steps/setup/debian/configure_network.yaml +0 -30
  101. data/templates/steps/setup/debian/configure_system.yaml +0 -12
  102. data/templates/steps/setup/debian/install_bootloader.yaml +0 -36
  103. data/templates/steps/setup/debian/install_software.yaml +0 -2
  104. data/templates/steps/setup/debian/oar/oar_debian_config_frontend.yaml +0 -8
  105. data/templates/steps/setup/debian/oar/oar_debian_config_node.yaml +0 -5
  106. data/templates/steps/setup/debian/oar/oar_debian_config_server.yaml +0 -5
  107. data/templates/steps/setup/debian/oar/oar_prereq_install.yaml +0 -16
  108. data/templates/steps/setup/debian/setup_vagrant_box.yaml +0 -80
  109. data/templates/steps/setup/debian/upgrade_system.yaml +0 -10
  110. data/templates/steps/setup/fedora/configure_kernel.yaml +0 -9
  111. data/templates/steps/setup/fedora/configure_keyboard.yaml +0 -12
  112. data/templates/steps/setup/fedora/configure_network.yaml +0 -38
  113. data/templates/steps/setup/fedora/configure_system.yaml +0 -52
  114. data/templates/steps/setup/fedora/install_bootloader.yaml +0 -53
  115. data/templates/steps/setup/fedora/install_software.yaml +0 -3
  116. data/templates/steps/setup/fedora/minimal_install.yaml +0 -3
  117. data/templates/steps/setup/fedora/update_system.yaml +0 -16
  118. data/templates/steps/setup/oar/oar_config_devel.yaml +0 -21
  119. data/templates/steps/setup/oar/oar_config_frontend.yaml +0 -38
  120. data/templates/steps/setup/oar/oar_config_node.yaml +0 -4
  121. data/templates/steps/setup/oar/oar_config_server.yaml +0 -25
  122. data/templates/steps/setup/oar/oar_config_system.yaml +0 -34
  123. data/templates/steps/setup/oar/oar_devel_prereq_install.yaml +0 -5
  124. data/templates/steps/setup/oar/oar_git_install.yaml +0 -21
  125. data/templates/steps/setup/ubuntu/configure_apt.yaml +0 -62
  126. data/templates/virtualbox/archlinux-desktop-i686.yaml +0 -25
  127. data/templates/virtualbox/archlinux-desktop-x86_64.yaml +0 -28
  128. data/templates/virtualbox/archlinux-i686.yaml +0 -28
  129. data/templates/virtualbox/archlinux-x86_64.yaml +0 -108
  130. data/templates/virtualbox/centos6.5-i386.yaml +0 -39
  131. data/templates/virtualbox/centos6.5-vagrant-x86_64.yaml +0 -33
  132. data/templates/virtualbox/centos6.5-x86_64.yaml +0 -121
  133. data/templates/virtualbox/centos7-x86_64.yaml +0 -118
  134. data/templates/virtualbox/debian7-amd64.yaml +0 -128
  135. data/templates/virtualbox/debian7-desktop-amd64.yaml +0 -25
  136. data/templates/virtualbox/debian7-i386.yaml +0 -31
  137. data/templates/virtualbox/debian7-kameleon-amd64.yaml +0 -38
  138. data/templates/virtualbox/debian7-oar-amd64.yaml +0 -51
  139. data/templates/virtualbox/debian7-vagrant-amd64.yaml +0 -32
  140. data/templates/virtualbox/debian8-amd64.yaml +0 -25
  141. data/templates/virtualbox/debian8-i386.yaml +0 -31
  142. data/templates/virtualbox/fedora20-x86_64.yaml +0 -118
  143. data/templates/virtualbox/ubuntu-12.04-amd64.yaml +0 -128
  144. data/templates/virtualbox/ubuntu-12.04-desktop-amd64.yaml +0 -25
  145. data/templates/virtualbox/ubuntu-14.04-amd64.yaml +0 -25
  146. data/templates/virtualbox/ubuntu-14.04-desktop-amd64.yaml +0 -27
  147. data/tests/recipes/dummy_recipe.yaml +0 -48
  148. data/tests/recipes/steps/bootstrap/dummy_distro/dummy_bootstrap_static.yaml +0 -4
  149. data/tests/recipes/steps/export/dummy_save_appliance.yaml +0 -9
  150. data/tests/recipes/steps/setup/default/dummy_root_passwd.yaml +0 -8
  151. data/tests/recipes/steps/setup/dummy_distro/dummy_software_install.yaml +0 -7
@@ -1,20 +0,0 @@
1
- # # Bootstrap
2
- - debootstrap:
3
- - check_cmd_out: debootstrap
4
- - exec_out: mkdir -p $$rootfs
5
- - exec_out: |
6
- debootstrap \
7
- --variant=$$variant \
8
- --no-check-gpg \
9
- --arch=$$arch \
10
- --include="$$include_pkg" \
11
- $$release \
12
- $$rootfs \
13
- $$repository
14
- - write_out:
15
- - $$rootfs/etc/network/interfaces
16
- - |
17
- auto lo
18
- iface lo inet loopback
19
- auto eth0
20
- iface eth0 inet dhcp
@@ -1,13 +0,0 @@
1
- - download_pxeboot_initrd:
2
- - download_file_out:
3
- - $$pxe_initrd_url
4
- - $$rootfs/boot/initrd.img
5
- - on_setup_init:
6
- - exec_in: rm -f /boot/initrd.img
7
-
8
- - download_pxeboot_vmlinuz:
9
- - download_file_out:
10
- - $$pxe_vmlinuz_url
11
- - $$rootfs/boot/vmlinuz
12
- - on_setup_init:
13
- - exec_in: rm -f /boot/vmlinuz
@@ -1,45 +0,0 @@
1
- - fix_yum:
2
- - check_cmd_out: yum
3
- - exec_out: sed -i "s/opts.ssl_verify_host/2/g" /usr/lib/pymodules/python2.7/urlgrabber/grabber.py
4
-
5
- - init_rpm_db:
6
- - check_cmd_out: rpm
7
- - exec_out: mkdir -p $$rootfs/var/lib/rpm
8
- - exec_out: rpm --root $$rootfs --initdb
9
-
10
- - fetch_release_package:
11
- - check_cmd_out: lynx
12
- - exec_out: RELEASE_PACKAGE_URL=$(lynx $$mirror_packages_url -dump -listonly -nonumbers | grep $${distrib}-release | head -1)
13
- - exec_out: |
14
- if [ -z "${RELEASE_PACKAGE_URL-unset}" ]; then
15
- fail "$${distrib}-release package not found!"
16
- fi
17
-
18
- - install_distrib_release:
19
- - download_file_out:
20
- - $RELEASE_PACKAGE_URL
21
- - $KAMELEON_WORKDIR/$${distrib}-release.rpm
22
- - exec_out: rpm --root $$rootfs -ivh --force-debian --nodeps $KAMELEON_WORKDIR/$${distrib}-release.rpm
23
-
24
- - install_yum:
25
- - exec_out: ln -sf $$rootfs/etc/pki/ /etc/pki
26
- - exec_out: yum --installroot $$rootfs -y install yum
27
- - exec_out: echo $${release} > $$rootfs/etc/yum/vars/releasever
28
-
29
- - mount_chroot:
30
- - exec_out: mount -o bind /dev $$rootfs/dev
31
- - exec_out: mount -o bind /dev/pts $$rootfs/dev/pts
32
- - exec_out: mount -t proc /proc $$rootfs/proc
33
- - exec_out: mount -t sysfs /sys $$rootfs/sys
34
- - exec_out: cp /etc/resolv.conf $$rootfs/etc/resolv.conf
35
-
36
- - install_packages:
37
- - exec_out: chroot $$rootfs yum install --releasever=$$release -y $$include_pkgs
38
-
39
- - umount_chroot:
40
- - on_clean:
41
- - umount_out: $$rootfs/sys
42
- - umount_out: $$rootfs/proc
43
- - umount_out: $$rootfs/dev/pts
44
- - umount_out: $$rootfs/dev
45
- - exec_out: rm -f $$rootfs/etc/resolv.conf
@@ -1,70 +0,0 @@
1
- - create_local_ssh_config_base:
2
- - write_local:
3
- - $$ssh_config_file
4
- - |
5
- Host *
6
- UserKnownHostsFile /dev/null
7
- StrictHostKeyChecking no
8
- ConnectTimeout 2
9
- LogLevel FATAL
10
- ForwardAgent yes
11
- Protocol 2
12
- ControlPath /tmp/$${kameleon_short_uuid}%r@%h:%p
13
- ControlMaster auto
14
- ControlPersist yes
15
- Compression yes
16
- Host g5kaccess
17
- User $$g5k_user
18
- Hostname access.grid5000.fr
19
- Host $$g5k_site
20
- User $$g5k_user
21
- ProxyCommand ssh -F $$ssh_config_file g5kaccess "nc -q 1 $$g5k_site %p"
22
-
23
- - deploy_image:
24
- - exec_out: echo "Deploying image $$kenv with kadeploy"
25
- - exec_out: sleep 1
26
- - exec_out: echo "Submitting a job for deployment"
27
- # We wait long to keep the job
28
- # We submit a job only if there is no job already
29
- - exec_out : |
30
- oarstat | grep -q "$$kameleon_recipe_name" \
31
- || oarsub -n "$$kameleon_recipe_name" -l walltime=$$walltime -t deploy "sleep 100000"
32
- - exec_out : |
33
- echo -n "Waiting for the reservation to be ready"
34
- until $(oarstat -fu $$g5k_user | grep -q "state = Running")
35
- do
36
- echo -n .
37
- sleep 2
38
- done
39
- sleep 1
40
- echo " ~> OK"
41
- - exec_out: echo "Getting the machine name"
42
- - exec_out: export machine=`oarstat -fu $$g5k_user | grep assigned_hostnames | cut -d ' ' -f 7`
43
- - exec_out: echo "Deploying environment $$kenv on $machine"
44
- - exec_out: kadeploy3 -e $$kenv -m $machine -k
45
- - pipe:
46
- - exec_out: echo $machine
47
- - exec_local: cat >$$kameleon_cwd/g5k_machine
48
- - exec_out: sleep 1
49
-
50
- - create_out_ssh_config:
51
- - write_out:
52
- - $$out_cwd/ssh_config
53
- - |
54
- Host $$kameleon_recipe_name
55
- User root
56
- Hostname $machine
57
- UserKnownHostsFile /dev/null
58
- StrictHostKeyChecking no
59
- ConnectTimeout 2
60
- LogLevel FATAL
61
- ForwardAgent yes
62
- Protocol 2
63
-
64
- - append_ssh_node_config:
65
- - append_local:
66
- - $$ssh_config_file
67
- - |
68
- Host $$kameleon_recipe_name
69
- User root
70
- ProxyCommand ssh -F $$ssh_config_file $$g5k_site "nc -q 1 `cat $$kameleon_cwd/g5k_machine | awk '{print $NF}'` %p"
@@ -1,16 +0,0 @@
1
- # Initialize disk
2
-
3
- - partition_disk:
4
- - check_cmd_out: parted
5
- - exec_out: |
6
- echo "Partitioning disk..."
7
- parted -s $${disk_device} mklabel msdos
8
- parted -s -a none $${disk_device} mkpart primary 64s 100%
9
- parted -s $${disk_device} set 1 boot on
10
- - exec_out: |
11
- echo Creating root partition...
12
- mkfs.$$filesystem_type -q $${disk_device}1 || fail cannot create / ext4
13
-
14
- - mount_mountdir:
15
- - exec_out: mkdir -p $$rootfs
16
- - exec_out: "echo Mounting root partition... ; mount $${disk_device}1 $$rootfs || fail cannot mount /"
@@ -1,80 +0,0 @@
1
- # Initialize disk
2
-
3
- # this step create the appliance disk and initialize the
4
- # checkpoint mechanism with Qemu Network Block Device (NBD)
5
-
6
- - create_initial_image:
7
- - check_cmd_out: qemu-img
8
- - exec_out: mkdir -p $$kameleon_cwd/checkpoints
9
- - exec_out: |
10
- if [ ! -e "$$image_disk" ] ; then
11
- qemu-img create -f qcow2 $$kameleon_cwd/checkpoints/base.qcow2 $$image_size
12
- # keep a link to the last checkpoint disk
13
- ln -sf $$kameleon_cwd/checkpoints/base.qcow2 $$image_disk
14
- fi
15
-
16
- - load_nbd_module:
17
- - on_checkpoint: redo
18
- - on_bootstrap_init:
19
- - exec_out: |
20
- lsmod | grep nbd >/dev/null \
21
- || modprobe nbd max_part=63 \
22
- || fail failed to load nbd module into kernel
23
-
24
- - attach_nbd_device:
25
- # this microstep must be skipped because it is already done by the
26
- # checkpoint restore function
27
- - on_checkpoint: redo
28
- - check_cmd_out: qemu-nbd
29
- - exec_out: echo Connecting $$image_disk to nbd device $$nbd_device
30
- - exec_out: echo "sync" ; sync
31
- - exec_out: qemu-nbd -d $$nbd_device
32
- - exec_out: qemu-nbd -c $$nbd_device $(readlink $$image_disk) -n || fail nbd device $$nbd_device is unavailable
33
-
34
- - detach_nbd_device:
35
- # this miscrostep must be done again ensure that the nbd device is
36
- # detached
37
- - on_checkpoint: redo
38
- - on_setup_clean:
39
- - exec_out: echo "sync" ; sync
40
- - exec_out: qemu-nbd -d $$nbd_device
41
- - exec_out: "pgrep qemu-nbd | xargs -I {} kill -9 {} || true"
42
-
43
- - partition_disk:
44
- - check_cmd_out: parted
45
- - exec_out: |
46
- echo "Partitioning disk..."
47
- parted $${nbd_device} mklabel msdos
48
- parted $${nbd_device} mkpart primary 0% 100%
49
- parted $${nbd_device} set 1 boot on
50
- - exec_out: |
51
- echo Creating root partition...
52
- mkfs.$$filesystem_type -q $${nbd_device}p1 || fail cannot create / ext4
53
-
54
- - mount_mountdir:
55
- - on_checkpoint: redo
56
- - exec_out: mkdir -p $$rootfs
57
- - exec_out: "echo Mounting root partition... ; mount $${nbd_device}p1 $$rootfs || fail cannot mount /"
58
- - on_setup_clean:
59
- - exec_out: "echo try umount $$rootfs... ; mountpoint -q $$rootfs && umount -f -l $$rootfs || true"
60
-
61
- - copy_rootfs:
62
- - check_cmd_out: rsync
63
- - exec_out: echo "Copying rootfs to $$rootfs..."
64
- - exec_out: |
65
- rsync -aAX --delete --one-file-system\
66
- --exclude '/.kameleon_timestamp' \
67
- --exclude '/dev/*' \
68
- --exclude '/proc/*' \
69
- --exclude '/sys/*' \
70
- $$rootfs/* $$rootfs
71
- - exec_out: echo "sync..." ; sync
72
-
73
- - create_fstab:
74
- - on_setup_init:
75
- - write_out:
76
- - $$rootfs/etc/fstab
77
- - |
78
- # /etc/fstab: static file system information.
79
- # <file system> <mount point> <type> <options> <dump> <pass>
80
- UUID=`blkid -s UUID -o value $${nbd_device}p1` / $$filesystem_type errors=remount-ro 0 1
@@ -1,3 +0,0 @@
1
- - apt_install:
2
- - exec_out: apt-get update
3
- - exec_out: apt-get -y --force-yes install $$packages 2>&1
@@ -1,126 +0,0 @@
1
- # create the appliance disk and initialize the checkpoint mechanism with Qemu
2
- # Network Block Device (NBD)
3
-
4
- - create_initial_image:
5
- - check_cmd_out: qemu-img
6
- - exec_out: mkdir -p checkpoints
7
- - exec_out: |
8
- if [ $$consider_checkpoint = true ]; then
9
- if [ ! -e "$$image_disk" ] ; then
10
- qemu-img create -f qcow2 checkpoints/base_$$image_disk $$image_size
11
- # keep a link to the last checkpoint disk
12
- ln -sf checkpoints/base_$$image_disk $$image_disk
13
- fi
14
- else
15
- qemu-img create -f qcow2 $$image_disk $$image_size
16
- fi
17
-
18
- - load_nbd_module:
19
- - on_checkpoint: redo
20
- - on_bootstrap_init:
21
- - exec_out: |
22
- lsmod | grep nbd >/dev/null \
23
- || modprobe nbd max_part=63 \
24
- || fail failed to load nbd module into kernel
25
-
26
- - attach_nbd_device:
27
- # this microstep must be skipped because it is already done by the
28
- # checkpoint restore function
29
- - on_checkpoint: redo
30
- - check_cmd_out: qemu-nbd
31
- - exec_out: echo Connecting $$image_disk to nbd device $$nbd_device
32
- - exec_out: echo "sync" ; sync
33
- - exec_out: qemu-nbd -d $$nbd_device
34
- - exec_out: |
35
- if [ $$consider_checkpoint = true ]; then
36
- REAL_PATH="$(readlink $$image_disk)"
37
- else
38
- REAL_PATH="$$image_disk"
39
- fi
40
- qemu-nbd -c $$nbd_device $REAL_PATH -n || fail nbd device $$nbd_device is unavailable
41
-
42
- - detach_nbd_device:
43
- # this miscrostep must be done again ensure that the nbd device is
44
- # detached
45
- - on_checkpoint: redo
46
- - on_export_clean:
47
- - exec_out: echo "sync" ; sync
48
- - exec_out: qemu-nbd -d $$nbd_device
49
- - exec_out: "pgrep qemu-nbd | xargs -I {} kill -9 {} || true"
50
-
51
- - partition_disk:
52
- - check_cmd_out: parted
53
- - exec_out: |
54
- echo "Partitioning disk..."
55
- parted $${nbd_device} mklabel msdos
56
- parted $${nbd_device} mkpart primary 0% 100%
57
- parted $${nbd_device} set 1 boot on
58
- - exec_out: |
59
- echo Creating root partition...
60
- mkfs.$$filesystem_type -q $${nbd_device}p1 || fail cannot create / ext4
61
-
62
- - mount_rootfs:
63
- - exec_out: mkdir -p $$rootfs
64
- - exec_out: "echo Mounting root partition... ; mount $${nbd_device}p1 $$rootfs || fail cannot mount /"
65
- - on_clean:
66
- - exec_out: "echo try umount $$rootfs... ; mountpoint -q $$rootfs && umount -f -l $$rootfs || true"
67
-
68
- - copy_rootfs:
69
- - check_cmd_out: rsync
70
- - exec_out: echo "Copying rootfs to $$rootfs..."
71
- - exec_out: rsync -aAX --exclude '/.kameleon_timestamp' $$rootfs_partial/* $$rootfs
72
- - exec_out: echo "sync..." ; sync
73
-
74
- - create_fstab:
75
- - write_out:
76
- - $$rootfs/etc/fstab
77
- - |
78
- # /etc/fstab: static file system information.
79
- #
80
- # Use 'blkid' to print the universally unique identifier for a
81
- # device; this may be used with UUID= as a more robust way to name devices
82
- # that works even if disks are added and removed. See fstab(5).
83
- #
84
- # <file system> <mount point> <type> <options> <dump> <pass>
85
- UUID=`blkid -s UUID -o value $${nbd_device}p1` / $$filesystem_type errors=remount-ro 0 1
86
-
87
- - mount_chroot:
88
- - check_cmd_out: chroot
89
- - exec_out: mount -o bind /dev $$rootfs/dev
90
- - exec_out: mount -o bind /dev/pts $$rootfs/dev/pts
91
- - exec_out: mount -t proc /proc $$rootfs/proc
92
- - exec_out: mount -t sysfs /sys $$rootfs/sys
93
- - exec_out: test -f $$rootfs/etc/mtab || cat /proc/mounts > $$rootfs/etc/mtab
94
-
95
- - umount_chroot:
96
- - on_clean:
97
- - exec_out: echo try umount $$rootfs/sys... ; mountpoint -q $$rootfs/sys && umount -f -l $$rootfs/sys || true
98
- - exec_out: echo try umount $$rootfs/proc... ; mountpoint -q $$rootfs/proc && umount -f -l $$rootfs/proc || true
99
- - exec_out: echo try umount $$rootfs/dev/pts... ; mountpoint -q $$rootfs/dev/pts && umount -f -l $$rootfs/dev/pts || true
100
- - exec_out: echo try umount $$rootfs/dev... ; mountpoint -q $$rootfs/dev && umount -f -l $$rootfs/dev || true
101
-
102
- - configure_sshd:
103
- - exec_out: echo -e 'y\n' | ssh-keygen -q -t dsa -f $$insecure_ssh_key -N ''
104
- - exec_out: cat $$insecure_ssh_key
105
- - exec_out: chroot $$rootfs mkdir -p /root/.ssh
106
- - exec_out: |
107
- cat $${insecure_ssh_key}.pub | tee -a $$rootfs/root/.ssh/authorized_keys
108
- - write_out:
109
- - $$ssh_config_file
110
- - |
111
- Host $$kameleon_recipe_name
112
- HostName 127.0.0.1
113
- Port $${qemu_ssh_port}
114
- User root
115
- IdentityFile $$insecure_ssh_key
116
- UserKnownHostsFile /dev/null
117
- StrictHostKeyChecking no
118
- PasswordAuthentication no
119
- IdentitiesOnly yes
120
- LogLevel FATAL
121
- ForwardAgent yes
122
- ControlPath $(pwd)/master-%l-%r@%h:%p
123
- ControlMaster auto
124
- ControlPersist yes
125
- Compression yes
126
- Protocol 2
@@ -1,51 +0,0 @@
1
- - insecure_ssh_key: $$kameleon_cwd/insecure_ssh_key
2
-
3
- - clean_containers:
4
- - on_checkpoint: redo
5
- - on_export_clean:
6
- - exec_out: echo "Stopping trailing containers"
7
- - exec_out: touch CONTAINERS_TO_CLEAN
8
- - exec_out: cat CONTAINERS_TO_CLEAN | xargs -I {} docker kill {}
9
- - exec_out: echo "Removing trailing containers"
10
- - exec_out: cat CONTAINERS_TO_CLEAN | xargs -I {} docker rm {}
11
- - exec_out: rm -f CONTAINERS_TO_CLEAN
12
-
13
-
14
- - configure_ssh_access:
15
- - exec_out: echo -e 'y\n' | ssh-keygen -q -t dsa -f $$insecure_ssh_key -N ''
16
- - exec_out: cat $$insecure_ssh_key
17
- - exec_out: chroot $$rootfs mkdir -p /root/.ssh
18
- - exec_out: |
19
- cat $${insecure_ssh_key}.pub > $$rootfs/root/.ssh/authorized_keys
20
- cat $${insecure_ssh_key}.pub > $$rootfs/root/.ssh/kameleon_insecure_public_key
21
- chmod 600 $$rootfs/root/.ssh/authorized_keys
22
- chmod 755 $$rootfs/root/.ssh
23
- - on_clean:
24
- - exec_out: rm -rf $$rootfs/root/.ssh
25
-
26
- - import_to_docker:
27
- - check_cmd_out: docker
28
- - exec_out: echo "Importing $$docker_image to docker..."
29
- - exec_out: tar -C $$rootfs -c . | docker import - $$docker_image:base
30
-
31
- - create_ssh_config:
32
- - write_out:
33
- - $$ssh_config_file
34
- - |
35
- Host $$kameleon_recipe_name
36
- HostName 127.0.0.1
37
- User root
38
- IdentityFile $$insecure_ssh_key
39
- UserKnownHostsFile /dev/null
40
- StrictHostKeyChecking no
41
- PasswordAuthentication no
42
- IdentitiesOnly yes
43
- LogLevel FATAL
44
- ForwardAgent yes
45
- ControlPath /tmp/$${kameleon_short_uuid}%r@%h:%p
46
- ControlMaster auto
47
- ControlPersist yes
48
- Compression yes
49
- Protocol 2
50
- - on_export_clean:
51
- - exec_out: rm -f /tmp/$${kameleon_short_uuid}*
@@ -1,41 +0,0 @@
1
- - insecure_ssh_key: $$kameleon_cwd/insecure_ssh_key
2
-
3
- - download_boot2kameleon_iso:
4
- - download_file_local:
5
- - $$boot2kameleon_url
6
- - $$kameleon_cwd/boot2kameleon.iso
7
-
8
- - create_initial_image:
9
- - check_cmd_local: qemu-img
10
- - exec_local: |
11
- rm -f $$qemu_image_disk
12
- qemu-img create -f qcow2 $$qemu_image_disk $$qemu_image_size
13
-
14
- - delete_initial_image:
15
- - on_checkpoint: skip
16
- - on_export_clean:
17
- - exec_local: rm -f $$qemu_image_disk
18
-
19
- - configure_ssh_access:
20
- - download_file_local:
21
- - $$insecure_ssh_key_url
22
- - $$insecure_ssh_key
23
- - exec_local: chmod 600 $$insecure_ssh_key
24
-
25
- - create_ssh_config:
26
- - write_local:
27
- - $$ssh_config_file
28
- - |
29
- Host $${kameleon_recipe_name}
30
- HostName 127.0.0.1
31
- Port $${qemu_ssh_port}
32
- User root
33
- IdentityFile $$insecure_ssh_key
34
- UserKnownHostsFile /dev/null
35
- StrictHostKeyChecking no
36
- PasswordAuthentication no
37
- IdentitiesOnly yes
38
- LogLevel FATAL
39
- ForwardAgent yes
40
- Compression yes
41
- Protocol 2