AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1091194
Accepted
Hiddai
Hiddai
Asked: 2022-01-27 00:54:58 +0800 CST2022-01-27 00:54:58 +0800 CST 2022-01-27 00:54:58 +0800 CST

为什么第二次运行 ansible.windows.win_package 不起作用?

  • 772

我有一个产品,我可以先安装它,然后更新它——这意味着为我的基础产品添加更多功能

我是第一次执行 MSI,然后进入添加\删除程序,选择产品时,您可以单击“更改”,安装向导将再次出现,允许您选择并安装产品中的附加功能

我为此任务创建了 2 个 ansible 角色和剧本第一个角色使用 ansible.windows.win_package 安装基础产品(参见下面的示例)

- name: Install Server.msi primary_appserver
  ansible.windows.win_package:
    path: C:\product.msi
    log_path: C:\InstallProduct.log
    arguments:
     ADDLOCAL=DB,Agent
    state: present
  become: true
  become_method: runas
  vars:
    ansible_become_user: "{{ ansible_user }}"
    ansible_become_password: "{{ ansible_password }}"
  when: "'primary_appservers' in group_names"

第二个角色再次使用 ansible.windows.win_package 和不同的 ADDLOCAL 参数(附加功能):

- name: Install Engine primary_appserver
  ansible.windows.win_package:
    path: C:\product.msi
    log_path: C:\InstallEngine.log
    arguments:
     ADDLOCAL=Engine
    state: present
  become: true
  become_method: runas
  vars:
    ansible_become_user: "{{ ansible_user }}"
    ansible_become_password: "{{ ansible_password }}"
  when: "'primary_appservers' in group_names"

第一个角色工作正常并执行 msi 文件,第二个角色 - 不是

windows installation automation msi ansible
  • 1 1 个回答
  • 458 Views

1 个回答

  • Voted
  1. Best Answer
    Gerald Schneider
    2022-02-01T06:26:37+08:002022-02-01T06:26:37+08:00

    这个问题很可能是state: present参数,因为在运行任务时包已经存在。相反,您可以使用creates_pathorcreates_service参数来检查是否需要安装软件包。

    例子:

    - name: Install Engine primary_appserver
      ansible.windows.win_package:
        path: C:\product.msi
        log_path: C:\InstallEngine.log
        arguments:
        ADDLOCAL=Engine
        creates_path: "C:\Path\to\product\folder"
      become: true
      become_method: runas
      vars:
        ansible_become_user: "{{ ansible_user }}"
        ansible_become_password: "{{ ansible_password }}"
      when: "'primary_appservers' in group_names"
    
    • 1

相关问题

  • 知道任何适用于 Windows 的快速可编写脚本的 ftp 客户端吗?[关闭]

  • 如果 Windows 服务崩溃,如何自动重新启动它?

  • 无法安排任务(访问被拒绝)

  • 物理机重启时自动重启虚拟机(VMWare)

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve