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
Carlos Ramos Carreño
slapos.package
Commits
8816acf5
Commit
8816acf5
authored
Feb 15, 2024
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create debian12 images automatically
parent
280a4dfc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
5 deletions
+68
-5
packer/README.md
packer/README.md
+3
-3
packer/README.vmboostrap.md
packer/README.vmboostrap.md
+3
-2
packer/build-vm-bootstrap.yml
packer/build-vm-bootstrap.yml
+7
-0
packer/debian12.json
packer/debian12.json
+55
-0
No files found.
packer/README.md
View file @
8816acf5
...
...
@@ -14,12 +14,12 @@ How to build one VM?
mkdir /opt/packer/
cd /opt/packer/
wget https://releases.hashicorp.com/packer/1.7.6/packer_1.7.6_linux_amd64.zip
unzip packer_1.7.6_linux_amd64.zip
wget https://releases.hashicorp.com/packer/1.10.1/packer_1.10.1_linux_amd64.zip
unzip packer_1.10.1_linux_amd64.zip
PATH=/opt/packer:$PATH packer plugins install github.com/hashicorp/qemu
2) Building one VM (example)::
PATH=$PATH:/opt/packer packer build debian8.json
3) You can watch qemu working on a linux machine (with X running), you just
...
...
packer/README.vmboostrap.md
View file @
8816acf5
...
...
@@ -12,8 +12,9 @@ How to build VM with differents images size?
mkdir /opt/packer/
cd /opt/packer/
wget https://releases.hashicorp.com/packer/1.7.6/packer_1.7.6_linux_amd64.zip
unzip packer_1.7.6_linux_amd64.zip
wget https://releases.hashicorp.com/packer/1.10.1/packer_1.10.1_linux_amd64.zip
unzip packer_1.10.1_linux_amd64.zip
PATH=/opt/packer:$PATH packer plugins install github.com/hashicorp/qemu
2) Check and install qemu
...
...
packer/build-vm-bootstrap.yml
View file @
8816acf5
...
...
@@ -39,6 +39,12 @@
-
{
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 }}' debian12.json >> log/debian11-{{ item.name }}.log
args
:
creates
:
output-debian12-{{ item.size }}G-{{ item.name }}
with_items
:
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
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-18.04-server-amd64.json >> log/ubuntu-18.04-server-amd64-{{ item.name }}.log
args
:
...
...
@@ -176,6 +182,7 @@
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
debian11"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
debian11"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
debian11"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
debian12"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
200"
,
distro
:
"
centos7"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
50"
,
distro
:
"
centos7"
}
-
{
name
:
"
vm-bootstrap"
,
size
:
"
25"
,
distro
:
"
centos7"
}
...
...
packer/debian12.json
0 → 100644
View file @
8816acf5
{
"builders"
:
[
{
"accelerator"
:
"kvm"
,
"boot_command"
:
[
"<esc><wait><wait><wait><wait>"
,
"auto preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-debian12.cfg "
,
"debian-installer=en_US.UTF-8 locale=en_US keymap=fr "
,
"netcfg/get_hostname={{ .Name }} "
,
"netcfg/get_domain={{ user `domain`}} "
,
"fb=false debconf/frontend=noninteractive "
,
"passwd/user-fullname={{user `user`}} "
,
"passwd/user-password={{user `password`}} "
,
"passwd/user-password-again={{user `password`}} "
,
"passwd/username={{user `user`}} "
,
"<enter>"
],
"boot_wait"
:
"5s"
,
"disk_size"
:
"{{ user `disk_size`}}000"
,
"format"
:
"qcow2"
,
"headless"
:
true
,
"http_directory"
:
"http"
,
"iso_checksum"
:
"sha256:013f5b44670d81280b5b1bc02455842b250df2f0c6763398feb69af1a805a14f"
,
"iso_url"
:
"https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso"
,
"name"
:
"debian12-{{ user `disk_size`}}G-{{ user `name`}}"
,
"shutdown_command"
:
"echo '{{user `password`}}'|sudo -S shutdown -h now"
,
"ssh_password"
:
"{{user `password`}}"
,
"ssh_timeout"
:
"3600s"
,
"ssh_username"
:
"{{user `user`}}"
,
"type"
:
"qemu"
}
],
"provisioners"
:
[
{
"execute_command"
:
"echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
,
"scripts"
:
[
"scripts/update.sh"
,
"scripts/packages.sh"
,
"scripts/network-debian.sh"
,
"scripts/cleanup.sh"
,
"{{ user `custom_script` }}"
],
"type"
:
"shell"
}
],
"variables"
:
{
"custom_script"
:
"scripts/empty.sh"
,
"disk_size"
:
"100"
,
"domain"
:
""
,
"name"
:
"image"
,
"password"
:
"slapos"
,
"user"
:
"slapos"
}
}
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