Skip to content

Commit

Permalink
templates/packer: switch to fedora-40
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
croissanne committed May 29, 2024
1 parent 5d1094a commit a96f1b6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
37 changes: 22 additions & 15 deletions templates/packer/worker.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,31 @@ 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"
}

# Ensure that the EBS snapshot used for the AMI meets our requirements.
launch_block_device_mappings {
delete_on_termination = "true"
device_name = "/dev/sda1"
volume_size = 5
volume_size = 6
volume_type = "gp3"
}

Expand All @@ -130,32 +130,31 @@ 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"
}

# Ensure that the EBS snapshot used for the AMI meets our requirements.
launch_block_device_mappings {
delete_on_termination = "true"
device_name = "/dev/sda1"
volume_size = 5
volume_size = 6
volume_type = "gp3"
}

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/appsre-build-fedora-worker-packer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)}"

Expand Down
6 changes: 6 additions & 0 deletions tools/appsre-build-worker-packer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a96f1b6

Please sign in to comment.