Hi Guys,
The antivirus I have installed on some of my test windows hosts are causing scripts to be flagged as malicious and thus they are failing when run. I don’t think that the code is malicious, it’s a simple ping via the win_shell module . Will you please review my results/playbook and give suggestions? How do I prevent this from happening to other non-malicious code?
I should also ask, what is the safe way to allow ansible to execute PowerShell code?
Right now I have the ExecutionPolicy set as unrestricted. My ansible control node connects to my windows hosts via WinrM and certificate based authentication. Your thoughts are welcome.
mramanan@hgiclprint1:/etc/ansible$ ansible-playbook -i Inventory/macoya_inventory.ini Playbooks/win_ping.yml
PLAY [Test Windows Host Connectivity] *****************************************************************************************************************************************************************************
TASK [Ping Windows Hosts] *****************************************************************************************************************************************************************************************
fatal: [dell3070-carlho]: FAILED! => {"changed": false, "module_stderr": "At line:1 char:1\r\n+ begin {\r\n+ ~~~~~~~\r\nThis script contains malicious content and has been blocked by your antivirus software.\r\n + CategoryInfo : ParserError: (:) [], ParseException\r\n + FullyQualifiedErrorId : ScriptContainedMaliciousContent\r\n ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
fatal: [Dellopt9020pos1]: UNREACHABLE! => {"changed": false, "msg": "certificate: the specified credentials were rejected by the server", "unreachable": true}
fatal: [dell3070-ashley]: FAILED! => {"changed": false, "module_stderr": "At line:1 char:1\r\n+ begin {\r\n+ ~~~~~~~\r\nThis script contains malicious content and has been blocked by your antivirus software.\r\n + CategoryInfo : ParserError: (:) [], ParseException\r\n + FullyQualifiedErrorId : ScriptContainedMaliciousContent\r\n ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
ok: [11sgdell1]
fatal: [Len710tuna1]: FAILED! => {"changed": false, "module_stderr": "At line:1 char:1\r\n+ begin {\r\n+ ~~~~~~~\r\nThis script contains malicious content and has been blocked by your antivirus software.\r\n + CategoryInfo : ParserError: (:) [], ParseException\r\n + FullyQualifiedErrorId : ScriptContainedMaliciousContent\r\n ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
fatal: [claims-tuna2]: UNREACHABLE! => {"changed": false, "msg": "certificate: HTTPSConnectionPool(host='172.22.248.210', port=5986): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fa9776e3220>, 'Connection to 172.22.248.210 timed out. (connect timeout=30)'))", "unreachable": true}
fatal: [hgicl-pc-kamille]: FAILED! => {"changed": false, "module_stderr": "At line:1 char:1\r\n+ begin {\r\n+ ~~~~~~~\r\nThis script contains malicious content and has been blocked by your antivirus software.\r\n + CategoryInfo : ParserError: (:) [], ParseException\r\n + FullyQualifiedErrorId : ScriptContainedMaliciousContent\r\n ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
fatal: [3060MKTTUN1MELISSA]: UNREACHABLE! => {"changed": false, "msg": "certificate: HTTPSConnectionPool(host='172.22.248.201', port=5986): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fa9776f3b20>, 'Connection to 172.22.248.201 timed out. (connect timeout=30)'))", "unreachable": true}
PLAY RECAP ********************************************************************************************************************************************************************************************************
11sgdell1 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
3060MKTTUN1MELISSA : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
Dellopt9020pos1 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
Len710tuna1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
claims-tuna2 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
dell3070-ashley : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
dell3070-carlho : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
hgicl-pc-kamille : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
mramanan@hgiclprint1:/etc/ansible$ cat Playbooks/win_ping.yml
---
- name: Test Windows Host Connectivity
hosts: windows
gather_facts: no
tasks:
- name: Ping Windows Hosts
win_ping:
mramanan@hgiclprint1:/etc/ansible$