Hi (again!)
Found another unexpected issue with my code.
I'm trying to automate the deployment of an application which consists of some java processes in Linux servers, and then a GUI client running on Windows. So, I'm using a delegated task to clear some cached files in the Windows servers when I change the app version in the backend.
I've simplified the problem I'm seeing into the following play:
---
- hosts: server1.example.com
tasks:
- win_file: path="c:\\ansible\\test\\" state=absent
delegate_to: "{{ item }}"
with_items: groups['gui']
"
server1.example.com" is a server on which the backend processes run. The "gui" group has two different windows servers, accessed via AD login.
In the logs, I see a connection attempt to the first windows server, and an OK notice for both servers in the GUI group, but I don't see a connection attempt to the second server (and the directory is not removed by the win_file module)
user@server1 ~/ansible $ ansible-playbook test-play.yml -vvv
Using /home/user/ansible/ansible.cfg as config file
1 plays in test-play.yml
PLAY ***************************************************************************
TASK [win_file path=c:\ansible\test state=absent] ******************************
task path: /home/user/ansible/test-play.yml:5
<win_server1.example.com> ESTABLISH WINRM CONNECTION FOR USER: user@AD.EXAMPLE.COM on PORT 5986 TO win_server1.example.com
<win_server1.example.com> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name "ansible-tmp-1452798020.43-89194208822402").FullName | Write-Host -Separator '';
<win_server1.example.com> PUT "/tmp/tmptYf5CN" TO "C:\Users\user\AppData\Local\Temp\ansible-tmp-1452798020.43-89194208822402\win_file.ps1"
<win_server1.example.com> EXEC Set-StrictMode -Version Latest [removed powershell code]
<win_server1.example.com> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name "ansible-tmp-1452798023.15-66214194598336").FullName | Write-Host -Separator '';
<win_server1.example.com> PUT "/tmp/tmpENwt43" TO "C:\Users\user\AppData\Local\Temp\ansible-tmp-1452798023.15-66214194598336\win_file.ps1"
<win_server1.example.com> EXEC Set-StrictMode -Version Latest [removed powershell code]
ok: [server1.example.com -> win_server1.example.com] => (item=win_server1.example.com) => {"changed": false, "invocation": {"module_args": {"path": "c:\\ansible\\test", "state": "absent"}, "module_name": "win_file"}, "item": "win_server1.example.com"}
ok: [server1.example.com -> win_server2.example.com] => (item=win_server2.example.com) => {"changed": false, "invocation": {"module_args": {"path": "c:\\ansible\\test", "state": "absent"}, "module_name": "win_file"}, "item": "win_server1.example.com"}
PLAY RECAP *********************************************************************
server1.example.com : ok=1 changed=0 unreachable=0 failed=0 I'm thinking on several other ways to do what led me to need the above code, but it certainly looks like unexpected behavior.
Regards