Skip to content

Commit baa55fa

Browse files
committed
Converted from json-hcl. Added rhel/rocky9
0 parents  commit baa55fa

33 files changed

+908
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#not ready
2+
centos

RHEL/.DS_Store

6 KB
Binary file not shown.

RHEL/rhel8/auto.pkrvars.hcl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### Proxmox Node ###
2+
proxmox_node = "node"
3+
proxmox_url = "https://192.1.1.1:8006/api2/json"
4+
proxmox_username = "username@pam"
5+
proxmox_password = "password"
6+
7+
### iso Config ###
8+
iso_file = "local:iso/rhel-8.5-x86_64-dvd.iso"
9+
boot_command = ["<esc><wait>", "vmlinuz initrd=initrd.img inst.geoloc=0 rd.driver.blacklist=dm-multipath net.ifnames=0 biosdevname=0 ", "ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart.cfg", "<enter>"]
10+
boot_wait = "3s"
11+
http_directory = "http"
12+
13+
### Template ###
14+
################
15+
# VM Config #
16+
cpu = 2
17+
memory = 10240
18+
#Disks
19+
disk_size = "30"
20+
storage_pool = "pool-name"
21+
storage_pool_type = "lvm"
22+
type = "virtio"
23+
#Network
24+
bridge = "vmbr0"
25+
#Info
26+
template_description = "Rhel 8.5"
27+
template_name = "Template-rhel8.5"
28+
29+
#ssh
30+
ssh_handshake_attempts = "100"
31+
ssh_username = "username"
32+
ssh_password = "password"
33+
ssh_timeout = "40m"

RHEL/rhel8/builder.pkr.hcl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
source "proxmox" "rhel8" {
3+
boot_command = var.boot_command
4+
boot_wait = var.boot_wait
5+
cores = var.cpu
6+
disks {
7+
disk_size = var.disksize
8+
storage_pool = var.storage_pool
9+
storage_pool_type = var.storage_pool_type
10+
type = var.type
11+
}
12+
http_directory = var.http_directory
13+
insecure_skip_tls_verify = true
14+
iso_file = var.iso_file
15+
memory = var.memory
16+
network_adapters {
17+
bridge = var.bridge
18+
}
19+
node = var.proxmox_node
20+
password = var.proxmox_password
21+
proxmox_url = var.proxmox_url
22+
23+
ssh_handshake_attempts = var.ssh_handshake_attempts
24+
ssh_password = var.ssh_password
25+
ssh_timeout = var.ssh_timeout
26+
ssh_username = var.ssh_username
27+
template_description = var.template_description
28+
template_name = var.template_name
29+
username = var.proxmox_username
30+
}
31+
32+
33+
build {
34+
sources = [
35+
"proxmox.rhel8",
36+
]
37+
provisioner "shell" {
38+
execute_command = "echo '${var.ssh_password}' | {{.Vars}} sudo -S -E sh -eux '{{.Path}}'"
39+
scripts = [
40+
"scripts/prep.sh"
41+
]
42+
}
43+
}

RHEL/rhel8/http/.DS_Store

6 KB
Binary file not shown.

RHEL/rhel8/http/kickstart.cfg

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
lang en_US
2+
keyboard no
3+
timezone Europe/Oslo --isUtc
4+
rootpw $KJNDFOSDKLFMFDKJ09483592394+023 --iscrypted
5+
#platform x86, AMD64, or Intel EM64T
6+
reboot
7+
text
8+
cdrom
9+
bootloader --location=mbr --append="rhgb quiet crashkernel=auto"
10+
zerombr
11+
clearpart --all --initlabel
12+
autopart
13+
auth --passalgo=sha512 --useshadow
14+
user --name=username --password=password
15+
sshkey --username=username "ssh-rsa KEY###"
16+
selinux --disabled
17+
firewall --enabled
18+
skipx
19+
firstboot --disable
20+
%post
21+
usermod -aG wheel username
22+
dnf update -y
23+
%end
24+
%packages
25+
@^server-product-environment
26+
@development
27+
%end

