You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrating a lot of code from ansible to spot I thought it could be very convenient to have more commands to have tasks more human-readable look (lower human factor, self-documented code). At the same time it's good to keep spot simple itself.
As an option, is it possible and is it good idea to add something like macros? They could be inlined during run, so it is should be easy to code.
Also possibility to include yaml from other files via 'include:' in yaml or multiple --include ... in command line (with deep merge of the structure) will add more flexibility.
It could be something like:
vars:
chatId: 12345macros:
mkdir:
type: iterate # 'iterate' to run script multiple times or 'join' to run command with all args joined via space characterscript: mkdir -p {SPOT_MACRO_ARG}notify:
# new variables like {SPOT_PREV_TASK} and {SPOT_NEXT_TASK} with names of previous and next tasks could be usefulscript: | # some long multiline command that should be runned between tasks; # for example long curl query to notify to some chat about progress via http api curl -X POST https://crm.example.com/notify/ \ -H 'Content-Type: application/json' \ -d '{"task_done":"{SPOT_PREV_TASK}","task_next":"{SPOT_NEXT_TASK}", "chat_id": "$chatId", message: "{SPOT_MACRO_ARG}" }'cp: # just as example of custom internal varsscript: cp "{from}" "{to}"include: "macros/extended.yaml"# or multiple files:# include: # - "macros/one.yml"# - "macros/two.yml"# - "vendor/tasks.yml"task:
- name: create one dir with command in the same linemkdir: /path/to/dir
- name: notify to chatnotify: "Hurray!"
- name: create multiple dirsmkdir:
- "/path/to/dir1"
- "/path/to/dir2"
- "/path/to/dir3"
- name: notify to chatnotify: "Hurray!"
- name: copy filescp:
from: "..."to: "..."
- name: notify to chatnotify: "Hurray!"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Spot has minimal command types and that's perfect.
Migrating a lot of code from ansible to spot I thought it could be very convenient to have more commands to have tasks more human-readable look (lower human factor, self-documented code). At the same time it's good to keep spot simple itself.
As an option, is it possible and is it good idea to add something like macros? They could be inlined during run, so it is should be easy to code.
Also possibility to include yaml from other files via 'include:' in yaml or multiple
--include ...
in command line (with deep merge of the structure) will add more flexibility.It could be something like:
Just as an idea.
Beta Was this translation helpful? Give feedback.
All reactions