Skip to content

Instantly share code, notes, and snippets.

@carlpett
Last active July 13, 2019 10:51
Show Gist options
  • Save carlpett/de9c4b5aabdaed109f2b0828f54a4ef0 to your computer and use it in GitHub Desktop.
Save carlpett/de9c4b5aabdaed109f2b0828f54a4ef0 to your computer and use it in GitHub Desktop.
{
"variables": {
"username": "apiuser@pve",
"password": "secret",
"proxmox_host": "my-prox"
},
"builders": [
{
"type": "proxmox",
"proxmox_url": "https://{{user `proxmox_host`}}:8006/api2/json",
"insecure_skip_tls_verify": true,
"username": "{{user `username`}}",
"password": "{{user `password`}}",
"node": "{{user `proxmox_host`}}",
"vm_id": "1005",
"memory": 1024,
"cores": 2,
"network_adapters": [
{
"model": "virtio",
"bridge": "vmbr2",
"vlan_tag": "10"
}
],
"disks": [
{
"type": "scsi",
"disk_size": "5G",
"storage_pool": "local-lvm",
"storage_pool_type": "lvm"
}
],
"iso_file": "local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso",
"http_directory":"./kickstart",
"boot_wait": "10s",
"boot_command": [
"<up><tab> ip=dhcp inst.cmdline inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg<enter>"
],
"ssh_username": "root",
"ssh_timeout": "15m",
"ssh_password": "packer",
"unmount_iso": true,
"template_name": "fedora-29",
"template_description": "Fedora 29-1.2, generated on {{ isotime \"2006-01-02T15:04:05Z\" }}"
}
]
}
install
cmdline
skipx
bootloader
firewall --enabled --ssh
firstboot --disabled
lang en_US.UTF-8
keyboard se
timezone --utc Europe/Stockholm
zerombr
clearpart --all --initlabel
part / --size=3000 --grow
rootpw packer
reboot
%packages
-@hardware-support
-@networkmanager-submodules
qemu-guest-agent
%end
%post
systemctl enable qemu-guest-agent
%end
@vikas027
Copy link

Here are my files, fedora works fine but not sure what is wrong with CentOS installation.

root@box78:~/test# tree
.
├── centos.json
├── fedora.json
└── kickstart
    ├── ks_centos.cfg
    └── ks_fedora.cfg

1 directory, 4 files
root@box78:~/test# 
root@box78:~/test# cat centos.json 
{
  "variables": {
    "username": "root@pam",
    "password": "secret"
  },
  "builders": [
    {
      "type": "proxmox",
      "proxmox_url": "https://192.168.0.28:8006/api2/json",
      "insecure_skip_tls_verify": true,
      "username": "{{user `username`}}",
      "password": "{{user `password`}}",
      "node": "proxmox",
      "vm_id": "2500",
      "memory": 2500,
      "cores": 2,
      "network_adapters": [
        {
          "bridge": "vmbr0"
        }
      ],
      "disks": [
        {
          "type": "scsi",
          "disk_size": "15G",
          "storage_pool": "local-lvm",
          "storage_pool_type": "lvm"
        }
      ],
      "iso_file": "local:iso/CentOS-7-x86_64-DVD-1810.iso",
      "http_directory": "./kickstart",
      "boot_wait": "10s",
      "boot_command": [
        "<up><tab> ip=dhcp inst.cmdline inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks_centos.cfg<enter>"
      ],
      "ssh_username": "root",
      "ssh_timeout": "15m",
      "ssh_password": "packer",
      "unmount_iso": true,
      "template_name": "centos-64",
      "template_description": "CentOS 7.6, generated on {{ isotime \"2006-01-02T15:04:05Z\" }}"
    }
  ]
}

root@box78:~/test# 
root@box78:~/test# cat kickstart/ks_centos.cfg 
install

cmdline
skipx
bootloader

firewall --enabled --ssh
firstboot --disabled

lang en_US.UTF-8
keyboard se
timezone --utc Europe/Stockholm

zerombr
clearpart --all --initlabel
part / --size=3000 --grow

rootpw packer

reboot

%packages
@Base
@Core
%end

%post
systemctl enable qemu-guest-agent
%end

root@box78:~/test# 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment