Spyke

How to parallelize execution on a single host?

I'm setting up an application using containers with ansible. I want to be able to set up the same application multiple times with a different set of variables. Is there a way how I could do this in parallel on a single host? I know I could deploy the same application n times on n different hosts, but what about n times on a single host? Is something like this possible? Doing it sequential obviously works, but it doesn't scale well.

View original on feddit.org
sh.itjust.works

If it's only one task that takes very long, and you don't have any follow up tasks that rely on the outcome of the previous task, you might want to set async: true for that task.

2

I think you can use async on task level only, but the documentation would be wider than me on that detail.

1
sh.itjust.works

I just had another idea: you could use the Mitogen execution strategy. It doesn't make your tasks run in parallel, but it takes away a lot of the overhead involved in running Ansible, so you might get some performance gains there. It's not running your tasks in parallel though...

For real parallel execution, you would probably need multiple hosts. I don't think what you're trying to do is even a part of Ansible on the conceptual level.

1

You reached the end

How to parallelize execution on a single host? | Spyke