I have a playbook with a couple dozen tasks. It runs against 3000 Windows 
Server targets with 1000 forks and `strategy: host_pinned`. It takes about 
two hours to run to completion when 90% of servers have no changes to be 
made. 

Had an idea to speed it up: Write a pre_task that runs a powershell script 
to collect some basic info. All other tasks are in blocks with `when:` 
parameters that skip the block if the output of the pre_task was correct. 
This took the runtime against one node from multiple minutes down to just a 
few seconds. 

But a run against all 3000 servers still ran for just under two hours. 
Looking at the individual logs for each host, there's tens of seconds to 
multiple minutes between each skipped step - When there should be 
milliseconds, or a couple seconds at worst. 

Almost like it's waiting for other hosts to complete the step before it 
moves on... that's the behavior I'd expect if I had set a `serial` value 
... not the behavior when using a large fork count and host_pinned strategy

*Am I doing something wrong here? How can I speed up execution against 
individual hosts?*


-----------------------------

- Running Ansible in a Podman container on a server with 12 CPU cores and 
32 GB RAM. 
- Podman Stats show an initial spike of 500 PIDs for the container for 
10-20 seconds, then for the rest of the play, it averages 10ish pids, 
sometimes spiking up to 50 ... nowhere near 1000
- I'm not seeing CPU or RAM or Disk IO pressure. 

my_playbook.yml
```
---
- name: MyPlaybook
  hosts: all
  gather_facts: false
  strategy: host_pinned
  tasks:
  [...]
```


ansible.cfg
```
[defaults]
forks=1000
log_path=/var/log/ansible.log
callback_whitelist=log_plays
#display_args_to_stdout=True

[callback_log_plays]
log_folder = /var/log/ansible/hosts
```

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7063a51b-8aa8-42e6-82d5-2b3f17d1530dn%40googlegroups.com.

Reply via email to