Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit12b70a9

Browse files
committed
add rocky10
1 parent1f5c806 commit12b70a9

File tree

2 files changed

+193
-0
lines changed

2 files changed

+193
-0
lines changed

‎http/rocky10-kickstart.cfg‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#Generated by packer-kvm/build-packer-templates.yaml
2+
3+
#auth --enableshadow --passalgo=sha512
4+
url --url="https://download.rockylinux.org/pub/rocky/10/BaseOS/x86_64/kickstart/"
5+
text
6+
firstboot --disable
7+
keyboard --vckeymap=us --xlayouts='us'
8+
lang en_US.UTF-8
9+
network --bootproto=dhcp --device=eth0 --ipv6=auto --activate
10+
network --hostname=centos10.localdomain
11+
selinux --disabled
12+
rootpw testtest
13+
user --groups=wheel --name=user --password=testtest --uid=1000 --gecos="user" --gid=1000
14+
sshkey --username=user"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDUXg2vJmOBNIHd5j6gWFBs0/I4IWXp1jIHBn93FyUQsgiVOG82jhCA69G2SqCYbZHRJSJhwOFSMtMsvDno5Gz+tZMSASliiQnDD26YxiqZZUOApqCpdYKYEhwjVcokjKfm1rVdYhysk1K/qmlL6D0SVAzZxsepl7x8JksMVjvOsuGsZywsvh/Ck7JqEMt9O/NDWv0iFGkGy7J888eAnc+bMyiVV4ND+yYPqpCtL+fPU/dY7+LMR9uDoiJK8fAOmCrBvRLwmKOCh4NNRsHk58L36gl3ArUpNlqWrotpLROHhrXcuh4hSmPuTVsxQOTrzaHM2oVkw/+LBpFFqMLJrAaM8sVrfUBAhRD91cFHjazXg7RvXE1dbkPWDH6THJ71CS1FLyz2htMd7nYuJX/3J2bk533JKZVy/nOEtb0k2s1yCw4WNhT7M+RSFjsvgFsJJkvcGKPpIUwdkctzAXj4hAC1sdhiLsdh/j9E5yw2Tr6rRZ4nuBGDUOqlHABSZBm1d6k= packer-kvm-default-key"
15+
sshkey --username=root"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDUXg2vJmOBNIHd5j6gWFBs0/I4IWXp1jIHBn93FyUQsgiVOG82jhCA69G2SqCYbZHRJSJhwOFSMtMsvDno5Gz+tZMSASliiQnDD26YxiqZZUOApqCpdYKYEhwjVcokjKfm1rVdYhysk1K/qmlL6D0SVAzZxsepl7x8JksMVjvOsuGsZywsvh/Ck7JqEMt9O/NDWv0iFGkGy7J888eAnc+bMyiVV4ND+yYPqpCtL+fPU/dY7+LMR9uDoiJK8fAOmCrBvRLwmKOCh4NNRsHk58L36gl3ArUpNlqWrotpLROHhrXcuh4hSmPuTVsxQOTrzaHM2oVkw/+LBpFFqMLJrAaM8sVrfUBAhRD91cFHjazXg7RvXE1dbkPWDH6THJ71CS1FLyz2htMd7nYuJX/3J2bk533JKZVy/nOEtb0k2s1yCw4WNhT7M+RSFjsvgFsJJkvcGKPpIUwdkctzAXj4hAC1sdhiLsdh/j9E5yw2Tr6rRZ4nuBGDUOqlHABSZBm1d6k= packer-kvm-default-key"
16+
timezone Europe/Paris --utc
17+
bootloader --location=mbr --append=" net.ifnames=0 biosdevname=0 crashkernel=no"
18+
# Clear the Master Boot Record
19+
zerombr
20+
# Remove partitions
21+
clearpart --all --initlabel
22+
# Automatically create partitions using LVM
23+
autopart --type=lvm
24+
# Reboot after successful installation
25+
reboot
26+
27+
%packages --excludedocs
28+
sudo
29+
qemu-guest-agent
30+
openssh-server
31+
-kexec-tools
32+
-dracut-config-rescue
33+
-plymouth*
34+
-iwl*firmware
35+
%end
36+
37+
%addon com_redhat_kdump --disable
38+
%end
39+
40+
%post
41+
# Update time
42+
#/usr/sbin/ntpdate -bu 0.fr.pool.ntp.org 1.fr.pool.ntp.org
43+
44+
#sed -i 's/^.*requiretty/#Defaults requiretty/' /etc/sudoers
45+
sed -i's/rhgb //' /etc/default/grub
46+
47+
# Disable consistent network device naming
48+
#/usr/bin/ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
49+
50+
# sshd PermitRootLogin yes
51+
sed -i"s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
52+
#echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
53+
cat <<EOF >> /etc/sudoers
54+
Defaults !requiretty
55+
rootALL=(ALL) ALL
56+
userALL=(ALL) NOPASSWD: ALL
57+
EOF
58+
59+
# Enable NetworkManager, sshd and disable firewalld
60+
#/usr/bin/systemctl enable NetworkManager
61+
/usr/bin/systemctl enable sshd
62+
/usr/bin/systemctl start sshd
63+
#/usr/bin/systemctl disable firewalld
64+
65+
# Need for host/guest communication
66+
/usr/bin/systemctl enable qemu-guest-agent
67+
/usr/bin/systemctl start qemu-guest-agent
68+
69+
# Update all packages
70+
#/usr/bin/dnf -y update
71+
#/usr/bin/dnf clean all
72+
73+
# Not really needed since the kernel update already did this. Furthermore,
74+
# running this here reverts the grub menu to the current kernel.
75+
grub2-mkconfig -o /boot/grub2/grub.cfg
76+
%end

