Ansible 保留要升级的软件包并进行发布升级

Ansible 保留要升级的软件包并进行发布升级

如何阻止软件包升级并同时进行 Ubuntu 版本升级?

如果我运行这个脚本,我会收到错误:

ASK [Run do-release-upgrade non-interactively.] 

fatal: [31.171.246.151]: FAILED! => {"changed": true, "cmd":
["do-release-upgrade", "-d", "-f", "DistUpgradeViewNonInteractive"],
"delta": "0:00:05.992413", "end": "2020-07-14 15:23:58.037328", "msg":
"non-zero return code", "rc": 1, "start": "2020-07-14
15:23:52.044915", "stderr": "", "stderr_lines": [], "stdout":
"Checking for a new Ubuntu release\nPlease install all available
updates for your release before upgrading.", "stdout_lines":
["Checking for a new Ubuntu release", "Please install all available
updates for your release before upgrading."]}
************************************************************************************---
- hosts: localhost
  become: yes
  tasks:
  - name: disable upgrade of Java
    dpkg_selections:
      name: openjdk-8-jre
      selection: hold
  - name: disable install of PostgreSQL
    dpkg_selections:
      name: postgresql-9.3
      selection: hold

  - name: update apt cache
    apt:
      update_cache: yes
      autoclean: yes

  - name: upgrade packages
    apt:
      upgrade: dist

  - name: Run do-release-upgrade non-interactively.
    command: do-release-upgrade -d -f DistUpgradeViewNonInteractive

答案1

问:“如何阻止软件包升级并同时进行 Ubuntu 版本升级?”

答:在 Ubuntu 中,不可能升级发布并保留包。有必要从新版本的存储库安装软件包。

相关内容