![Ansible 保留要升级的软件包并进行发布升级](https://linux22.com/image/176937/Ansible%20%E4%BF%9D%E7%95%99%E8%A6%81%E5%8D%87%E7%BA%A7%E7%9A%84%E8%BD%AF%E4%BB%B6%E5%8C%85%E5%B9%B6%E8%BF%9B%E8%A1%8C%E5%8F%91%E5%B8%83%E5%8D%87%E7%BA%A7.png)
如何阻止软件包升级并同时进行 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 中,不可能升级发布并保留包。有必要从新版本的存储库安装软件包。