templates/packer: switch to fedora-40

Fedora 38 is EOL, and packit no longer builds rpms for it.

The current python3.12 + ansible 2.12 combination which is the default
on fedora 40 doesn't work, so switch to python3.9.
This commit is contained in:
Sanne Raymaekers 2024-05-23 14:50:05 +02:00
parent 5d1094a94e
commit a96f1b6d31
5 changed files with 29 additions and 16 deletions

View file

@ -93,23 +93,23 @@ build {
}
source "amazon-ebs.image_builder" {
name = "fedora-38-x86_64"
name = "fedora-40-x86_64"
# Use a static Fedora 38 Cloud Base Image.
source_ami = "ami-01752495da7056fa9"
# Fedora-Cloud-Base-AmazonEC2.x86_64-40-1.14-hvm-us-east-1-gp3-0
source_ami = "ami-004f552bba0e5f64f"
ssh_username = "fedora"
instance_type = "c6a.large"
# Set a name for the resulting AMI.
ami_name = "${var.image_name}-fedora-38-x86_64"
ami_name = "${var.image_name}-fedora-40-x86_64"
# Apply tags to the resulting AMI/EBS snapshot.
tags = {
AppCode = "IMGB-001"
Name = "${var.image_name}-fedora-38-x86_64"
Name = "${var.image_name}-fedora-40-x86_64"
composer_commit = "${var.composer_commit}"
os = "fedora"
os_version = "38"
os_version = "40"
arch = "x86_64"
}
@ -117,7 +117,7 @@ build {
launch_block_device_mappings {
delete_on_termination = "true"
device_name = "/dev/sda1"
volume_size = 5
volume_size = 6
volume_type = "gp3"
}
@ -130,24 +130,23 @@ EOF
}
source "amazon-ebs.image_builder" {
name = "fedora-38-aarch64"
name = "fedora-40-aarch64"
# Use a static Fedora 38 Cloud Base Image.
# Fedora-Cloud-Base-38-1.5
source_ami = "ami-046ab62d59c5a451c"
# Fedora-Cloud-Base-AmazonEC2.aarch64-40-1.14-hvm-us-east-1-gp3-0
source_ami = "ami-0d3825b70fa928886"
ssh_username = "fedora"
instance_type = "c6g.large"
# Set a name for the resulting AMI.
ami_name = "${var.image_name}-fedora-38-aarch64"
ami_name = "${var.image_name}-fedora-40-aarch64"
# Apply tags to the resulting AMI/EBS snapshot.
tags = {
AppCode = "IMGB-001"
Name = "${var.image_name}-fedora-38-aarch64"
Name = "${var.image_name}-fedora-40-aarch64"
composer_commit = "${var.composer_commit}"
os = "fedora"
os_version = "38"
os_version = "40"
arch = "aarch64"
}
@ -155,7 +154,7 @@ EOF
launch_block_device_mappings {
delete_on_termination = "true"
device_name = "/dev/sda1"
volume_size = 5
volume_size = 6
volume_type = "gp3"
}
@ -167,6 +166,14 @@ update-crypto-policies --set LEGACY
EOF
}
# Ansible is a little broken on fedora>39, needs python-six
provisioner "shell" {
only = ["amazon-ebs.fedora-40-x86_64", "amazon-ebs.fedora-40-aarch64"]
inline = [
"sudo dnf install -y python3.9"
]
}
provisioner "ansible" {
playbook_file = "${path.root}/ansible/playbook.yml"
user = build.User

View file

@ -8,7 +8,7 @@ export BUILD_RPMS=false
# Fedora community workers use osbuild form rpmrepo + composer from
# copr, as the osbuild rpms from copr disappear too quickly.
export ANSIBLE_TAGS="fedora"
FEDORA=fedora-38
FEDORA=fedora-40
export PACKER_ONLY_EXCEPT=--only=amazon-ebs."$FEDORA"-x86_64,amazon-ebs."$FEDORA"-aarch64
COMMIT_SHA="${COMMIT_SHA:-$(git rev-parse HEAD)}"

View file

@ -70,6 +70,12 @@ EOF
if [[ $osbuild_commit != "null" ]]; then
tee -a "$item/group_vars/all.yml" <<EOF
osbuild_commit: $osbuild_commit
EOF
fi
if [[ "$item" == templates/packer/ansible/inventory/fedora* ]]; then
tee -a "$item/group_vars/all.yml" <<EOF
ansible_python_interpreter: /usr/bin/python3.9
EOF
fi