kameleon-builder 2.0.0.dev
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.
- data/.editorconfig +23 -0
- data/.env +51 -0
- data/.gitignore +22 -0
- data/AUTHORS +19 -0
- data/CHANGELOG +36 -0
- data/COPYING +340 -0
- data/Gemfile +4 -0
- data/README.md +53 -0
- data/Rakefile +24 -0
- data/Vagrantfile +68 -0
- data/bin/kameleon +16 -0
- data/contrib/kameleon_bashrc.sh +138 -0
- data/contrib/scripts/VirtualBox_deploy.sh +12 -0
- data/contrib/scripts/chroot_env +9 -0
- data/contrib/scripts/create_passwd.py +17 -0
- data/contrib/scripts/umount-chroot.sh +290 -0
- data/contrib/steps/bootstrap/debian/bootstrap_if_needed.yaml +47 -0
- data/contrib/steps/bootstrap/debian/bootstrap_static.yaml +38 -0
- data/contrib/steps/setup/add_timestamp.yaml +6 -0
- data/contrib/steps/setup/autologin.yaml +16 -0
- data/contrib/steps/setup/copy_ssh_auth_file.yaml +10 -0
- data/contrib/steps/setup/debian/add_network_interface.yaml +7 -0
- data/contrib/steps/setup/debian/cluster_tools_install.yaml +16 -0
- data/contrib/steps/setup/debian/network_config_static.yaml +17 -0
- data/contrib/steps/setup/generate_user_ssh_key.yaml +15 -0
- data/contrib/steps/setup/install_my_ssh_key.yaml +26 -0
- data/contrib/steps/setup/make_swap_file.yaml +9 -0
- data/contrib/steps/setup/root_ssh_config.yaml +18 -0
- data/contrib/steps/setup/set_user_password.yaml +7 -0
- data/contrib/steps/setup/system_optimization.yaml +8 -0
- data/docs/.gitignore +1 -0
- data/docs/Makefile +177 -0
- data/docs/make.bat +242 -0
- data/docs/source/_static/.gitignore +0 -0
- data/docs/source/aliases.rst +29 -0
- data/docs/source/checkpoint.rst +28 -0
- data/docs/source/cli.rst +3 -0
- data/docs/source/commands.rst +62 -0
- data/docs/source/conf.py +254 -0
- data/docs/source/context.rst +42 -0
- data/docs/source/faq.rst +3 -0
- data/docs/source/getting_started.rst +3 -0
- data/docs/source/index.rst +38 -0
- data/docs/source/installation.rst +3 -0
- data/docs/source/recipe.rst +256 -0
- data/docs/source/why.rst +3 -0
- data/docs/source/workspace.rst +11 -0
- data/kameleon-builder.gemspec +37 -0
- data/lib/kameleon.rb +75 -0
- data/lib/kameleon/cli.rb +176 -0
- data/lib/kameleon/context.rb +83 -0
- data/lib/kameleon/engine.rb +357 -0
- data/lib/kameleon/environment.rb +38 -0
- data/lib/kameleon/error.rb +51 -0
- data/lib/kameleon/logger.rb +53 -0
- data/lib/kameleon/recipe.rb +474 -0
- data/lib/kameleon/shell.rb +290 -0
- data/lib/kameleon/step.rb +213 -0
- data/lib/kameleon/utils.rb +45 -0
- data/lib/kameleon/version.rb +3 -0
- data/templates/COPYRIGHT +21 -0
- data/templates/aliases/defaults.yaml +83 -0
- data/templates/checkpoints/docker.yaml +14 -0
- data/templates/checkpoints/qcow2.yaml +44 -0
- data/templates/debian-wheezy-chroot.yaml +98 -0
- data/templates/debian-wheezy-docker.yaml +97 -0
- data/templates/fedora-docker.yaml +96 -0
- data/templates/steps/bootstrap/debian/debootstrap.yaml +13 -0
- data/templates/steps/bootstrap/fedora/docker_bootstrap.yaml +25 -0
- data/templates/steps/bootstrap/fedora/yum_bootstrap.yaml +22 -0
- data/templates/steps/bootstrap/prepare_appliance_with_nbd.yaml +93 -0
- data/templates/steps/bootstrap/prepare_docker.yaml +38 -0
- data/templates/steps/bootstrap/start_chroot.yaml +53 -0
- data/templates/steps/bootstrap/start_docker.yaml +12 -0
- data/templates/steps/export/build_appliance_from_docker.yaml +105 -0
- data/templates/steps/export/clean_appliance.yaml +3 -0
- data/templates/steps/export/save_appliance_from_nbd.yaml +54 -0
- data/templates/steps/setup/create_user.yaml +12 -0
- data/templates/steps/setup/debian/kernel_install.yaml +20 -0
- data/templates/steps/setup/debian/keyboard_config.yaml +10 -0
- data/templates/steps/setup/debian/network_config.yaml +30 -0
- data/templates/steps/setup/debian/software_install.yaml +15 -0
- data/templates/steps/setup/debian/system_config.yaml +12 -0
- data/templates/steps/setup/fedora/kernel_install.yaml +27 -0
- data/templates/steps/setup/fedora/software_install.yaml +10 -0
- data/tests/helper.rb +22 -0
- data/tests/recipes/dummy_recipe.yaml +48 -0
- data/tests/recipes/steps/bootstrap/dummy_distro/dummy_bootstrap_static.yaml +4 -0
- data/tests/recipes/steps/export/dummy_save_appliance.yaml +9 -0
- data/tests/recipes/steps/setup/default/dummy_root_passwd.yaml +8 -0
- data/tests/recipes/steps/setup/dummy_distro/dummy_software_install.yaml +7 -0
- data/tests/test_context.rb +16 -0
- data/tests/test_recipe.rb +15 -0
- data/tests/test_version.rb +9 -0
- metadata +300 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
module Kameleon
|
2
|
+
module Utils
|
3
|
+
|
4
|
+
def self.resolve_vars(raw, yaml_path, initial_variables)
|
5
|
+
raw.to_s.gsub(/\$\$\{[a-zA-Z0-9\-_]+\}|\$\$[a-zA-Z0-9\-_]+/) do |var|
|
6
|
+
# remove the dollars
|
7
|
+
if var.include? "{"
|
8
|
+
strip_var = var[3,(var.length - 4)]
|
9
|
+
else
|
10
|
+
strip_var = var[2,(var.length - 2)]
|
11
|
+
end
|
12
|
+
# check in local vars
|
13
|
+
if initial_variables.has_key? strip_var
|
14
|
+
value = initial_variables[strip_var]
|
15
|
+
else
|
16
|
+
fail RecipeError, "#{yaml_path}: variable #{var} not found in local or global"
|
17
|
+
end
|
18
|
+
return $` + resolve_vars(value.to_s + $', yaml_path, initial_variables)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.generate_slug(str)
|
23
|
+
value = str.strip
|
24
|
+
value.gsub!(/['`]/, "")
|
25
|
+
value.gsub!(/\s*@\s*/, " at ")
|
26
|
+
value.gsub!(/\s*&\s*/, " and ")
|
27
|
+
value.gsub!(/\s*[^A-Za-z0-9\.]\s*/, '_')
|
28
|
+
value.gsub!(/_+/, "_")
|
29
|
+
value.gsub!(/\A[_\.]+|[_\.]+\z/, "")
|
30
|
+
value
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.extract_meta_var(name, content)
|
34
|
+
start_regex = Regexp.escape("# #{name.upcase}: ")
|
35
|
+
end_regex = Regexp.escape("\n#\n")
|
36
|
+
reg = %r/#{ start_regex }(.*?)#{ end_regex }/m
|
37
|
+
var = content.match(reg).captures.first
|
38
|
+
var.gsub!("\n#", "")
|
39
|
+
var.gsub!(" ", " ")
|
40
|
+
return var
|
41
|
+
rescue
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
data/templates/COPYRIGHT
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Kameleon recipes and steps
|
2
|
+
# ==========================
|
3
|
+
#
|
4
|
+
# All the files and subdirectories in this directory are part of the
|
5
|
+
# kameleon tool distributed under this copyright.
|
6
|
+
# Copyright (C) 2009-2010 LIG <http://lig.imag.fr/>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
write_local:
|
2
|
+
- exec_local: |
|
3
|
+
mkdir -p $(dirname @1);
|
4
|
+
cat >@1 <<<"@2"
|
5
|
+
|
6
|
+
write_in:
|
7
|
+
- exec_in: |
|
8
|
+
mkdir -p $(dirname @1);
|
9
|
+
cat >@1 <<<"@2"
|
10
|
+
|
11
|
+
write_out:
|
12
|
+
- exec_out: |
|
13
|
+
mkdir -p $(dirname @1);
|
14
|
+
cat >@1 <<<"@2"
|
15
|
+
|
16
|
+
append_local:
|
17
|
+
- exec_local: |
|
18
|
+
mkdir -p $(dirname @1);
|
19
|
+
cat >>@1 <<<"@2"
|
20
|
+
append_in:
|
21
|
+
- exec_in: |
|
22
|
+
mkdir -p $(dirname @1);
|
23
|
+
cat >>@1 <<<"@2"
|
24
|
+
|
25
|
+
append_out:
|
26
|
+
- exec_out: |
|
27
|
+
mkdir -p $(dirname @1);
|
28
|
+
cat >>@1 <<<"@2"
|
29
|
+
|
30
|
+
local2out:
|
31
|
+
- exec_out: |
|
32
|
+
mkdir -p $(dirname @2)"
|
33
|
+
- pipe:
|
34
|
+
- exec_local: cat @1
|
35
|
+
- exec_out: cat > @2
|
36
|
+
|
37
|
+
local2in:
|
38
|
+
- exec_in: mkdir -p $(dirname @2)
|
39
|
+
- pipe:
|
40
|
+
- exec_local: cat @1
|
41
|
+
- exec_in: cat > @2
|
42
|
+
|
43
|
+
out2local:
|
44
|
+
- exec_local: mkdir -p $(dirname @2)
|
45
|
+
- pipe:
|
46
|
+
- exec_out: cat @1
|
47
|
+
- exec_local: cat > @2
|
48
|
+
|
49
|
+
out2in:
|
50
|
+
- exec_in: mkdir -p $(dirname @2)
|
51
|
+
- pipe:
|
52
|
+
- exec_out: cat @1
|
53
|
+
- exec_in: cat > @2
|
54
|
+
|
55
|
+
in2local:
|
56
|
+
- exec_local: mkdir -p $(dirname @2)
|
57
|
+
- pipe:
|
58
|
+
- exec_in: cat @1
|
59
|
+
- exec_local: cat > @2
|
60
|
+
|
61
|
+
in2out:
|
62
|
+
- exec_out: mkdir -p $(dirname @2)
|
63
|
+
- pipe:
|
64
|
+
- exec_in: cat @1
|
65
|
+
- exec_out: cat > @2
|
66
|
+
|
67
|
+
check_cmd_out:
|
68
|
+
- on_bootstrap_init:
|
69
|
+
- rescue:
|
70
|
+
- exec_out: command -V @1 2> /dev/null
|
71
|
+
- breakpoint: "@1 is missing"
|
72
|
+
|
73
|
+
check_cmd_local:
|
74
|
+
- on_bootstrap_init:
|
75
|
+
- rescue:
|
76
|
+
- exec_local: command -V @1 2> /dev/null
|
77
|
+
- breakpoint: "@1 is missing"
|
78
|
+
|
79
|
+
check_cmd_in:
|
80
|
+
- on_bootstrap_init:
|
81
|
+
- rescue:
|
82
|
+
- exec_in: command -V @1 2> /dev/null
|
83
|
+
- breakpoint: "@1 is missing"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
create: |
|
2
|
+
if [ -f MAIN_CONTAINER_ID ] ; then
|
3
|
+
docker commit $(cat MAIN_CONTAINER_ID) $$docker_image:@microstep_id
|
4
|
+
fi
|
5
|
+
|
6
|
+
apply: |
|
7
|
+
docker tag $$docker_image:@microstep_id $$docker_image:latest
|
8
|
+
|
9
|
+
list: |
|
10
|
+
docker images | grep $$docker_image | awk '{print $2}'
|
11
|
+
|
12
|
+
clear: |
|
13
|
+
docker images | grep $$docker_image | awk '{print $3}' \
|
14
|
+
| xargs -I {} bash -c "docker rmi {} | cat || true"
|
@@ -0,0 +1,44 @@
|
|
1
|
+
create: |
|
2
|
+
if [ -e "$$container" ] ; then
|
3
|
+
parent_of_@microstep_id="$(readlink $$container)"
|
4
|
+
mkdir -p checkpoints
|
5
|
+
pushd checkpoints
|
6
|
+
rm -f @microstep_id_$${container}
|
7
|
+
qemu-img create -f qcow2 "@microstep_id_$${container}" \
|
8
|
+
-o backing_file=$(basename "$parent_of_@microstep_id")
|
9
|
+
popd
|
10
|
+
ln -sf checkpoints/@microstep_id_$$container $$container
|
11
|
+
|
12
|
+
lsmod | grep nbd >/dev/null || modprobe nbd max_part=63
|
13
|
+
|
14
|
+
echo "sync" ; sync
|
15
|
+
qemu-nbd -d $$nbd_device
|
16
|
+
qemu-nbd -c $$nbd_device "$(readlink $$container)"
|
17
|
+
fi
|
18
|
+
|
19
|
+
apply: |
|
20
|
+
# apply command use the backing file that represent the real state to restore
|
21
|
+
previous_id=$(qemu-img info "checkpoints/@microstep_id_$${container}" \
|
22
|
+
| grep backing \
|
23
|
+
| sed -e 's/.*checkpoints\/\(.*\)_$${container}\(.*\)/\1/p' \
|
24
|
+
| uniq)
|
25
|
+
|
26
|
+
ln -sf "checkpoints/${previous_id}_$${container}" "$$container"
|
27
|
+
|
28
|
+
lsmod | grep nbd >/dev/null || modprobe nbd max_part=63
|
29
|
+
|
30
|
+
echo "sync" ; sync
|
31
|
+
qemu-nbd -d $$nbd_device
|
32
|
+
qemu-nbd -c $$nbd_device "$(readlink $$container)"
|
33
|
+
|
34
|
+
clear: |
|
35
|
+
if [ -d "checkpoints" ] ; then
|
36
|
+
ls checkpoints/ | \
|
37
|
+
xargs -I {} bash -c "echo Removing checkpoints/{} ; rm checkpoints/{}"
|
38
|
+
rm -f $$container
|
39
|
+
fi
|
40
|
+
|
41
|
+
list: |
|
42
|
+
if [ -d "checkpoints" ] ; then
|
43
|
+
ls checkpoints/ | sed -e 's/\(.*\)_$${container}/\1/p' | uniq
|
44
|
+
fi
|
@@ -0,0 +1,98 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
+
#==============================================================================
|
4
|
+
#
|
5
|
+
# RECIPE: <%= recipe_name %>
|
6
|
+
#
|
7
|
+
# DESCRIPTION: Build a debian wheezy appliance using chroot and qemu-nbd.
|
8
|
+
#
|
9
|
+
# TEMPLATE: <%= @name %>
|
10
|
+
#
|
11
|
+
#==============================================================================
|
12
|
+
|
13
|
+
---
|
14
|
+
# Loads some helpful aliases
|
15
|
+
aliases: defaults.yaml
|
16
|
+
# Enables qcow2 checkpoint
|
17
|
+
checkpoint: qcow2.yaml
|
18
|
+
#== Global variables use by Kameleon engine and the steps
|
19
|
+
global:
|
20
|
+
## User varibales : used by the recipe
|
21
|
+
cachedir: /var/cache/kameleon
|
22
|
+
rootfs: $$kameleon_cwd/rootfs
|
23
|
+
user_name: kameleon
|
24
|
+
arch: amd64
|
25
|
+
|
26
|
+
nbd_device: /dev/nbd10
|
27
|
+
container: "$${kameleon_recipe_name}_temp.qcow2"
|
28
|
+
|
29
|
+
distrib: debian
|
30
|
+
release: wheezy
|
31
|
+
|
32
|
+
## System variables. Required by kameleon engine
|
33
|
+
# Include specific steps
|
34
|
+
include_steps: [$$distrib/$$release, $$distrib]
|
35
|
+
|
36
|
+
# Shell session from where we launch exec_out commands. There is often a
|
37
|
+
# local bash session, but it can be a remote shell on other machines or on
|
38
|
+
# any shell. (eg. bash, chroot, fakechroot, ssh, tmux, lxc...)
|
39
|
+
out_context:
|
40
|
+
cmd: bash
|
41
|
+
workdir: $$kameleon_cwd
|
42
|
+
|
43
|
+
# Shell session that allows us to connect to the building machine in order to
|
44
|
+
# configure it and setup additional programs
|
45
|
+
default_env: "USER=root HOME=/root LC_ALL=POSIX"
|
46
|
+
in_context:
|
47
|
+
cmd: $$default_env chroot $$rootfs bash
|
48
|
+
workdir: /
|
49
|
+
|
50
|
+
#== Bootstrap the new system and create the 'in_context'
|
51
|
+
bootstrap:
|
52
|
+
- debootstrap:
|
53
|
+
- release: $$release
|
54
|
+
- arch: $$arch
|
55
|
+
- repository: http://ftp.fr.debian.org/debian/
|
56
|
+
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/debootstrap.tar.gz
|
57
|
+
- prepare_appliance_with_nbd:
|
58
|
+
- mountdir: $$rootfs
|
59
|
+
- image_size: 2G
|
60
|
+
- filesystem_type: ext4
|
61
|
+
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/debootstrap.tar.gz
|
62
|
+
- start_chroot:
|
63
|
+
- rootfs: $$rootfs
|
64
|
+
|
65
|
+
|
66
|
+
#== Install and configuration steps
|
67
|
+
# WARNING: this part should be independante from the build context (whenever
|
68
|
+
# possible...)
|
69
|
+
setup:
|
70
|
+
# Install
|
71
|
+
- software_install:
|
72
|
+
- packages: >
|
73
|
+
debian-keyring ntp zip unzip rsync sudo less vim bash-completion
|
74
|
+
- kernel_install:
|
75
|
+
- arch: $$arch
|
76
|
+
# Configuration
|
77
|
+
- system_config:
|
78
|
+
- locales: fr_FR en_US
|
79
|
+
- lang: fr_FR.UTF-8
|
80
|
+
- timezone: Europe/Paris
|
81
|
+
- keyboard_config:
|
82
|
+
- layout: "fr,us"
|
83
|
+
- network_config:
|
84
|
+
- hostname: kameleon-$$distrib
|
85
|
+
- create_user:
|
86
|
+
- name: $$user_name
|
87
|
+
- group: admin
|
88
|
+
- password: $$user_name
|
89
|
+
|
90
|
+
#== Export the generated appliance in the format of your choice
|
91
|
+
export:
|
92
|
+
- save_appliance_from_nbd:
|
93
|
+
- filename: "$${kameleon_recipe_name}"
|
94
|
+
- save_as_qcow2
|
95
|
+
# - save_as_tgz
|
96
|
+
# - save_as_raw
|
97
|
+
# - save_as_vmdk
|
98
|
+
# - save_as_vdi
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
+
#==============================================================================
|
4
|
+
#
|
5
|
+
# RECIPE: <%= recipe_name %>
|
6
|
+
#
|
7
|
+
# DESCRIPTION: Build a debian wheezy appliance using Docker.
|
8
|
+
#
|
9
|
+
# TEMPLATE: <%= @name %>
|
10
|
+
#
|
11
|
+
#==============================================================================
|
12
|
+
|
13
|
+
---
|
14
|
+
# Loads some helpful aliases
|
15
|
+
aliases: defaults.yaml
|
16
|
+
# Enables qcow2 checkpoint
|
17
|
+
checkpoint: docker.yaml
|
18
|
+
#== Global variables use by Kameleon engine and the steps
|
19
|
+
global:
|
20
|
+
## User varibales : used by the recipe
|
21
|
+
cachedir: /var/cache/kameleon
|
22
|
+
user_name: kameleon
|
23
|
+
arch: amd64
|
24
|
+
|
25
|
+
distrib: debian
|
26
|
+
release: wheezy
|
27
|
+
docker_image: kameleon-$${distrib}-$$release
|
28
|
+
# DNS servers : opendns
|
29
|
+
docker_dns: 208.67.222.222
|
30
|
+
|
31
|
+
## System variables. Required by kameleon engine
|
32
|
+
# Include specific steps
|
33
|
+
include_steps: [$$distrib/$$release, $$distrib]
|
34
|
+
|
35
|
+
# Shell session from where we launch exec_out commands. There is often a
|
36
|
+
# local bash session, but it can be a remote shell on other machines or on
|
37
|
+
# any shell. (eg. bash, chroot, fakechroot, ssh, tmux, lxc...)
|
38
|
+
out_context:
|
39
|
+
cmd: bash
|
40
|
+
workdir: $$kameleon_cwd
|
41
|
+
|
42
|
+
# Shell session that allows us to connect to the building machine in order to
|
43
|
+
# configure it and setup additional programs
|
44
|
+
ssh_options: -o StrictHostKeyChecking=no -o ForwardAgent=yes
|
45
|
+
ssh_port: $(cat MAIN_CONTAINER_PORT)
|
46
|
+
insecure_ssh_key: insecure_ssh_dsa_key
|
47
|
+
in_context:
|
48
|
+
cmd: LC_ALL=POSIX ssh $$ssh_options localhost -p $$ssh_port -i $$insecure_ssh_key -t /bin/bash
|
49
|
+
workdir: /
|
50
|
+
|
51
|
+
#== Bootstrap the new system and create the 'in_context'
|
52
|
+
bootstrap:
|
53
|
+
- debootstrap:
|
54
|
+
- release: $$release
|
55
|
+
- arch: $$arch
|
56
|
+
- repository: http://ftp.fr.debian.org/debian/
|
57
|
+
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/debootstrap.tar.gz
|
58
|
+
- prepare_docker:
|
59
|
+
- image: $$docker_image
|
60
|
+
- dns: $$docker_dns
|
61
|
+
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/debootstrap.tar.gz
|
62
|
+
- start_docker:
|
63
|
+
- image: $$docker_image
|
64
|
+
- dns: $$docker_dns
|
65
|
+
- hostname: kameleon-$$distrib
|
66
|
+
|
67
|
+
#== Install and configuration steps
|
68
|
+
# WARNING: this part should be independante from the build context (whenever
|
69
|
+
# possible...)
|
70
|
+
setup:
|
71
|
+
# Install
|
72
|
+
- software_install:
|
73
|
+
- packages: >
|
74
|
+
debian-keyring ntp zip unzip rsync sudo less vim bash-completion
|
75
|
+
extlinux
|
76
|
+
- kernel_install:
|
77
|
+
- arch: $$arch
|
78
|
+
# Configuration
|
79
|
+
- system_config:
|
80
|
+
- locales: fr_FR en_US
|
81
|
+
- lang: fr_FR.UTF-8
|
82
|
+
- timezone: Europe/Paris
|
83
|
+
- keyboard_config:
|
84
|
+
- layout: "fr,us"
|
85
|
+
- create_user:
|
86
|
+
- name: $$user_name
|
87
|
+
- group: admin
|
88
|
+
- password: $$user_name
|
89
|
+
|
90
|
+
#== Export the generated appliance in the format of your choice
|
91
|
+
export:
|
92
|
+
- build_appliance_from_docker:
|
93
|
+
- mountdir: $$kameleon_cwd/rootfs
|
94
|
+
- filename: $$kameleon_recipe_name
|
95
|
+
- filesystem_type: ext4
|
96
|
+
- format: qcow2 # Should be raw, qcow2 or qed format
|
97
|
+
- image_size: 2G
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
+
#==============================================================================
|
4
|
+
#
|
5
|
+
# RECIPE: <%= recipe_name %>
|
6
|
+
#
|
7
|
+
# DESCRIPTION: Fedora base image [Working progress].
|
8
|
+
#
|
9
|
+
# TEMPLATE: <%= @name %>
|
10
|
+
#
|
11
|
+
#==============================================================================
|
12
|
+
|
13
|
+
---
|
14
|
+
# Loads some helpful aliases
|
15
|
+
aliases: defaults.yaml
|
16
|
+
# Enables qcow2 checkpoint
|
17
|
+
checkpoint: docker.yaml
|
18
|
+
#== Global variables use by Kameleon engine and the steps
|
19
|
+
global:
|
20
|
+
## User varibales : used by the recipe
|
21
|
+
cachedir: /var/cache/kameleon
|
22
|
+
user_name: kameleon
|
23
|
+
arch: x86_64
|
24
|
+
|
25
|
+
distrib: fedora
|
26
|
+
release: 20
|
27
|
+
docker_image: kameleon-$${distrib}-$$release
|
28
|
+
# DNS servers : opendns
|
29
|
+
docker_dns: 208.67.222.222
|
30
|
+
|
31
|
+
## System variables. Required by kameleon engine
|
32
|
+
# Include specific steps
|
33
|
+
include_steps: [$$distrib/$$release, $$distrib]
|
34
|
+
|
35
|
+
# Shell session from where we launch exec_out commands. There is often a
|
36
|
+
# local bash session, but it can be a remote shell on other machines or on
|
37
|
+
# any shell. (eg. bash, chroot, fakechroot, ssh, tmux, lxc...)
|
38
|
+
out_context:
|
39
|
+
cmd: bash
|
40
|
+
workdir: $$kameleon_cwd
|
41
|
+
|
42
|
+
# Shell session that allows us to connect to the building machine in order to
|
43
|
+
# configure it and setup additional programs
|
44
|
+
ssh_options: -o StrictHostKeyChecking=no -o ForwardAgent=yes
|
45
|
+
ssh_port: $(cat MAIN_CONTAINER_PORT)
|
46
|
+
insecure_ssh_key: insecure_ssh_dsa_key
|
47
|
+
in_context:
|
48
|
+
cmd: LC_ALL=POSIX ssh $$ssh_options localhost -p $$ssh_port -i $$insecure_ssh_key -t /bin/bash
|
49
|
+
workdir: /
|
50
|
+
|
51
|
+
#== Bootstrap the new system and create the 'in_context'
|
52
|
+
bootstrap:
|
53
|
+
- docker_bootstrap:
|
54
|
+
- release: $$release
|
55
|
+
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/bootstrap.tar.gz
|
56
|
+
- dns: $$docker_dns
|
57
|
+
- prepare_docker:
|
58
|
+
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/bootstrap.tar.gz
|
59
|
+
- image: $$docker_image
|
60
|
+
- dns: $$docker_dns
|
61
|
+
- start_docker:
|
62
|
+
- image: $$docker_image
|
63
|
+
- dns: $$docker_dns
|
64
|
+
- hostname: kameleon-$$distrib
|
65
|
+
|
66
|
+
#== Install and configuration steps
|
67
|
+
# WARNING: this part should be independante from the build context (whenever
|
68
|
+
# possible...)
|
69
|
+
setup:
|
70
|
+
# Install
|
71
|
+
- software_install:
|
72
|
+
- packages: >
|
73
|
+
ntp zip unzip rsync sudo less vim bash-completion wget
|
74
|
+
- group_packages: >
|
75
|
+
"Development Tools"
|
76
|
+
- kernel_install
|
77
|
+
# # Configuration
|
78
|
+
# - system_config:
|
79
|
+
# - locales: fr_FR en_US
|
80
|
+
# - lang: fr_FR.UTF-8
|
81
|
+
# - timezone: Europe/Paris
|
82
|
+
# - keyboard_config:
|
83
|
+
# - layout: "fr,us"
|
84
|
+
- create_user:
|
85
|
+
- name: $$user_name
|
86
|
+
- group: admin
|
87
|
+
- password: $$user_name
|
88
|
+
|
89
|
+
#== Export the generated appliance in the format of your choice
|
90
|
+
export:
|
91
|
+
- build_appliance_from_docker:
|
92
|
+
- mountdir: $$kameleon_cwd/rootfs
|
93
|
+
- filename: $$kameleon_recipe_name
|
94
|
+
- filesystem_type: ext4
|
95
|
+
- format: qcow2 # Should be raw, qcow2 or qed format
|
96
|
+
- image_size: 2G
|