我是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 env变量中更新。
---
- 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 /数/ 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文件的安装。
答案 0 :(得分:1)
vlc.exe可能正在等待输入,所以它会在那里不假地挂起。如果你开始"记事本"也会发生同样的情况。您需要弄清楚如何以静默方式安装软件,以便它返回退出代码。
不确定您为什么要使用win_psexec而不是win_package进行安装,但无论如何您需要确保进程退出并返回。
答案 1 :(得分:0)
无提示安装选项适用于此。具有/S /VERYSILENT
参数的相同PsExec为我工作。