gpt4 book ai didi

mongodb - Ansible-Playbook 无法安装 MongoDB

转载 作者:行者123 更新时间:2023-12-04 19:04:58 26 4
gpt4 key购买 nike

我有一个 ansible-playbook 文件,旨在将一堆软件包安装到 Ubuntu VM (22.04) 上,包括 MongoDB。但是,当我运行它时收到以下错误:

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"]}


这些是 ansible-playbook 中负责 MongoDB 的任务:
---
- 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
应该注意的是,ansible-playbook 失败是在“安装 MongoDB”任务中。之前的任务执行良好。
关于如何解决这个问题的任何想法?

最佳答案

好吧,经过一番激烈的谷歌搜索后,我遇到的问题似乎与我的 VM 正在运行的操作系统有关 - Ubuntu 22.04。
这个MongoDB team member post on a community forum关于同样的问题基本上说,由于 22.04 是相当新的,MongoDB 团队还没有为它发布兼容的包。截至撰写本文时,他的帖子已有 8 天了。 MongoDB 团队成员还建议不要尝试将用于不同操作系统版本的不同包合并在一起。
所以,真的,看起来我唯一的选择是恢复到早期的操作系统版本。
我希望这可以帮助其他遇到同样问题的人!

关于mongodb - Ansible-Playbook 无法安装 MongoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72121130/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com