RHEL/rhel8/scripts/prep.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
### Create a clean script. ###
7+
echo "Starting Cleanup..."
8+
9+
### Cleans the audit logs. ###
10+
echo '> Cleaning the audit logs ...'
11+
if [ -f /var/log/audit/audit.log ]; then
12+
cat /dev/null > /var/log/audit/audit.log
13+
fi
14+
if [ -f /var/log/wtmp ]; then
15+
cat /dev/null > /var/log/wtmp
16+
fi
17+
if [ -f /var/log/lastlog ]; then
18+
cat /dev/null > /var/log/lastlog
19+
fi
20+
21+
### Cleans the persistent udev rules. ###
22+
echo '> Cleaning persistent udev rules ...'
23+
if [ -f /etc/udev/rules.d/70-persistent-net.rules ]; then
24+
rm /etc/udev/rules.d/70-persistent-net.rules
25+
fi
26+
27+
### Clean the /tmp directories. ###
28+
echo '> Cleaning the /tmp directories ...'
29+
rm -rf /tmp/*
30+
rm -rf /var/tmp/*
31+
rm -rf /var/log/rhsm/*
32+
rm -rf /var/cache/dnf/*
33+
34+
### Sets the hostname to localhost. ###
35+
echo '> Setting the hostname to localhost ...'
36+
cat /dev/null > /etc/hostname
37+
hostnamectl set-hostname localhost
38+
39+
### Clean the dnf cache. ###
40+
echo '> Cleaning the cache ...'
41+
dnf clean all
42+
43+
### Clean the machine-id. ###
44+
echo '> Cleaning the machine-id ...'
45+
truncate -s 0 /etc/machine-id
46+
rm /var/lib/dbus/machine-id
47+
ln -s /etc/machine-id /var/lib/dbus/machine-id
48+
49+
### Clean the shell history. ###
50+
echo '> Cleaning the shell history ...'
51+
unset HISTFILE
52+
history -cw
53+
echo > ~/.bash_history
54+
rm -fr /root/.bash_history

RHEL/rhel8/vars.pkr.hcl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### Proxmox Node ###
2+
variable "proxmox_node" {}
3+
variable "proxmox_url" {}
4+
variable "proxmox_username" {}
5+
variable "proxmox_password" {}
6+
7+
### iso Config ###
8+
variable "iso_file" {}
9+
variable "boot_command" {}
10+
variable "boot_wait" {}
11+
variable "http_directory" {}
12+
13+
### Template ###
14+
################
15+
# VM Config #
16+
variable "cpu" {}
17+
variable "memory" {}
18+
#Disks
19+
variable "disk_size" {}
20+
variable "storage_pool" {}
21+
variable "storage_pool_type" {}
22+
variable "type" {}
23+
#Network
24+
variable "bridge" {}
25+
#Info
26+
variable "template_description" {}
27+
variable "template_name" {}
28+
29+
#ssh
30+
variable "ssh_handshake_attempts" {}
31+
variable "ssh_username" {}
32+
variable "ssh_password" {}
33+
variable "ssh_timeout" {}

RHEL/rhel9/auto.pkrvars.hcl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### Proxmox Node ###
2+
proxmox_node = "node"
3+
proxmox_url = "https://192.1.1.1:8006/api2/json"
4+
proxmox_username = "username@pam"
5+
proxmox_password = "password"
6+
7+
### iso Config ###
8+
iso_file = "local:iso/rhel-8.5-x86_64-dvd.iso"
9+
boot_command = ["<esc><wait>", "vmlinuz initrd=initrd.img inst.geoloc=0 rd.driver.blacklist=dm-multipath net.ifnames=0 biosdevname=0 ", "inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart.cfg", "<enter>"]
10+
boot_wait = "3s"
11+
http_directory = "http"
12+
13+
### Template ###
14+
################
15+
# VM Config #
16+
cpu = 2
17+
cpu_type = "host"
18+
memory = 10240
19+
#Disks
20+
disk_size = "30"
21+
storage_pool = "pool-name"
22+
storage_pool_type = "lvm"
23+
type = "virtio"
24+
#Network
25+
bridge = "vmbr0"
26+
#Info
27+
template_description = "Rhel 8.5"
28+
template_name = "Template-rhel8.5"
29+
30+
#ssh
31+
ssh_handshake_attempts = "100"
32+
ssh_username = "username"
33+
ssh_password = "password"
34+
ssh_timeout = "40m"

0 commit comments

Comments
 (0)