【发布时间】:2016-02-15 11:08:52
【问题描述】:
我编写了一个简单的剧本来从运行 windows10 的虚拟机 (VM) 中卸载 firefox。我是 ansible/chocolatey 的新手,所以这里是代码:
- name: Test win_chocolatey module
hosts: win1
tasks:
- name: Uninstall firefox
win_chocolatey:
name: firefox
state: absent
在我的机器上执行此代码后,firefox 不再出现在 Windows VM 上安装的巧克力包中。但是仍然安装了 firefox,并且它在 windows VM 上正常工作。
我查阅了卸载命令的 ansible 文档,发现了一条注释:
".... choco uninstall 仅当包维护者提供脚本 ChocolateyUninstall.ps1 时才会从您的系统中删除包"。
所以,我修改了我之前的剧本,以便包含我下载的 powershell 脚本 (https://github.com/Iristyle/ChocolateyPackages/blob/master/HipChat/tools/chocolateyUninstall.ps1):
- name: Test win_chocolatey module
hosts: win1
tasks:
- name: Run PS script
script: /home/ansible_example/chocolateyUninstall.ps1
- name: Uninstall firefox
win_chocolatey:
name: firefox
state: absent
我的 Windows VM 上仍然没有 Firefox。 我正在使用 ansible 2.0.0.2,chocolatey 0.9.9.11
有什么帮助吗?谢谢
【问题讨论】:
标签: powershell ansible chocolatey