host_pinned strategy not working as expected?

21 views
Skip to first unread message

Chris Ruscio

unread,
Nov 11, 2020, 11:40:40 AM11/11/20
to Ansible Project
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
  hostsall
  gather_factsfalse
  strategyhost_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
```

Anitha sreejith

unread,
Nov 11, 2020, 3:25:02 PM11/11/20
to ansible...@googlegroups.com
Hello all,

I tried to create basic playbook to collect all windows facts. I could ping the server well but "ansible_facts" is not giving me any info. I end up with error.

Whereas when I run ad hoc command using setup module I could see beautiful windows facts in Jason format. What is the issue when the same kind of output is expected from playbook.

Can anyone help please?


Regards,
Anitha

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7063a51b-8aa8-42e6-82d5-2b3f17d1530dn%40googlegroups.com.

Anitha sreejith

unread,
Nov 11, 2020, 3:27:59 PM11/11/20
to ansible...@googlegroups.com

Antony Stone

unread,
Nov 11, 2020, 3:31:59 PM11/11/20
to ansible...@googlegroups.com
On Wednesday 11 November 2020 at 21:27:21, Anitha sreejith wrote:

> Hello all,
>
> I tried to create basic playbook to collect all windows facts. I could ping
> the server well but "ansible_facts" is not giving me any info. I end up
> with error.

What is the error?

> Whereas when I run ad hoc command using setup module I could see beautiful
> windows facts in Jason format.

What is the command?

> What is the issue when the same kind of output is expected from playbook.

Can you show us the playbook?

> Can anyone help please?

We need more information about exactly what you are doing and exactly what the
result is.


Antony.

--
The more 'success' you get, the easier it is to be disappointed by not getting
things.
The only difference is that now no-one feels sorry for you.

- Matt Haig

Please reply to the list;
please *don't* CC me.
Reply all
Reply to author
Forward
0 new messages