Ansible Windows 无限运行

Ansible Windows 无限运行

我正在尝试在我的第一个 Windows 节点上使用 Ansible,在 HTTP 上使用 winrm(我将使用 https 作为第二步)和 ntlm 身份验证。

我配置了 group_vars 并且与 Windows 主机的基本连接正常:

me@ansible:~/ansible$ ansible -i staging.ini windows -m setup
windows-server.my.domain.name | SUCCESS => {
    "ansible_facts": {
        "ansible_architecture": "64-bit", 
        "ansible_bios_date": "04/01/2014", 
        "ansible_bios_version": "rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org", 
        "ansible_date_time": {
            [...]
        }, 
        "ansible_distribution": "Microsoft Windows Server 2016 Standard", 
        "ansible_distribution_major_version": "10", 
        "ansible_distribution_version": "10.0.14393.0", 
        "ansible_domain": "my.domain.name", 
        [...]
        "ansible_windows_domain": "my.domain.name, 
        "ansible_windows_domain_member": true, 
        "ansible_windows_domain_role": "Member server", 
        "gather_subset": [
            "all"
        ], 
        "module_setup": true
    }, 
    "changed": false
}

现在我正在尝试安装一个带有基本剧本的 MSI 包(Icinga 2):

---
- hosts: all

  tasks:
    - name: Install Icinga 2
      win_package:
        path: "https://packages.icinga.com/windows/Icinga2-v2.10.5-x86_64.msi"
        product_id: "712727BA-156F-466A-9C25-7A6246602664"
        arguments: /install /passive /norestart

但是当我运行它时,它仍然挂起并且没有任何输出:

me@ansible:~/ansible$ ansible-playbook plays/win-test.yml -i staging.ini --limit windows


PLAY [all] *****************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************
ok: [windows-server.my.domain.name]

TASK [Install Icinga 2] ************************************************************************************************************************

(no output after 10 minutes)

我已经尝试使用进行调试-vvvv但它没有输出任何有用的信息:

me@ansible:~/ansible$ ansible-playbook plays/win-test.yml -i staging.ini --limit windows -vvvv

TASK [Install Icinga 2] *******************************************************************************************************************
task path: /home/me/ansible/plays/win-test.yml:5
Using module file /home/me/.local/lib/python2.7/site-packages/ansible/modules/windows/win_package.ps1
<windows-server.my.domain.name> ESTABLISH WINRM CONNECTION FOR USER: DOMAIN\me on PORT 5985 TO windows-server.my.domain.name
checking if winrm_host windows-server.my.domain.name is an IPv6 address
EXEC (via pipeline wrapper)

(no output after 10 minutes)

我该如何调试它?

答案1

我解决了我的问题,我对 Icinga 2 MSI 文件使用了错误的参数。

正确的论点是:

---
- hosts: all

  tasks:
    - name: Install Icinga 2
      win_package:
        path: "https://packages.icinga.com/windows/Icinga2-v2.10.5-x86_64.msi"
        product_id: "712727BA-156F-466A-9C25-7A6246602664"
        arguments: /qn /norestart

现在包可以正确安装:

me@ansible:~/ansible$ ansible-playbook plays/win-test.yml -i staging.ini --limit windows

PLAY [all] ***************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************
ok: [windows-server.my.domain.name]

TASK [Install Icinga 2] **************************************************************************************************
changed: [windows-server.my.domain.name]

PLAY RECAP ***************************************************************************************************************
windows-server.my.domain.name   : ok=2    changed=1    unreachable=0    failed=0   

相关内容