Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos.package
Commits
2f9bead0
Commit
2f9bead0
authored
Jun 08, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: add ubuntu-16.04-server template, fix boot issue on ubuntu-16.xx images
parent
626d9eb4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
10 deletions
+131
-10
packer/build-vm-bootstrap.yml
packer/build-vm-bootstrap.yml
+23
-0
packer/http/preseed-ubuntu.cfg
packer/http/preseed-ubuntu.cfg
+1
-1
packer/http/preseed-ubuntu16.04.cfg
packer/http/preseed-ubuntu16.04.cfg
+13
-0
packer/scripts/grub-ubuntu.sh
packer/scripts/grub-ubuntu.sh
+9
-0
packer/ubuntu-16.04-server-amd64.json
packer/ubuntu-16.04-server-amd64.json
+76
-0
packer/ubuntu-16.10-server-amd64.json
packer/ubuntu-16.10-server-amd64.json
+9
-9
No files found.
packer/build-vm-bootstrap.yml
View file @
2f9bead0
...
...
@@ -37,6 +37,14 @@
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
script
:
"
scripts/vm-bootstrap.sh"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
script
:
"
scripts/vm-bootstrap.sh"
}
-
shell
:
PATH=$PATH:/opt/packer/ packer build -var 'disk_size={{ item.size }}' -var 'name={{ item.name }}' -var 'custom_script={{ item.script }}' ubuntu-16.04-server-amd64.json >> log/ubuntu-16.04-server-amd64-{{ item.name }}.log
args
:
creates
:
output-ubuntu-16.04-server-{{ item.size }}G-{{ item.name }}
with_items
:
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
script
:
"
scripts/vm-bootstrap.sh"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
script
:
"
scripts/vm-bootstrap.sh"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
script
:
"
scripts/vm-bootstrap.sh"
}
-
shell
:
PATH=$PATH:/opt/packer/ packer build -var 'disk_size={{ item.size }}' -var 'name={{ item.name }}' -var 'custom_script={{ item.script }}' ubuntu-16.10-server-amd64.json >> log/ubuntu-16-server-amd64-{{ item.name }}.log
args
:
creates
:
output-ubuntu-16-server-{{ item.size }}G-{{ item.name }}
...
...
@@ -91,6 +99,15 @@
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
}
ignore_errors
:
True
-
shell
:
gzip output-ubuntu-16.04-server-{{ item.size }}G-{{ item.name }}/packer-ubuntu-16.04-server-{{ item.size }}G-{{ item.name }}
args
:
creates
:
output-ubuntu-16.04-server-{{ item.size }}G-{{ item.name }}/packer-ubuntu-16.04-server-{{ item.size }}G-{{ item.name }}.gz
with_items
:
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
}
ignore_errors
:
True
-
shell
:
gzip output-ubuntu-16-server-{{ item.size }}G-{{ item.name }}/packer-ubuntu-16-server-{{ item.size }}G-{{ item.name }}
args
:
creates
:
output-ubuntu-16-server-{{ item.size }}G-{{ item.name }}/packer-ubuntu-16-server-{{ item.size }}G-{{ item.name }}.gz
...
...
@@ -143,6 +160,9 @@
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
ubuntu-14-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
ubuntu-14-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
ubuntu-14-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
ubuntu-16.04-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
ubuntu-16.04-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
ubuntu-16.04-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
ubuntu-16-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
ubuntu-16-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
ubuntu-16-server"
}
...
...
@@ -176,6 +196,9 @@
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
ubuntu-14-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
ubuntu-14-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
ubuntu-14-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
ubuntu-16.04-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
ubuntu-16.04-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
ubuntu-16.04-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
ubuntu-16-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
ubuntu-16-server"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
ubuntu-16-server"
}
...
...
packer/http/preseed-ubuntu.cfg
View file @
2f9bead0
...
...
@@ -17,7 +17,7 @@ d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_write_new_label boolean true
d-i pkgsel/include string openssh-server
d-i pkgsel/include string openssh-server
sudo curl vim
d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select unattended-upgrades
d-i pkgsel/upgrade select none
...
...
packer/http/preseed-ubuntu16.04.cfg
0 → 100644
View file @
2f9bead0
d-i preseed/include string ../preseed-ubuntu.cfg
d-i preseed/early_command string \
mkdir -p /usr/lib/post-base-installer.d && \
echo "sed -i -e 's/^in-target.*tasksel.*/#\\0/' /var/lib/dpkg/info/pkgsel.postinst" > /usr/lib/post-base-installer.d/90skip-tasksel && \
chmod +x /usr/lib/post-base-installer.d/90skip-tasksel
d-i preseed/late_command string \
echo 'Defaults:slapos !requiretty' > /target/etc/sudoers.d/slapos; \
echo 'slapos ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/slapos; \
chmod 440 /target/etc/sudoers.d/slapos ; \
ln -sf /dev/null /target/etc/systemd/network/99-default.link; \
in-target update-initramfs -u
packer/scripts/grub-ubuntu.sh
0 → 100644
View file @
2f9bead0
# Show grub on boot
sed
-i
's/GRUB_HIDDEN_TIMEOUT/#GRUB_HIDDEN_TIMEOUT/'
/etc/default/grub
# prevent graphic card failure to block boot
sed
-i
's#GRUB_CMDLINE_LINUX_DEFAULT=.*#GRUB_CMDLINE_LINUX_DEFAULT=""#'
/etc/default/grub
# reduce grub timeout
sed
-i
's#GRUB_TIMEOUT=.*#GRUB_TIMEOUT=5#'
/etc/default/grub
update-grub
packer/ubuntu-16.04-server-amd64.json
0 → 100644
View file @
2f9bead0
{
"variables"
:
{
"user"
:
"slapos"
,
"password"
:
"slapos"
,
"domain"
:
""
,
"disk_size"
:
"100"
,
"name"
:
"image"
,
"custom_script"
:
"scripts/empty.sh"
},
"builders"
:
[
{
"name"
:
"ubuntu-16.04-server-{{ user `disk_size`}}G-{{ user `name`}}"
,
"type"
:
"qemu"
,
"format"
:
"qcow2"
,
"accelerator"
:
"kvm"
,
"disk_size"
:
"{{ user `disk_size`}}000"
,
"headless"
:
true
,
"iso_url"
:
"http://releases.ubuntu.com/16.04/ubuntu-16.04.2-server-amd64.iso"
,
"iso_checksum"
:
"2bce60d18248df9980612619ff0b34e6"
,
"iso_checksum_type"
:
"md5"
,
"http_directory"
:
"http"
,
"ssh_username"
:
"{{user `user`}}"
,
"ssh_password"
:
"{{user `password`}}"
,
"ssh_wait_timeout"
:
"1800s"
,
"shutdown_command"
:
"sudo systemctl poweroff"
,
"boot_wait"
:
"3s"
,
"boot_command"
:
[
"<enter><wait>"
,
"<f6><esc>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>"
,
"<bs><bs><bs>"
,
"/install/vmlinuz "
,
"initrd=/install/initrd.gz "
,
"hostname={{ .Name }} "
,
"net.ifnames=0 "
,
"auto-install/enable=true "
,
"debconf/priority=critical "
,
"passwd/user-fullname={{user `user`}} "
,
"passwd/user-password-again={{user `password`}} "
,
"passwd/user-password={{user `password`}} "
,
"passwd/username={{user `user`}} "
,
"noapic "
,
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-ubuntu16.04.cfg "
,
"<enter>"
]
}
],
"provisioners"
:
[
{
"type"
:
"shell"
,
"execute_command"
:
"echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
,
"scripts"
:
[
"scripts/update-ubuntu.sh"
,
"scripts/packages-ubuntu.sh"
,
"scripts/grub-ubuntu.sh"
,
"{{ user `custom_script` }}"
]
}
]
}
packer/ubuntu-16.10-server-amd64.json
View file @
2f9bead0
...
...
@@ -33,19 +33,19 @@
"boot_wait"
:
"2s"
,
"boot_command"
:
[
"<esc><esc><enter><wait>"
,
"/install/vmlinuz
url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-ubuntu.cfg
"
,
"
debian-installer=en_US auto locale=en_US kbd-chooser/method=fr
"
,
"/install/vmlinuz "
,
"
initrd=/install/initrd.gz
"
,
"hostname={{ .Name }} "
,
"keyboard-configuration/modelcode=pc101 "
,
"keyboard-configuration/layoutcode=fr "
,
"net.ifnames=0 "
,
"auto-install/enable=true "
,
"debconf/priority=critical "
,
"passwd/user-fullname={{user `user`}} "
,
"passwd/user-password-again={{user `password`}} "
,
"passwd/user-password={{user `password`}} "
,
"passwd/username={{user `user`}} "
,
"initrd=/install/initrd.gz -- <enter>"
"noapic "
,
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-ubuntu16.04.cfg "
,
"-- <enter>"
]
}
],
...
...
@@ -57,7 +57,7 @@
"scripts"
:
[
"scripts/update-ubuntu.sh"
,
"scripts/packages-ubuntu.sh"
,
"scripts/
network
-ubuntu.sh"
,
"scripts/
grub
-ubuntu.sh"
,
"{{ user `custom_script` }}"
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment