Ansible WinRM dont run concurrent process

Hi,

We have 3 playbooks that runs concurrently winrm process on a windows server, I did notice even when I start all of then in the same time, only 1 runs, the others get stuck and wait for the first to finish, then starts.

I did follow all the documentation that I could find and this is my current conf :

PS C:\Windows\system32> winrm get winrm/config/Winrs
Winrs
AllowRemoteShellAccess = true
IdleTimeout = 7200000
MaxConcurrentUsers = 10
MaxShellRunTime = 2147483647
MaxProcessesPerShell = 25
MaxMemoryPerShellMB = 1024
MaxShellsPerUser = 30

All the 3 process runs 3 tasks each on winrm.

Is this an normal behavior ? What can I do to change that ? Should it be able to run in parallel ?

There is any docs someone can point me out about how to setup winrm to allow +2 process to run simultaneously ?

Best Regards,
Wagner.

How are you making them concurrent? IE what does your play look like?

If you have three conventional separate ansible tasks, that won’t work. You’d need a single task that launches all 3 or use async.

https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html

If you’re already using async, show us your playbook.

Hi Dylan Martin,

Thanks for your response.
I am simple starting 3 playbooks runs in the crontab as follows :

50 22 * * * /etc/ansible/playbooks/bkp_small_1818.sh
05 22 * * * /etc/ansible/playbooks/bkp_big_1818.sh
00 22 * * * /etc/ansible/playbooks/bkp_big2_1818.sh

The shells calls the correspondent yamls : ansible-playbook /etc/ansible/playbooks/bkp_small.yaml -f 10

The tasks of all of it looks the same like this (diference are the database name and file names) :

task1 : win_shell to the sqlserver to create the bkps
task2 : win_shell to zip the files
task3 : win_shell to copy files to local dir
task4 : win_copy to copy to cloud dir

They are starting simultaneous, but it seems for some reason the task waits some other playbooks task to finish, this is an example of my task1 :

  • name: bkp_sql
    win_shell: DTEXEC.EXE /SQL “Maintenance Plans\AnsibleBkpSmall” /Server Server\DATACENTER
    remote_user: user
    register: bkp_sql
  • debug: msg=“{{ bkp_sql.stdout.split(‘\n’) }}”
  • local_action: copy content=“{{ bkp_sql }}” dest=“/etc/ansible/playbooks/logs/s1.db.small.bkp.log”

I read the documentation you sent, but I am not sure I understood how it will help here, in my case, I am starting 3 playbooks simultaneous, for some reason 1 playbook waits for the other to finish, I could rewrite all of this to one playbook, that would fix my problem, but I am curious to know why this is happening, it seems to be something related with the winrm and maybe an simple winrm or windows setting fix it…

Regards,
Wagner.