Unknown Error occurred: Could not run transaction

Workstation:
Packer v1.11.2
ansible [core 2.16.3]
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/home/citadel/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3.12/site-packages/ansible
ansible collection location = /home/citadel/.ansible/collections:/usr/share/ansible/collections
executable location = /bin/ansible
python version = 3.12.8 (main, Dec 12 2024, 16:30:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.12)
jinja version = 3.1.2
libyaml = True

Instance being built:
“discovered_interpreter_python”: “/usr/bin/python3.9”,
“distribution_file_variety”: “Amazon”,
“distribution_major_version”: “2023”,

SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 33

Via packer command line, running the following within a playbook to remove codedeploy from the instance:

  • name: Uninstall CodeDeploy
    ansible.builtin.dnf:
    name: codedeploy-agent
    state: absent

Getting the following error…

bastion.amazon-ebs.bastion: The full traceback is:
bastion.amazon-ebs.bastion:   File "/tmp/ansible_ansible.legacy.dnf_payload_amirom_7/ansible_ansi 

ble.legacy.dnf_payload.zip/ansible/modules/dnf.py", line 1364, in ensure
bastion.amazon-ebs.bastion: File “/usr/lib/python3.9/site-packages/dnf/base.py”, line 1034, in do_transaction
bastion.amazon-ebs.bastion: tid = self._run_transaction(cb=cb)
bastion.amazon-ebs.bastion: File “/usr/lib/python3.9/site-packages/dnf/base.py”, line 1153, in _run_transaction
bastion.amazon-ebs.bastion: raise dnf.exceptions.Error(msg)
bastion.amazon-ebs.bastion: fatal: [default]: FAILED! => {
bastion.amazon-ebs.bastion: “changed”: false,
bastion.amazon-ebs.bastion: “failures”: ,
bastion.amazon-ebs.bastion: “invocation”: {
bastion.amazon-ebs.bastion: “module_args”: {
bastion.amazon-ebs.bastion: “allow_downgrade”: false,
bastion.amazon-ebs.bastion: “allowerasing”: false,
bastion.amazon-ebs.bastion: “autoremove”: false,
bastion.amazon-ebs.bastion: “bugfix”: false,
bastion.amazon-ebs.bastion: “cacheonly”: false,
bastion.amazon-ebs.bastion: “conf_file”: null,
bastion.amazon-ebs.bastion: “disable_excludes”: null,
bastion.amazon-ebs.bastion: “disable_gpg_check”: false,
bastion.amazon-ebs.bastion: “disable_plugin”: ,
bastion.amazon-ebs.bastion: “disablerepo”: ,
bastion.amazon-ebs.bastion: “download_dir”: null,
bastion.amazon-ebs.bastion: “download_only”: false,
bastion.amazon-ebs.bastion: “enable_plugin”: ,
bastion.amazon-ebs.bastion: “enablerepo”: ,
bastion.amazon-ebs.bastion: “exclude”: ,
bastion.amazon-ebs.bastion: “install_repoquery”: true,
bastion.amazon-ebs.bastion: “install_weak_deps”: true,
bastion.amazon-ebs.bastion: “installroot”: “/”,
bastion.amazon-ebs.bastion: “list”: null,
bastion.amazon-ebs.bastion: “lock_timeout”: 30,
bastion.amazon-ebs.bastion: “name”: [
bastion.amazon-ebs.bastion: “codedeploy-agent”
bastion.amazon-ebs.bastion: ],
bastion.amazon-ebs.bastion: “nobest”: false,
bastion.amazon-ebs.bastion: “releasever”: null,
bastion.amazon-ebs.bastion: “security”: false,
bastion.amazon-ebs.bastion: “skip_broken”: false,
bastion.amazon-ebs.bastion: “sslverify”: true,
bastion.amazon-ebs.bastion: “state”: “absent”,
bastion.amazon-ebs.bastion: “update_cache”: false,
bastion.amazon-ebs.bastion: “update_only”: false,
bastion.amazon-ebs.bastion: “use_backend”: “auto”,
bastion.amazon-ebs.bastion: “validate_certs”: true
bastion.amazon-ebs.bastion: }
bastion.amazon-ebs.bastion: },
bastion.amazon-ebs.bastion: “msg”: “Unknown Error occurred: Could not run transaction.”,
bastion.amazon-ebs.bastion: “rc”: 1,
bastion.amazon-ebs.bastion: “results”:
bastion.amazon-ebs.bastion: }
bastion.amazon-ebs.bastion:
bastion.amazon-ebs.bastion: PLAY RECAP *********************************************************************
bastion.amazon-ebs.bastion: default : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Any suggestions on how to resolve this issue?