Repository navigation
|
Is there a way to define, or expand, targets as a range, like "n[1:500].cluster.hpc"? Related, can you build and use target lists using the dynamic-target approach? |
Answered by
umputun
Nov 1, 2026
Replies: 1 comment
|
no range syntax in spot, neither in targets nor in the inventory. For a range, generate the inventory and run against the group. Hosts in one group run in parallel with { echo "groups:"; echo " hpc:"; for i in $(seq 1 500); do echo " - {host: n$i.cluster.hpc}"; done; } > inventory.yml
spot -i inventory.yml -t hpc -c 50
a dynamic target resolves to one target name, so a list of hosts in the variable won't work. The name can be a group, tag or playbook target, and spot expands it to all its hosts: tasks:
- name: pick group
targets: ["default"]
options: {local: true}
commands:
- name: set group
script: export grp=hpc
- name: run on group
targets: ["$grp"]
commands:
- name: show host
script: hostname |
0 replies
Answer selected by
umputun
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
no range syntax in spot, neither in targets nor in the inventory. For a range, generate the inventory and run against the group. Hosts in one group run in parallel with
-c:{ echo "groups:"; echo " hpc:"; for i in $(seq 1 500); do echo " - {host: n$i.cluster.hpc}"; done; } > inventory.yml spot -i inventory.yml -t hpc -c 50-ialso accepts a URL, so the list can come from an HTTP endpoint.a dynamic target resolves to one target name, so a list of hosts in the variable won't work. The name can be a group, tag or playbook target, and spot expands it to all its hosts: