I have an ansible-playbook file that is meant to install a bunch of packages onto an Ubuntu VM (22.04), including MongoDB. However, I receive the following error when I run it:
fatal: [myserver]: FAILED! => {"cache_update_time": 1651714552, "cache_updated": true, "changed": false, "msg": "'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'mongodb-org'' failed: E: Unable to correct problems, you have held broken packages.\n", "rc": 100, "stderr": "E: Unable to correct problems, you have held broken packages.\n", "stderr_lines": ["E: Unable to correct problems, you have held broken packages."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nSome packages could not be installed. This may mean that you have\nrequested an impossible situation or if you are using the unstable\ndistribution that some required packages have not yet been created\nor been moved out of Incoming.\nThe following information may help to resolve the situation:\n\nThe following packages have unmet dependencies:\n mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but it is not installable\n mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable\n mongodb-org-shell : Depends: libssl1.1 (>= 1.1.1) but it is not installable\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "Some packages could not be installed. This may mean that you have", "requested an impossible situation or if you are using the unstable", "distribution that some required packages have not yet been created", "or been moved out of Incoming.", "The following information may help to resolve the situation:", "", "The following packages have unmet dependencies:", " mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but it is not installable", " mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable", " mongodb-org-shell : Depends: libssl1.1 (>= 1.1.1) but it is not installable"]}
These are the tasks responsible for MongoDB in the ansible-playbook:
---
- hosts: myserver
become: true
remote_user: admin
vars_files:
- default.yml
tasks:
- name: "Install aptitude"
apt:
name: aptitude
state: latest
update_cache: true
- name: "Import MongoDB public key"
apt_key:
url: "https://www.mongodb.org/static/pgp/server-5.0.asc"
state: present
- name: "Add MongoDB repository"
apt_repository:
filename: '/etc/apt/sources.list.d/mongodb-org-5.0.list'
repo: "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse"
state: present
update_cache: yes
- name: "Install MongoDB"
apt:
name: mongodb-org
state: present
update_cache: yes
It should be noted that it's at the "Install MongoDB" task that the ansible-playbook fails. The tasks before execute fine.
Any thoughts on how to resolve this issue?