‎rocky10.pkr.hcl‎

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#Generated by packer-kvm/build-packer-templates.yaml
2+
3+
packer {
4+
required_plugins {
5+
qemu={
6+
version="~> 1"
7+
source="github.com/hashicorp/qemu"
8+
}
9+
ansible={
10+
version=">= 1.1.2"
11+
source="github.com/hashicorp/ansible"
12+
}
13+
}
14+
}
15+
16+
variable"config_file" {
17+
type=string
18+
default="rocky10-kickstart.cfg"
19+
}
20+
21+
variable"cpu" {
22+
type=string
23+
default="2"
24+
}
25+
26+
variable"destination_server" {
27+
type=string
28+
default="download.goffinet.org"
29+
}
30+
31+
variable"disk_size" {
32+
type=string
33+
default="40000"
34+
}
35+
36+
variable"headless" {
37+
type=string
38+
default="true"
39+
}
40+
41+
variable"iso_checksum" {
42+
type=string
43+
default="file:https://download.rockylinux.org/pub/rocky/10/isos/x86_64/Rocky-10-latest-x86_64-boot.iso.CHECKSUM"
44+
}
45+
46+
variable"iso_url" {
47+
type=string
48+
default="https://download.rockylinux.org/pub/rocky/10/isos/x86_64/Rocky-10-latest-x86_64-boot.iso"
49+
}
50+
51+
variable"name" {
52+
type=string
53+
default="rocky"
54+
}
55+
56+
variable"ram" {
57+
type=string
58+
default="2048"
59+
}
60+
61+
variable"ssh_password" {
62+
type=string
63+
default="testtest"
64+
}
65+
66+
variable"ssh_username" {
67+
type=string
68+
default="root"
69+
}
70+
71+
variable"version" {
72+
type=string
73+
default="10"
74+
}
75+
76+
source"qemu""rocky10" {
77+
accelerator="kvm"
78+
boot_command=["e","<down><down>","<leftCtrlOn>e<leftCtrlOff>","<spacebar>","biosdevname=0","<spacebar>","net.ifnames=0","<spacebar>","inst.text","<spacebar>","inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/http/${var.config_file}","<leftCtrlOn>x<leftCtrlOff>"]
79+
disk_cache="none"
80+
disk_compression=true
81+
disk_discard="unmap"
82+
disk_interface="virtio"
83+
disk_size=var.disk_size
84+
format="qcow2"
85+
headless=var.headless
86+
http_directory="."
87+
iso_checksum=var.iso_checksum
88+
iso_url=var.iso_url
89+
net_device="virtio-net"
90+
output_directory="artifacts/qemu/${var.name}${var.version}"
91+
qemu_binary="/usr/bin/qemu-system-x86_64"
92+
qemuargs=[["-m","${var.ram}M"], ["-smp","${var.cpu}"], ["-cpu","host"]]
93+
shutdown_command="sudo /usr/sbin/shutdown -h now"
94+
ssh_password=var.ssh_password
95+
ssh_username=var.ssh_username
96+
ssh_wait_timeout="30m"
97+
boot_wait="10s"
98+
}
99+
100+
build {
101+
sources=["source.qemu.rocky10"]
102+
103+
provisioner"shell" {
104+
execute_command="{{ .Vars }} sudo -E bash '{{ .Path }}'"
105+
inline=["dnf -y install python3 python3-pip","pip3 install ansible"]
106+
}
107+
108+
provisioner"ansible-local" {
109+
playbook_dir="ansible"
110+
playbook_file="ansible/playbook.yml"
111+
}
112+
113+
post-processor"shell-local" {
114+
environment_vars=["IMAGE_NAME=${var.name}","IMAGE_VERSION=${var.version}","DESTINATION_SERVER=${var.destination_server}"]
115+
script="scripts/push-image.sh"
116+
}
117+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp