Commit fdebd6b1 authored by Alain Takoudjou's avatar Alain Takoudjou

packer: add debian9 image

parent 043ad231
......@@ -29,6 +29,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 }}' debian9.json >> log/debian9-{{ item.name }}.log
args:
creates: output-debian9-{{ 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-14.04-server-amd64.json >> log/ubuntu-14-server-amd64-{{ item.name }}.log
args:
creates: output-ubuntu-14-server-{{ item.size }}G-{{ item.name }}
......@@ -90,6 +98,15 @@
- { name: "vm-bootstrap", size: "25"}
ignore_errors: True
- shell: gzip output-debian9-{{ item.size }}G-{{ item.name }}/packer-debian9-{{ item.size }}G-{{ item.name }}
args:
creates: output-debian9-{{ item.size }}G-{{ item.name }}/packer-debian9-{{ 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-14-server-{{ item.size }}G-{{ item.name }}/packer-ubuntu-14-server-{{ item.size }}G-{{ item.name }}
args:
creates: output-ubuntu-14-server-{{ item.size }}G-{{ item.name }}/packer-ubuntu-14-server-{{ item.size }}G-{{ item.name }}.gz
......@@ -151,6 +168,9 @@
- { name: "vm-bootstrap", size: "200", distro: "debian7"}
- { name: "vm-bootstrap", size: "50", distro: "debian7"}
- { name: "vm-bootstrap", size: "25", distro: "debian7"}
- { name: "vm-bootstrap", size: "200", distro: "debian9"}
- { name: "vm-bootstrap", size: "50", distro: "debian9"}
- { name: "vm-bootstrap", size: "25", distro: "debian9"}
- { name: "vm-bootstrap", size: "200", distro: "centos7.2"}
- { name: "vm-bootstrap", size: "50", distro: "centos7.2"}
- { name: "vm-bootstrap", size: "25", distro: "centos7.2"}
......@@ -187,6 +207,9 @@
- { name: "vm-bootstrap", size: "200", distro: "debian7"}
- { name: "vm-bootstrap", size: "50", distro: "debian7"}
- { name: "vm-bootstrap", size: "25", distro: "debian7"}
- { name: "vm-bootstrap", size: "200", distro: "debian9"}
- { name: "vm-bootstrap", size: "50", distro: "debian9"}
- { name: "vm-bootstrap", size: "25", distro: "debian9"}
- { name: "vm-bootstrap", size: "200", distro: "centos7.2"}
- { name: "vm-bootstrap", size: "50", distro: "centos7.2"}
- { name: "vm-bootstrap", size: "25", distro: "centos7.2"}
......
{
"variables": {
"user": "slapos",
"password": "slapos",
"domain": "",
"disk_size": "100",
"name": "image",
"custom_script": "scripts/empty.sh"
},
"builders":
[
{
"name": "debian9-{{ user `disk_size`}}G-{{ user `name`}}",
"type": "qemu",
"format": "qcow2",
"accelerator": "kvm",
"disk_size": "{{ user `disk_size`}}000",
"iso_url": "http://cdimage.debian.org/debian-cd/9.2.1/amd64/iso-cd/debian-9.2.1-amd64-netinst.iso",
"iso_checksum": "5c583fd40360fd039b3ac98387b77dbb",
"iso_checksum_type": "md5",
"http_directory": "http",
"ssh_username": "{{user `user`}}",
"ssh_password": "{{user `password`}}",
"ssh_wait_timeout": "1800s",
"shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -h now",
"headless": true,
"boot_wait": "2s",
"boot_command": [
"<esc><wait><wait>",
"install auto ",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-debian9.cfg ",
"debian-installer=en_US 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>"
]
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"scripts/update.sh",
"scripts/packages.sh",
"scripts/network-debian9.sh",
"scripts/cleanup.sh",
"{{ user `custom_script` }}"
]
}
]
}
d-i preseed/include string ../preseed-debian8.cfg
choose-mirror-bin mirror/http/proxy string
d-i apt-setup/use_mirror boolean true
d-i pkgsel/include string sudo aptitude openssh-server wget vim
apt-cdrom-setup apt-setup/cdrom/set-first boolean false
apt-mirror-setup apt-setup/use_mirror boolean true
popularity-contest popularity-contest/participate boolean false
tasksel tasksel/first multiselect standard, ssh-server
#!/bin/sh
# provide ifconfig command
apt-get install -y net-tools
# change default interface name to eth0 schema
sed -i 's#GRUB_CMDLINE_LINUX=.*#GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"#' /etc/default/grub
update-grub
sed -i 's#allow-hotplug ens3.*#allow-hotplug eth0#' /etc/network/interfaces
sed -i 's#iface ens3 inet dhcp.*#iface eth0 inet dhcp#' /etc/network/interfaces
# If aptitude is not present
apt-get install -y aptitude
# Update the box
aptitude -y update
aptitude -y full-upgrade
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment