update kestra templates

This commit is contained in:
Christian Lempa
2024-12-03 14:43:56 +01:00
parent 66cea5731b
commit a4c2b01d92
11 changed files with 92 additions and 89 deletions
+11 -11
View File
@@ -4,20 +4,20 @@
#
# Run an ansible playbook defined inline the kestra flow.
#
id: ansible_job
namespace: # your-namespace
id: ansible_job # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
- id: ansible
- id: ansible # <- Replace with your task id...
type: io.kestra.plugin.core.flow.WorkingDirectory
tasks:
- id: local_files
type: io.kestra.core.tasks.storages.LocalFiles
- id: local_files # <- Replace with your task id...
type: io.kestra.plugin.core.storage.LocalFiles
inputs:
inventory.ini: |
inventory.ini: | # <- Replace with your inventory file content...
srv-demo-1.home.clcreative.de
# --> replace with your playbook
myplaybook.yaml: |
myplaybook.yaml: | # <- Replace with your playbook file content...
---
- hosts: srv-demo-1.home.clcreative.de
tasks:
@@ -27,8 +27,8 @@ tasks:
upgrade: true
update_cache: true
# <--
id_rsa: "{{ secret('SSH_KEY') }}"
- id: ansible_task
id_rsa: "{{ secret('SSH_KEY') }}" # <- Replace with your secret key...
- id: ansible_task # <- Replace with your task id...
type: io.kestra.plugin.ansible.cli.AnsibleCLI
docker:
image: docker.io/cytopia/ansible:latest-tools
@@ -39,4 +39,4 @@ tasks:
# "ANSIBLE_REMOTE_USER": "your-remote-user"
# <--
commands:
- ansible-playbook -i inventory.ini --key-file id_rsa myplaybook.yaml
- ansible-playbook -i inventory.ini --key-file id_rsa myplaybook.yaml # <- Replace with your inventory and playbook files...
+8 -8
View File
@@ -4,21 +4,21 @@
#
# Run an ansible playbook which has been uploaded to the server.
#
id: ansible_job
namespace: # your-namespace
id: ansible_job # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
- id: ansible
- id: ansible # <- Replace with your task id...
type: io.kestra.plugin.core.flow.WorkingDirectory
tasks:
- id: ansible_task
- id: ansible_task # <- Replace with your task id...
namespaceFiles:
enabled: true
# --> upload your files to the kestra data directory for the namespace in
# <docker volume for kestra-data>/<namespace>/_files/
include:
- inventory.ini
- myplaybook.yaml
- inventory.ini # <- Replace with your inventory file...
- myplaybook.yaml # <- Replace with your playbook file...
# <--
type: io.kestra.plugin.ansible.cli.AnsibleCLI
docker:
@@ -29,5 +29,5 @@ tasks:
# "ANSIBLE_REMOTE_USER": "your-remote-user"
# <--
commands:
- apk add sshpass # only required if use ssh passwords.
- ansible-playbook -i inventory.ini myplaybook.yaml
- apk add sshpass # <- (Optional) Only required if use ssh passwords.
- ansible-playbook -i inventory.ini myplaybook.yaml # <- Replace with your inventory and playbook files...
+9 -9
View File
@@ -5,25 +5,25 @@
# Run an ansible playbook which has been uploaded to the server, using
# ssh key authentication.
#
id: ansible_job
namespace: # your-namespace
id: ansible_job # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
- id: ansible
- id: ansible # <- Replace with your task id...
type: io.kestra.plugin.core.flow.WorkingDirectory
tasks:
- id: load_ssh_key
type: io.kestra.core.tasks.storages.LocalFiles
- id: load_ssh_key # <- Replace with your task id...
type: io.kestra.plugin.core.storage.LocalFiles
inputs:
id_rsa: "{{ secret('SSH_KEY') }}"
id_rsa: "{{ secret('SSH_KEY') }}" # <- Replace with your secret key...
- id: ansible_task
namespaceFiles:
enabled: true
# --> upload your files to the kestra data directory for the namespace in
# <docker volume for kestra-data>/<namespace>/_files/
include:
- inventory.ini
- myplaybook.yaml
- inventory.ini # <- Replace with your inventory file...
- myplaybook.yaml # <- Replace with your playbook file...
# <--
type: io.kestra.plugin.ansible.cli.AnsibleCLI
docker:
@@ -35,4 +35,4 @@ tasks:
# "ANSIBLE_REMOTE_USER": "your-remote-user"
# <--
commands:
- ansible-playbook -i inventory.ini --key-file id_rsa myplaybook.yaml
- ansible-playbook -i inventory.ini --key-file id_rsa myplaybook.yaml # <- Replace with your inventory and playbook files...
+13 -13
View File
@@ -5,35 +5,35 @@
# Build a Docker image from a File.
#
id: docker-file-build
namespace: # your-namespace
id: docker-file-build # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
- id: file
type: io.kestra.core.tasks.flows.WorkingDirectory
- id: file # <- Replace with your task id...
type: io.kestra.plugin.core.flow.WorkingDirectory
tasks:
- id: createFiles
type: io.kestra.core.tasks.storages.LocalFiles
- id: createFiles # <- Replace with your task id...
type: io.kestra.plugin.core.storage.LocalFiles
inputs:
Dockerfile: |
Dockerfile: | # <- Replace with your Dockerfile content...
FROM alpine:latest
WORKDIR /app
COPY . /app
RUN apk add --update python3
CMD [ "python", "main.py"]
main.py: |
main.py: | # <- Replace with your Python script content...
if __name__ == "__main__":
print("Hello from Docker!")
exit(0)
- id: build
- id: build # <- Replace with your task id...
type: io.kestra.plugin.docker.Build
dockerfile: "src/Dockerfile"
dockerfile: "src/Dockerfile" # <- Replace with your Dockerfile path...
tags:
- your-username/your-repository:your-tag
- your-username/your-repository:your-tag # <- Replace with your Docker image tag...
push: true
credentials:
registry: https://index.docker.io/v1/
username: "{{ secret('YOUR_USERNAME') }}"
password: "{{ secret('YOUR_PASSWORD') }}"
username: "{{ secret('YOUR_USERNAME') }}" # <- Replace with your Docker Hub username...
password: "{{ secret('YOUR_PASSWORD') }}" # <- Replace with your Docker Hub password...
+15 -14
View File
@@ -5,26 +5,27 @@
# Build a Docker image from a Git repository.
#
id: docker-git-build
namespace: # your-namespace
id: docker-git-build # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
- id: git
type: io.kestra.core.tasks.flows.WorkingDirectory
tasks:
- id: clone
type: io.kestra.plugin.git.Clone
url: https://your-git-repo-url
branch: your-branch
- id: git # <- Replace with your task id...
type: io.kestra.plugin.core.flow.WorkingDirectory
- id: build
tasks:
- id: clone # <- Replace with your task id...
type: io.kestra.plugin.git.Clone
url: https://your-git-repo-url # <- Replace with your Git repository URL...
branch: your-branch # <- Replace with your Git branch...
- id: build # <- Replace with your task id...
type: io.kestra.plugin.docker.Build
dockerfile: "src/Dockerfile"
dockerfile: "src/Dockerfile" # <- Replace with your Dockerfile path...
tags:
- your-username/your-repository:your-tag
- your-username/your-repository:your-tag # <- Replace with your Docker image tag...
push: true
credentials:
registry: https://index.docker.io/v1/
username: "{{ secret('YOUR_USERNAME') }}"
password: "{{ secret('YOUR_PASSWORD') }}"
username: "{{ secret('YOUR_USERNAME') }}" # <- Replace with your Docker Hub username...
password: "{{ secret('YOUR_PASSWORD') }}" # <- Replace with your Docker Hub password...
View File
+20 -20
View File
@@ -5,61 +5,61 @@
# Inputs is a list of dynamic values passed to the flow at runtime.
#
id: inputs
namespace: # your-namespace
id: inputs # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
inputs:
- id: string
- id: string # <- Replace with your input name...
type: STRING
- id: optional
- id: optional # <- Replace with your input name...
type: STRING
required: false
- id: int
- id: int # <- Replace with your input name...
type: INT
- id: bool
- id: bool # <- Replace with your input name...
type: BOOLEAN
- id: float
- id: float # <- Replace with your input name...
type: FLOAT
- id: instant
- id: instant # <- Replace with your input name...
type: DATETIME
- id: date
- id: date # <- Replace with your input name...
type: DATE
- id: time
- id: time # <- Replace with your input name...
type: TIME
- id: duration
- id: duration # <- Replace with your input name...
type: DURATION
- id: file
- id: file # <- Replace with your input name...
type: FILE
- id: optionalFile
- id: optionalFile # <- Replace with your input name...
type: FILE
- id: instantDefaults
- id: instantDefaults # <- Replace with your input name...
type: DATETIME
defaults: "2013-08-09T14:19:00Z"
defaults: "2013-08-09T14:19:00Z" # <- Replace with your default value...
- id: json
- id: json # <- Replace with your input name...
type: JSON
- id: uri
- id: uri # <- Replace with your input name...
type: URI
- id: secret
- id: secret # <- Replace with your input name...
type: SECRET
- id: nested.string
- id: nested.string # <- Replace with your input name...
type: STRING
tasks:
- id: using_inputs
type: io.kestra.core.tasks.log.Log
type: io.kestra.plugin.core.log.Log
message: "{{ inputs.string }}"
+3 -2
View File
@@ -7,9 +7,10 @@
# usage:
# make sure the Kestra instance can access the /app/scripts/your-python-script.py file
# if you're running Kestra in Docker, use a volume to mount the file/directory.
#
id: python-command
namespace: # your-namespace
id: python-command # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
+2 -2
View File
@@ -5,8 +5,8 @@
# This template is a simple Python script that can be used to make a request to a website and log the status code.
#
id: python-script
namespace: # your-namespace
id: python-script # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
+5 -5
View File
@@ -2,16 +2,16 @@
# Kestra Variable Template
# ---
#
#
# Variables is a list of static values passed to the flow at runtime.
#
id: variables
namespace: # your-namespace
id: variables # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
variables:
variable-name: "variable-value"
variable-name: "variable-value" # <- Replace with your variable name and value...
tasks:
- id: using_variables
type: io.kestra.core.tasks.log.Log
type: io.kestra.plugin.core.log.Log
message: "{{ vars.variable-name }}"
+6 -5
View File
@@ -6,14 +6,15 @@
#
# usage:
# curl http://your-kestra-instance/api/v1/executions/webhook/your-namespace/your-task-id/your-secret-key
#
id: webhook
namespace: # your-namespace
id: webhook # <- Replace with your task id...
namespace: your-namespace # <- Replace with your namespace...
tasks:
# - your-tasks
# -- Add your tasks here...
triggers:
- id: webhook
type: io.kestra.core.models.triggers.types.Webhook
key: # your-secret-key, keep this secret!
type: io.kestra.plugin.core.trigger.Webhook
key: your-secret-key # <- Replace with your secret key...