Ansible - 在没有提示的情况下进行发布升级
Ansible - do-release-upgrade without prompts
在Ubuntu我想通过Ansible命令“do-release-upgrade”升级OS,但是它有提示无法避免
有没有办法使用 Ansible 来回答运行 Ansible 脚本的用户的提示?
我们有几台服务器无法使用 SSH 访问,但使用 Ansible 可以。
服务器在 Ubuntu 16.04 上,所有服务器都需要升级到 Ubuntu 20.04。
在这个过程中有很多不可避免的提示。
Is there a way to use ansible playbook which will open possibility to answer on shell script prompt by user who runs ansible script?
可以使用expect module。示例:
- name: Upgrading Software
expect:
command: do-release-upgrade
responses:
'First Question in the prompt' : 'y'
'Second Question in the prompt' : 'y'
但是,您想在没有提示的情况下执行 do-release-upgrade。
- command: do-release-upgrade -f DistUpgradeViewNonInteractive
请注意:
- 升级前确保备份到位
- 确保所有包都是最新版本
- 确保安装了 update-manager-core
- 确保在 do-release-upgrade 后重启机器
此外,请阅读我的第一条评论。由于您没有与机器的 SSH 连接,因此很难调试并查看出现问题时发生的情况。
在Ubuntu我想通过Ansible命令“do-release-upgrade”升级OS,但是它有提示无法避免
有没有办法使用 Ansible 来回答运行 Ansible 脚本的用户的提示?
我们有几台服务器无法使用 SSH 访问,但使用 Ansible 可以。
服务器在 Ubuntu 16.04 上,所有服务器都需要升级到 Ubuntu 20.04。
在这个过程中有很多不可避免的提示。
Is there a way to use ansible playbook which will open possibility to answer on shell script prompt by user who runs ansible script?
可以使用expect module。示例:
- name: Upgrading Software
expect:
command: do-release-upgrade
responses:
'First Question in the prompt' : 'y'
'Second Question in the prompt' : 'y'
但是,您想在没有提示的情况下执行 do-release-upgrade。
- command: do-release-upgrade -f DistUpgradeViewNonInteractive
请注意:
- 升级前确保备份到位
- 确保所有包都是最新版本
- 确保安装了 update-manager-core
- 确保在 do-release-upgrade 后重启机器
此外,请阅读我的第一条评论。由于您没有与机器的 SSH 连接,因此很难调试并查看出现问题时发生的情况。