Skip to content

Commit

Permalink
Add shell provisioner to install python3-libdnf5
Browse files Browse the repository at this point in the history
This is necessary because the base AMI we use does not come with the
python3-libdnf5 package preinstalled.  Since Ansible detects dnf5 as
the package manage on Fedora 41 and above, this package must be
installed before Ansible can be run.
  • Loading branch information
jsf9k committed Nov 12, 2024
1 parent 4bca549 commit 5a440e7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/packer.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,17 @@ build {
"source.amazon-ebs.x86_64",
]

# This is necessary because the base AMI we use does not come with
# the python3-libdnf5 package preinstalled. Since Ansible detects
# dnf5 as the package manage on Fedora 41 and above, this package
# must be installed before Ansible can be run.
provisioner "shell" {
# We need to call bash here because after hardening /tmp has the
# noexec bit set on it.
execute_command = "chmod +x {{ .Path }}; sudo env {{ .Vars }} bash {{ .Path }} ; rm -f {{ .Path }}"
inline = ["dnf5 --assumeyes --refresh install python3-libdnf5"]
}

provisioner "ansible" {
playbook_file = "src/upgrade.yml"
use_proxy = false
Expand Down

0 comments on commit 5a440e7

Please sign in to comment.