Skip to content

Instantly share code, notes, and snippets.

@dnv
Created July 15, 2021 15:19
Show Gist options
  • Save dnv/7e6778870f070b125cd6fade7f98aa33 to your computer and use it in GitHub Desktop.
Save dnv/7e6778870f070b125cd6fade7f98aa33 to your computer and use it in GitHub Desktop.
{
"variables": {
"proxmox_username": "root@pam",
"proxmox_password": "rootpsw",
"proxmox_url": "https://my.server.ip.address:8006/api2/json",
"proxmox_node": "proxmox",
"proxmox_storage_pool": "nvme-vol1",
"proxmox_storage_pool_type": "lvm-thin",
"proxmox_storage_format": "raw",
"proxmox_iso_pool": "local:iso",
"centos_image": "rhel-8.4-x86_64-dvd.iso",
"template_name": "RHEL8-template",
"template_description": "RHEL 8 Template",
"version": ""
},
"builders": [
{
"type": "proxmox",
"username": "{{user `proxmox_username`}}",
"password": "{{user `proxmox_password`}}",
"proxmox_url": "{{ user `proxmox_url`}}",
"insecure_skip_tls_verify": true,
"node": "{{user `proxmox_node`}}",
"os": "l26",
"boot_command": [
"<up><wait><tab> inst.text ip=dhcp inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
],
"network_adapters": [
{
"bridge": "vmbr0",
"model": "virtio"
}
],
"disks": [
{
"type": "scsi",
"disk_size": "40G",
"storage_pool": "{{user `proxmox_storage_pool`}}",
"storage_pool_type": "{{user `proxmox_storage_pool_type`}}",
"format": "{{user `proxmox_storage_format`}}"
}
],
"scsi_controller": "virtio-scsi-single",
"iso_file": "{{user `proxmox_iso_pool`}}/{{user `centos_image`}}",
"boot_wait": "10s",
"cpu_type": "host",
"cores": "2",
"memory": "2048",
"http_directory": "rocky-rhel8/http",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_port": 22,
"ssh_timeout": "15m",
"unmount_iso": true,
"template_name": "{{user `template_name`}}",
"template_description": "{{user `template_description`}}"
}
],
"provisioners": [
{
"type": "ansible",
"playbook_file": "rocky-rhel8/ansible/config.yaml"
},
{
"type": "shell",
"execute_command": "echo 'packer'|{{.Vars}} sudo -S -E bash '{{.Path}}'",
"inline": [
"shred -u /etc/ssh/*_key /etc/ssh/*_key.pub",
"rm -f /var/run/utmp",
"for logs in `find /var/log -type f`; do > $logs; done",
"rm -f /etc/machine-id",
"rm -rf /tmp/* /var/tmp/*",
"rm -rf /root/*ks*",
"unset HISTFILE; rm -rf /home/*/.*history /root/.*history",
"passwd -d packer",
"passwd -l packer",
"sync"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment