Open freeseacher opened 2 years ago
The current task logic doesn't support your code yet, but there's a way to do it:
I know what you're aiming at here, and when I start working on enhancing the tasks logic I'll keep this workflow in mind (will keep the issue open as well). Currently targets only work for the root task (the task you invoke when you run sake run <task>
, this is because tasks can be nested, and so it becomes unclear which tags will take precedence.
via server environment variable tags:
tasks:
stop-vm-insert:
cmd: |
if [[ $SAKE_SERVER_TAGS == *"insert"* ]];
then
echo "systemctl stop vm-insert";
fi
stop-vm-storage:
cmd: |
if [[ $SAKE_SERVER_TAGS == *"insert"* ]];
then
echo "systemctl stop vm-storage";
fi
stop-daemons:
target:
all: true
tasks:
- task: stop-vm-insert
- task: stop-vm-storage
and run sake run stop-daemons
.
Or:
stop-vm-insert:
target:
tags: [insert]
cmd: |
echo "systemctl stop vm-insert";
stop-vm-storage:
target:
tags: [storage]
cmd: |
echo "systemctl stop vm-storage";
and run sake run stop-vm-insert stop-vm-storage
Oh tnx! looks like option 2 is fine enough :)
I want to stop system on several servers. I have two types of servers insert and storages. on servers with tag insert i need to run command
systemctl stop vm-insert
and on storagessystemctl stop vm-storage
i've made such configi'm expecting that commands must be issued only on target servers but instead they are run on both target groups.
Any ideas on how to do so ?