Skip to content

Commit

Permalink
Feature/proxmox (rancher#583)
Browse files Browse the repository at this point in the history
* proxmox vagrant template
  • Loading branch information
bemanuel authored Sep 28, 2020
1 parent 06c9f77 commit 762a288
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
13 changes: 13 additions & 0 deletions package/packer/proxmox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# k3os on Proxmox VE

## Quick Start

1. Build Proxmox VE image using [Packer](https://www.packer.io/):

```
packer build -var-file=vars.json template.json
```

## Notes

Can define IP and other parameter on config/cloud.yml, according to [Configuration Reference](https://github.com/rancher/k3os/blob/master/README.md#configuration-reference)
19 changes: 19 additions & 0 deletions package/packer/proxmox/config/cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
write_files:
- path: /etc/ssh/sshd_config
content: |
AllowTcpForwarding no
GatewayPorts no
PasswordAuthentication yes # necessary for access from packer build
X11Forwarding no
PermitRootLogin no
LoginGraceTime 30s
MaxAuthTries 5
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
MACs [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,[email protected]
KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256
Subsystem sftp internal-sftp
k3os:
datasource: cdrom
password: YourSSHPasswordReplaceIt
74 changes: 74 additions & 0 deletions package/packer/proxmox/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"builders": [
{

"insecure_skip_tls_verify": "true",
"node": "{{user `pve_node`}}",
"proxmox_url": "https://{{user `pve_server`}}:8006/api2/json",
"password": "{{user `pve_password`}}",
"username": "{{user `pve_username`}}",

"cores": 2,
"memory": 2048,
"boot_command": [
"rancher",
"<enter>",
"sudo k3os install",
"<enter>",
"1",
"<enter>",
"2",
"<enter>",
"Y",
"<enter>",
"http://{{ .HTTPIP }}:{{ .HTTPPort }}/cloud.yml",
"<enter>",
"Y",
"<enter>"
],
"boot_wait": "50s",
"cloud_init": "false",
"disks": [
{
"type": "virtio",
"disk_size": "8G",
"storage_pool": "{{user `vm-disk-pool`}}",
"storage_pool_type": "rbd"
}
],
"http_directory": "config",
"iso_url": "{{user `iso-url`}}",
"iso_checksum": "{{user `iso-checksum-type`}}:{{user `iso-checksum`}}",
"iso_storage_pool": "{{user `iso-storage-pool`}}",
"network_adapters": [
{
"model": "virtio",
"bridge": "{{user `network-vlan`}}",
"firewall": true
}
],
"os": "l26",
"qemu_agent": "true",
"ssh_password": "{{user `ssh_password`}}",
"ssh_username": "{{user `ssh_username`}}",
"template_name": "{{user `template_name`}}",
"template_description": "Template Server K3Os v011",
"type": "proxmox",
"unmount_iso": true,
"vga": {
"type": "qxl"
},
"vm_name": "{{user `template_name`}}"
}
],
"provisioners": [
{
"execute_command": "{{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [
"echo hello world"
],
"type": "shell"
}
]
}

22 changes: 22 additions & 0 deletions package/packer/proxmox/vars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"template_name":"k3os-cloud",
"pve_server":"{{env `pve_server`}}",
"pve_username":"{{env `pve_username`}}",
"pve_password":"{{env `pve_password`}}",
"pve_node":"{{env `pve_node`}}",

"network-vlan": "{{env `network_vlan`}}",

"vm-cpu-num": "1",
"vm-mem-size": "2048",
"vm-disk-size": "8G",
"vm-disk-pool": "{{env `vm_disk_pool`}}",

"ssh_username": "{{env `ssh_username`}}",
"ssh_password": "{{env `ssh_password`}}",

"iso-url": "{{env `iso_url`}}",
"iso-storage-pool": "{{env `iso_storage_pool`}}",
"iso-checksum": "{{env `iso_checksum`}}",
"iso-checksum-type": "{{env `iso_checksum_type`}}"
}

0 comments on commit 762a288

Please sign in to comment.