Skip to content

Commit

Permalink
Merge pull request #1 from lunarops/update-template/debian-10.9
Browse files Browse the repository at this point in the history
Update Debian 10.9 template
  • Loading branch information
dalekurt committed Jun 10, 2021
2 parents fd588b2 + 062e84a commit 5c7b754
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 56 deletions.
14 changes: 9 additions & 5 deletions alpine-3-amd64-proxmox/alpine-3-amd64-proxmox.json
@@ -1,10 +1,14 @@
{
"description": "Build Alpine Linux 3 x86_64 Proxmox template",
"variables": {
"ansible_verbosity": "{{env `ansible_verbosity`}}",
"proxmox_url": "{{env `proxmox_url`}}",
"proxmox_username": "root@pam",
"proxmox_username": "{{env `proxmox_user`}}",
"proxmox_password": "{{env `proxmox_password`}}",
"proxmox_host": "{{env `proxmox_host`}}",
"proxmox_net_bridge": "{{env `proxmox_net_bridge`}}",
"proxmox_storage_vm": "{{env `proxmox_storage_vm`}}",
"proxmox_storage_iso": "{{env `proxmox_storage_iso`}}",
"iso_filename": "{{env `iso_filename`}}",
"vm_id": "{{env `vm_id`}}",
"vm_name": "alpine3-tmpl",
Expand Down Expand Up @@ -47,22 +51,22 @@
"network_adapters": [
{
"model": "virtio",
"bridge": "vmbr1"
"bridge": "{{user `proxmox_net_bridge`}}"
}
],
"disks": [
{
"type": "sata",
"disk_size": "8G",
"storage_pool": "local",
"storage_pool_type": "directory",
"storage_pool": "{{user `proxmox_storage_vm`}}",
"storage_pool_type": "lvm",
"format": "qcow2"
}
],
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_timeout": "15m",
"iso_file": "local:iso/{{user `iso_filename`}}",
"iso_file": "{{user `proxmox_storage_iso`}}:iso/{{user `iso_filename`}}",
"unmount_iso": true,
"boot_wait": "10s",
"boot_command": [
Expand Down
12 changes: 8 additions & 4 deletions alpine-3-amd64-proxmox/build.conf
@@ -1,8 +1,12 @@
vm_default_user=christian
vm_default_user=lunarops-user
vm_memory=1024
default_vm_id=40000 # default VM ID for Alpine
proxmox_url=https://proxmox.lightinasia.site:8006/api2/json
proxmox_host=proxmox
default_vm_id=100 # default VM ID for Ubuntu
proxmox_url=https://pve0.internal.lunarops.net:8006/api2/json
proxmox_host=pve0
proxmox_user=packer@pve
proxmox_storage_vm=Thin
proxmox_storage_iso=local
proxmox_net_bridge=vmbr0

iso_url=http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-virt-3.11.6-x86_64.iso
iso_sha256_url=http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-virt-3.11.6-x86_64.iso.sha256
Expand Down
18 changes: 14 additions & 4 deletions build.sh
Expand Up @@ -37,13 +37,26 @@ function die_var_unset {
exit 1
}

## check that prerequisites are installed
[[ $(packer --version) ]] || { echo "Please install 'Packer'"; exit 1; }
[[ $(ansible --version) ]] || { echo "Please install 'Ansible'"; exit 1; }
[[ $(j2 --version) ]] || { echo "Please install 'j2cli'"; exit 1; }

## check that data in build_conf is complete
[[ -f $build_conf ]] || { echo "User variables file '$build_conf' not found."; exit 1; }
source $build_conf

[[ -z "$vm_name" ]] && die_var_unset "vm_name"
[[ -z "$vm_default_user" ]] && die_var_unset "vm_default_user"
[[ -z "$vm_memory" ]] && die_var_unset "vm_memory"
[[ -z "$vm_cores" ]] && die_var_unset "vm_cores"
[[ -z "$vm_sockets" ]] && die_var_unset "vm_sockets"
[[ -z "$ssh_username" ]] && die_var_unset "ssh_username"
[[ -z "$proxmox_host" ]] && die_var_unset "proxmox_host"
[[ -z "$proxmox_user" ]] && die_var_unset "proxmox_user"
[[ -z "$proxmox_storage_vm" ]] && die_var_unset "proxmox_storage_vm"
[[ -z "$proxmox_storage_iso" ]] && die_var_unset "proxmox_storage_iso"
[[ -z "$proxmox_net_bridge" ]] && die_var_unset "proxmox_net_bridge"
[[ -z "$default_vm_id" ]] && die_var_unset "default_vm_id"
[[ -z "$iso_url" ]] && die_var_unset "iso_url"
[[ -z "$iso_sha256_url" ]] && die_var_unset "iso_sha256_url"
Expand All @@ -62,10 +75,7 @@ template_name="${PWD##*/}.json"

[[ -f $template_name ]] || { echo "Template (${template_name}) not found."; exit 1; }

## check that prerequisites are installed
[[ $(packer --version) ]] || { echo "Please install 'Packer'"; exit 1; }
[[ $(ansible --version) ]] || { echo "Please install 'Ansible'"; exit 1; }
[[ $(j2 --version) ]] || { echo "Please install 'j2cli'"; exit 1; }


## If passwords are not set in env variable, prompt for them
[[ -z "$proxmox_password" ]] && printf "\n" && read -s -p "Existing PROXMOX Login Password: " proxmox_password && printf "\n"
Expand Down
18 changes: 13 additions & 5 deletions debian-10-amd64-proxmox/build.conf
@@ -1,10 +1,18 @@
vm_default_user=christian
vm_name=tmpl-debian-10.9
vm_default_user=lunarops-user
vm_memory=1024
default_vm_id=12000 # default VM ID for Debian
proxmox_url=https://proxmox.lightinasia.site:8006/api2/json
proxmox_host=proxmox
vm_cores=1
vm_sockets=0
ssh_username=root
default_vm_id=101 # default VM ID for Debian
proxmox_url=https://pve0.internal.lunarops.net:8006/api2/json
proxmox_host=pve0
proxmox_user=packer@pve
proxmox_storage_vm=Thin
proxmox_storage_iso=local
proxmox_net_bridge=vmbr0

# latest version: http://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/
iso_url=http://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/debian-10.4.0-amd64-netinst.iso
iso_url=http://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/debian-10.9.0-amd64-netinst.iso
iso_sha256_url=https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA256SUMS
iso_directory=/var/lib/vz/template/iso
14 changes: 9 additions & 5 deletions debian-10-amd64-proxmox/debian-10-amd64-proxmox.json
@@ -1,10 +1,14 @@
{
"description": "Build Debian 10 (buster) x86_64 Proxmox template",
"variables": {
"ansible_verbosity": "{{env `ansible_verbosity`}}",
"proxmox_url": "{{env `proxmox_url`}}",
"proxmox_username": "root@pam",
"proxmox_username": "{{env `proxmox_user`}}",
"proxmox_password": "{{env `proxmox_password`}}",
"proxmox_host": "{{env `proxmox_host`}}",
"proxmox_net_bridge": "{{env `proxmox_net_bridge`}}",
"proxmox_storage_vm": "{{env `proxmox_storage_vm`}}",
"proxmox_storage_iso": "{{env `proxmox_storage_iso`}}",
"iso_filename": "{{env `iso_filename`}}",
"vm_id": "{{env `vm_id`}}",
"vm_name": "deb10-tmpl",
Expand Down Expand Up @@ -46,22 +50,22 @@
"network_adapters": [
{
"model": "virtio",
"bridge": "vmbr1"
"bridge": "{{user `proxmox_net_bridge`}}"
}
],
"disks": [
{
"type": "scsi",
"disk_size": "8G",
"storage_pool": "local",
"storage_pool_type": "directory",
"storage_pool": "{{user `proxmox_storage_vm`}}",
"storage_pool_type": "lvm",
"format": "qcow2"
}
],
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_timeout": "15m",
"iso_file": "local:iso/{{user `iso_filename`}}",
"iso_file": "{{user `proxmox_storage_iso`}}:iso/{{user `iso_filename`}}",
"unmount_iso": true,
"boot_wait": "10s",
"boot_command": [
Expand Down
12 changes: 8 additions & 4 deletions openbsd-6-amd64-proxmox/build.conf
@@ -1,8 +1,12 @@
vm_default_user=christian
vm_default_user=lunarops-user
vm_memory=1024
default_vm_id=47000 # default VM ID for OpenBSD
proxmox_url=https://proxmox.lightinasia.site:8006/api2/json
proxmox_host=proxmox
default_vm_id=100 # default VM ID for Ubuntu
proxmox_url=https://pve0.internal.lunarops.net:8006/api2/json
proxmox_host=pve0
proxmox_user=packer@pve
proxmox_storage_vm=Thin
proxmox_storage_iso=local
proxmox_net_bridge=vmbr0

iso_url=https://cloudflare.cdn.openbsd.org/pub/OpenBSD/6.6/amd64/install66.iso
iso_sha256_url=https://cloudflare.cdn.openbsd.org/pub/OpenBSD/6.6/amd64/SHA256
Expand Down
13 changes: 8 additions & 5 deletions openbsd-6-amd64-proxmox/openbsd-6-amd64-proxmox.json
@@ -1,10 +1,14 @@
{
"description": "Build OpenBSD 6 x86_64 Proxmox template",
"variables": {
"ansible_verbosity": "{{env `ansible_verbosity`}}",
"proxmox_url": "{{env `proxmox_url`}}",
"proxmox_username": "root@pam",
"proxmox_username": "{{env `proxmox_user`}}",
"proxmox_password": "{{env `proxmox_password`}}",
"proxmox_host": "{{env `proxmox_host`}}",
"proxmox_net_bridge": "{{env `proxmox_net_bridge`}}",
"proxmox_storage_vm": "{{env `proxmox_storage_vm`}}",
"proxmox_storage_iso": "{{env `proxmox_storage_iso`}}",
"iso_filename": "{{env `iso_filename`}}",
"vm_id": "{{env `vm_id`}}",
"vm_name": "openbsd6-tmpl",
Expand All @@ -13,7 +17,6 @@
"vm_memory": "{{env `vm_memory`}}",
"ssh_username": "root",
"ssh_password": "{{env `ssh_password`}}",
"ansible_verbosity":"{{env `ansible_verbosity`}}"
},
"sensitive-variables": ["proxmox_password", "ssh_password" ],
"provisioners": [
Expand Down Expand Up @@ -48,15 +51,15 @@
"network_adapters": [
{
"model": "virtio",
"bridge": "vmbr1"
"bridge": "{{user `proxmox_net_bridge`}}"
}
],
"disks": [
{
"type": "scsi",
"disk_size": "8G",
"storage_pool": "local",
"storage_pool_type": "directory",
"storage_pool": "{{user `proxmox_storage_vm`}}",
"storage_pool_type": "lvm",
"format": "qcow2"
}
],
Expand Down
12 changes: 8 additions & 4 deletions ubuntu-18.04-amd64-proxmox/build.conf
@@ -1,8 +1,12 @@
vm_default_user=christian
vm_default_user=lunarops-user
vm_memory=1024
default_vm_id=20000 # default VM ID for Ubuntu
proxmox_url=https://proxmox.lightinasia.site:8006/api2/json
proxmox_host=proxmox
default_vm_id=100 # default VM ID for Ubuntu
proxmox_url=https://pve0.internal.lunarops.net:8006/api2/json
proxmox_host=pve0
proxmox_user=packer@pve
proxmox_storage_vm=Thin
proxmox_storage_iso=local
proxmox_net_bridge=vmbr0

iso_url=http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-server-amd64.iso
iso_sha256_url=http://cdimage.ubuntu.com/releases/18.04.4/release/SHA256SUMS
Expand Down
12 changes: 8 additions & 4 deletions ubuntu-18.04-amd64-proxmox/ubuntu-18.04-amd64-proxmox.json
@@ -1,10 +1,14 @@
{
"description": "Build Ubuntu 18.04 (bionic) x86_64 Proxmox template",
"variables": {
"ansible_verbosity": "{{env `ansible_verbosity`}}",
"proxmox_url": "{{env `proxmox_url`}}",
"proxmox_username": "root@pam",
"proxmox_username": "{{env `proxmox_user`}}",
"proxmox_password": "{{env `proxmox_password`}}",
"proxmox_host": "{{env `proxmox_host`}}",
"proxmox_net_bridge": "{{env `proxmox_net_bridge`}}",
"proxmox_storage_vm": "{{env `proxmox_storage_vm`}}",
"proxmox_storage_iso": "{{env `proxmox_storage_iso`}}",
"iso_filename": "{{env `iso_filename`}}",
"vm_id": "{{env `vm_id`}}",
"vm_name": "ubuntu1804-tmpl",
Expand Down Expand Up @@ -47,15 +51,15 @@
"network_adapters": [
{
"model": "virtio",
"bridge": "vmbr1"
"bridge": "{{user `proxmox_net_bridge`}}"
}
],
"disks": [
{
"type": "scsi",
"disk_size": "8G",
"storage_pool": "local",
"storage_pool_type": "directory",
"storage_pool": "{{user `proxmox_storage_vm`}}",
"storage_pool_type": "lvm",
"format": "qcow2"
}
],
Expand Down
18 changes: 13 additions & 5 deletions ubuntu-20.04-amd64-proxmox/build.conf
@@ -1,9 +1,17 @@
vm_default_user=christian
vm_name=tmpl-ubuntu-20.04
vm_default_user=lunarops-user
vm_memory=1024
default_vm_id=21000 # default VM ID for Ubuntu
proxmox_url=https://proxmox.lightinasia.site:8006/api2/json
proxmox_host=proxmox
vm_cores=1
vm_sockets=0
ssh_username=root
default_vm_id=100 # default VM ID for Ubuntu
proxmox_url=https://pve0.internal.lunarops.net:8006/api2/json
proxmox_host=pve0
proxmox_user=packer@pve
proxmox_storage_vm=Thin
proxmox_storage_iso=local
proxmox_net_bridge=vmbr0

iso_url=http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/ubuntu-20.04-legacy-server-amd64.iso
iso_url=http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/ubuntu-20.04.1-legacy-server-amd64.iso
iso_sha256_url=http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/SHA256SUMS
iso_directory=/var/lib/vz/template/iso
2 changes: 1 addition & 1 deletion ubuntu-20.04-amd64-proxmox/playbook/requirements.yml
@@ -1,2 +1,2 @@
- src: https://github.com/chriswayg/ansible-initial-server.git
- src: https://github.com/lunarops/ansible-initial-server.git
#version: v1.7
5 changes: 3 additions & 2 deletions ubuntu-20.04-amd64-proxmox/playbook/server-template-vars.yml
@@ -1,7 +1,8 @@
---

iserver_hostname: ubuntu2004-kvm
iserver_sshkey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDK1zNq5zsVbbN/gLdYqxlb5CROsR1dBNBgRFzzCJUL3ncU2dDHLHWi0L/FafwWt6MQ7vePu7catLDegY2fs1QB0KYvy21fD3+9ONBs7KcFlmuyqjLJ9VAoLWW5Tv3I9eZNgpd9k6CvYphKa1Owq43ye+quQRI4J+2nb7Zhl2WTQ1N2WBwZbmf0ErTHwa+mC7frTRBYh6ddyXp9KRULH89y/6cVpL6uQyFzIr6yWowUbJ8lX3fA9e7RAxkG76X54sMa65oq3Bog04ylJ4n/xZCXO449BZjAZHcJuDcFLXrwIo52t+Q6gIEnXInTiii26/ZWbnzzheggjkpQ77tCg03t christian@Chris-GigaMac.local"
iserver_hostname: ubuntu
iserver_sshkey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDvmo1mPwxdRCw6f76w/Mkxm4WK4ulsgFpSPJxuvBmKZb8ls9vUAO4vUaFSa+e8eFFqnKZUepOOJc2mLDYBBI1n7CRZuGvuS0YMnNzGgE8TpX8rQ3GHAJMdU5nv6PPs9rZcqPI3l7piXHlvngnETWhY5PrJcmXEyysvnaIv2wTb2J7084OUC2eelxpqLwkZg4iQlJc0CNO/km/onme4LgEooBi7c7hXfIbeMrHVQa66dorri6cH79GmV6DPljiWR7ELgIydbsD/b7WnVaQozjYZxvhgJ11ki5Pc7V3+1PocjLkd5rUnxpO4lI6EoEUXMTZL299VUDQyQOVOYoCEtjbfb2HSmLSsIWv7x4amtYkaJ9DP+ij8mMiMXB0JEpNF3bfzzCZVcDYt3piTpIBYC6sHaX3JddzZZqM8PxOAVkI1D/d/qMfZbFd2QQI15ozG6wYAVW4KFbe8I+GR1/aLPKx30rqZsfcqEi7Phk32gyu5btLwrQdyIz9ib3+ZsgGbZL0= lunarops-user@lunarops.io
"

iserver_ubuntu_repos:
- deb http://repo.myloc.de/ubuntu/ focal main restricted universe multiverse
Expand Down
23 changes: 15 additions & 8 deletions ubuntu-20.04-amd64-proxmox/ubuntu-20.04-amd64-proxmox.json
@@ -1,17 +1,23 @@
{
"description": "Build Ubuntu 20.04 (focal) x86_64 Proxmox template",
"variables": {
"ansible_verbosity": "{{env `ansible_verbosity`}}",
"proxmox_url": "{{env `proxmox_url`}}",
"proxmox_username": "root@pam",
"proxmox_username": "{{env `proxmox_user`}}",
"proxmox_password": "{{env `proxmox_password`}}",
"proxmox_host": "{{env `proxmox_host`}}",
"proxmox_net_bridge": "{{env `proxmox_net_bridge`}}",
"proxmox_storage_vm": "{{env `proxmox_storage_vm`}}",
"proxmox_storage_iso": "{{env `proxmox_storage_iso`}}",
"iso_filename": "{{env `iso_filename`}}",
"vm_id": "{{env `vm_id`}}",
"vm_name": "ubuntu2004-tmpl",
"vm_name": "{{env `vm_name`}}",
"template_description": "Ubuntu 20.04 x86_64 template built with packer ({{env `vm_ver`}}). Username: {{env `vm_default_user`}}",
"vm_default_user": "{{env `vm_default_user`}}",
"vm_memory": "{{env `vm_memory`}}",
"ssh_username": "root",
"vm_cores": "{{env `vm_cores`}}",
"vm_sockets": "{{env `vm_sockets`}}",
"ssh_username": "{{env `ssh_username`}}",
"ssh_password": "{{env `ssh_password`}}"
},
"sensitive-variables": ["proxmox_password", "ssh_password" ],
Expand Down Expand Up @@ -39,30 +45,31 @@
"vm_name": "{{user `vm_name`}}",
"template_description":"{{user `template_description`}}",
"memory": "{{user `vm_memory`}}",
"cores": "2",
"cores": "{{user `vm_cores`}}",
"sockets": "{{user `vm_sockets`}}",
"os": "l26",
"http_directory": "http",

"node": "{{user `proxmox_host`}}",
"network_adapters": [
{
"model": "virtio",
"bridge": "vmbr1"
"bridge": "{{user `proxmox_net_bridge`}}"
}
],
"disks": [
{
"type": "scsi",
"disk_size": "8G",
"storage_pool": "local",
"storage_pool_type": "directory",
"storage_pool": "{{user `proxmox_storage_vm`}}",
"storage_pool_type": "lvm",
"format": "qcow2"
}
],
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_timeout": "15m",
"iso_file": "local:iso/{{user `iso_filename`}}",
"iso_file": "{{user `proxmox_storage_iso`}}:iso/{{user `iso_filename`}}",
"unmount_iso": true,
"boot_wait": "10s",
"boot_command": [
Expand Down

0 comments on commit 5c7b754

Please sign in to comment.