-
When running spot with a specific target (e.g., spot -t prod), all tasks are executed, including those not assigned to the specified target. This behavior appears to ignore the target filtering defined in the configuration. I’m wondering if this is expected behavior or if I might have a configuration issue. Could you confirm if this behavior is correct, or suggest adjustments to the configuration? Example Configuration:ssh_key: keys/id_ed25519
targets:
prod:
hosts: [{ host: "public-vpn", user: "root" }]
dev:
hosts: [{ host: "public-vpn.dev", user: "root" }]
tasks:
- name: config prod node
targets: ["prod"]
commands:
- name: command1
script: echo "Prod Hello World"
- name: config dev node
targets: ["dev"]
commands:
- name: command_2
script: echo "Dev Hello World" Bash:> spot -t prod
spot v1.16.3-54baca2-2024-12-20T23:47:00Z
[public-vpn:22] run task "config prod node", commands: 1
[public-vpn:22] completed command "command1" {script: /bin/sh -c 'echo "Prod Hello World"'} (1s)
[public-vpn:22] completed task "config prod node", commands: 1 (3.126s)
[public-vpn:22] run task "config dev node", commands: 1
[public-vpn:22] completed command "command_2" {script: /bin/sh -c 'echo "Dev hello World"'} (786ms)
[public-vpn:22] completed task "config dev node", commands: 1 (3.018s) Environment: macOS Sequoia 15.2 |
Beta Was this translation helpful? Give feedback.
Answered by
umputun
Jan 14, 2025
Replies: 1 comment 2 replies
-
Please use discussion for questions like this, transferred. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tasks are not assigned to specific targets in the way you meant, i.e., it is not a matching filter. The documentation mentions what it does: see https://github.com/umputun/spot?tab=readme-ov-file#tasks-and-commands
In a simple case, the usage for such targets included in tasks is to be able to run complex playbooks affecting different hosts in different ways. This is a practical example of such usage - some commands run on a master server, and some comma…