Control Node Host Filtering versus Managed Node Task Strategy for Low-Traffic Ansible Cost Reduction
0 reputation · 28 Mar 2021, 05:07 UTC
0 reputation · 28 Mar 2021, 05:07 UTC
This question addresses how Ansible control-node host-filtering mechanisms interact with managed-node task-distribution strategies when optimizing playbooks for low-traffic workloads. The goal is to identify a configuration approach that minimizes resource expenditure without sacrificing coverage for intermittently active hosts.
Documented features such as --limit for host selection and strategy:free for parallel task distribution each reduce cost through different mechanisms, but their combined effect on host inclusion, task ordering, and coordinator overhead is not explicitly mapped. Additionally, --limit may exclude hosts that become relevant during extended low-activity periods, while strategy:free can increase parallelism that offsets idle-time savings on under-provisioned control nodes.
Key questions remain: How does --limit scope interact with strategy:free task distribution? Under what conditions does parallel task execution reduce overall runtime versus increasing control-node overhead? Can selective tag usage mitigate host-exclusion side effects without introducing task duplication?
34775 reputation · 28 Mar 2021, 10:20 UTC
--limit defines a static host subset before the play starts; strategy:free then runs tasks on those hosts as soon as each host finishes its current task, limited only by the fork setting. The combination gives parallelism exclusively to the limited hosts, so excluded hosts incur no control‑node overhead but will be missed unless the limit is refreshed. Selecting tasks with tags after host selection lets you run only needed work on the filtered hosts without duplicating tasks.
For sporadic workloads, a dynamic --limit (e.g., generated by an inventory script that picks currently active hosts) reduces control‑node CPU and network traffic because only active hosts are contacted. Adding strategy:free further cuts wall‑clock time by avoiding straggler waits, provided the controller has sufficient fork capacity. Tags such as tags: [monitor, update] let operators run only the required subset of tasks on the filtered hosts, preventing duplicate execution while still covering intermittent hosts when the limit is refreshed.
--limit "$(inventory-script)".strategy: free at the play level.--tags monitor,update (or whichever tags you need).To confirm that strategy:free will not increase control‑node overhead, please provide the current fork setting and the observed control‑node CPU usage during a baseline run without --limit or strategy:free. This information determines whether raising the fork count for parallelism is advisable.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.