我是 Ansible 的新手,我正在尝试从 RHEL Centos 7 Node 配置 windows 2012 R2。我可以使用 Winrm Credssp 在它们之间建立连接。下面是 /etc/ansible/group_vars/windows.yml 文件
---
ansible_user: admin
ansible_password: XXXXXXX
ansible_winrm_scheme: https
ansible_winrm_transport: credssp
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
validate_certs: false
在 /etc/ansible/hosts 文件中,我定义了 windows FQDN
[windows]
xx.xx.xx.xx
当我执行 win_ping 模块以测试从中央 Linux 节点到 Windows 2012 R2 服务器的连接时,它是成功的。
[root@centos playbooks]# ansible windows -m win_ping
XX.XX.XX.XX | SUCCESS => {
"changed": false,
"ping": "pong"
}
但是当我尝试使用下面的 playbook 文件在本地驱动器中安装示例 .exe (VLC) 文件时,在提交 ansible-playbook playbook.yml 命令后,它一直在无限期等待,因为它没有完成 .exe 安装。注意: PsExec.exe 位置在 Windows 的 PATH 环境变量中更新。
---
- name: Windows ansible playbook
hosts: windows
tasks:
- name: installing VLC
win_psexec:
command: 'E:\\Softwares\\VLC.exe'
system: yes
以下是为上述剧本提交 ansible-playbook 命令后的控制台输出。
PLAY [Windows ansible playbook] ************************************************
TASK [Gathering Facts] *********************************************************
ok: [192.168.2.14]
TASK [installing VLC] **********************************************************
下面是不断显示相同的日志。不断等待。/var/log/ansible/日志
2017-10-27 22:22:32,574 p=4269 u=root | TASK [installing VLC] **********************************************************
2017-10-27 22:22:32,672 requests_credssp.credssp The credentials that will be used in the auth, DOMAIN: '.', USER: 'admin'
2017-10-27 22:22:32,675 requests.packages.urllib3.connectionpool Starting new HTTPS connection (1): 192.168.2.14
2017-10-27 22:22:32,712 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 401 0
2017-10-27 22:22:32,714 requests_credssp.credssp _start_tls_handshake(): Starting TLS handshake with server
2017-10-27 22:22:32,715 requests.packages.urllib3.connectionpool Resetting dropped connection: 192.168.2.14
2017-10-27 22:22:32,771 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 401 0
2017-10-27 22:22:32,774 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 401 0
2017-10-27 22:22:32,775 requests_credssp.credssp _start_tls_handshake(): Handshake complete. Protocol: TLSv1.2, Cipher: ECDHE-RSA-AES256-GCM-SHA384
2017-10-27 22:22:32,775 requests_credssp.credssp _get_authentication_token(): creating NTLM negotiate token and add it to the initial TSRequest
2017-10-27 22:22:32,776 requests_credssp.credssp _get_authentication_token(): NTLM Negotiate Token: TlRMTVNTUAABAAAAMpCI4gEAAQAoAAAAAAAAACkAAAAGAbEdAAAADy4=
2017-10-27 22:22:32,776 requests_credssp.credssp _get_authentication_token(): get NTLM challenge token from the server and add it to the ntlm context
2017-10-27 22:22:32,777 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 401 0
2017-10-27 22:22:32,779 requests_credssp.credssp _get_authentication_token(): NTLM Challenge Token: TlRMTVNTUAACAAAADwAPADgAAAA2goriAQ4M49EAIqMAAAAAAAAAAJgAmABHAAAACgBaKQAAAA9ERVNLVE9QLUVETEFLRzQCAB4ARABFAFMASwBUAE8AUAAtAEUARABMAEEASwBHADQAAQAeAEQARQBTAEsAVABPAFAALQBFAEQATABBAEsARwA0AAQAHgBEAEUAUwBLAFQATwBQAC0ARQBEAEwAQQBLAEcANAADAB4ARABFAFMASwBUAE8AUAAtAEUARABMAEEASwBHADQABwAIAGOmEf9DT9MBAAAAAA==
2017-10-27 22:22:32,779 requests_credssp.credssp _get_authentication_token(): create NTLM authentication token
2017-10-27 22:22:32,782 requests_credssp.credssp _send_auth_response(): Generate the encrypted public key data and add it to the TSRequest
2017-10-27 22:22:32,783 requests_credssp.credssp _send_auth_response(): Send TSRequest structure containing the final auth token and public key info
2017-10-27 22:22:32,783 requests_credssp.credssp _send_auth_response(): Get the public key structure response from the server
2017-10-27 22:22:32,786 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 401 0
2017-10-27 22:22:32,786 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 401 0
2017-10-27 22:22:32,787 requests_credssp.credssp _verify_public_keys(): Get raw public key from the server and decrypt it for verification
2017-10-27 22:22:32,788 requests_credssp.credssp _verify_public_keys(): verification of the server's public key is successful
2017-10-27 22:22:32,788 requests_credssp.credssp _send_encrypted_credentials(): Sending the encrypted credentials to the server
2017-10-27 22:22:32,822 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 200 1636
2017-10-27 22:22:32,832 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 200 847
2017-10-27 22:22:33,116 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 200 753
2017-10-27 22:22:33,889 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 200 998
2017-10-27 22:22:53,934 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 500 1320
2017-10-27 22:23:13,978 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 500 1320
2017-10-27 22:23:34,024 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 500 1320
2017-10-27 22:23:54,069 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 500 1320
2017-10-27 22:24:14,114 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 500 1320
上述日志每 20 秒继续/更新相同。此任务 .exe 安装从未完成。
2017-10-27 22:24:14,114 requests.packages.urllib3.connectionpool "POST /wsman HTTP/1.1" 500 1320
请建议我必须在 Windows 端进行哪些更改/更新,以便完成 .exe 文件安装。