【问题标题】:AD-HOC command for installing a package in ubuntu用于在 ubuntu 中安装包的 AD-HOC 命令
【发布时间】:2021-06-10 09:21:30
【问题描述】:

每当我尝试在 ubuntu 中安装软件包时,它都会抛出如下代码所示的错误

但是如果我尝试用从机 ping 它看起来很好

172.31.6.185 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "cache_update_time": 1619825195,
    "cache_updated": false,
    "changed": false,
    "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"      install 'httpd'' failed: E: Package 'httpd' has no installation candidate\n",
    "rc": 100,
    "stderr": "E: Package 'httpd' has no installation candidate\n",
    "stderr_lines": [
        "E: Package 'httpd' has no installation candidate"
    ],
    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nPackage httpd is a virtual package provided by:\n  nginx-core 1.18.0-0ubuntu1\n  apache2 2.4.41-4ubuntu3.1\n\n",
    "stdout_lines": [
        "Reading package lists...",
        "Building dependency tree...",
        "Reading state information...",
        "Package httpd is a virtual package provided by:",
        "  nginx-core 1.18.0-0ubuntu1",
        "  apache2 2.4.41-4ubuntu3.1",
        ""
    ]
}

【问题讨论】:

  • 报告的问题是它无法安装任何所需的依赖项。需要虚拟包httpd。根据包管理器的说法,这个要求可以通过nginx-core 版本1.18.0-0ubuntu1apache2 版本2.4.41-4ubuntu3.1 来满足。两者都不能在没有冲突的情况下安装。您应该找出为什么这些软件包都无法安装,也许可以通过单独尝试并查看问题所在。
  • 我想安装httpd 只是我应该怎么做才能避免安装时的冲突

标签: ansible adhoc


【解决方案1】:

嗯,试试更新你的临时命令怎么样

sudo apt update && sudo apt upgrade && sudo apt install apache2

【讨论】:

  • 正常安装对你所说的没问题但是这里我尝试在ansible中使用AD-HOC命令安装包
  • @AKASH-29,你的 ansible adhoc 命令是什么?
  • $ ansible all -m apt -a "name=httpd state=present" -b
  • ansible all -m apt -a "name=apache2 state=present" -b
  • 或者你可以使用ansible all -m command -a "apt update && apt upgrade && apt install apache2" -b
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多