mirror of
https://github.com/ChristianLempa/boilerplates.git
synced 2025-01-07 06:50:36 +01:00
Merge pull request #353 from phpsystems/patch-1
Create ansible-playbook.yaml
This commit is contained in:
commit
38bb3d2718
42
kestra/ansible/playbook-inline.yaml
Normal file
42
kestra/ansible/playbook-inline.yaml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
# Kestra ansible-playbook Template
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# Run an ansible playbook defined inline the kestra flow.
|
||||||
|
#
|
||||||
|
id: ansible_job
|
||||||
|
namespace: # your-namespace
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- id: ansible
|
||||||
|
type: io.kestra.plugin.core.flow.WorkingDirectory
|
||||||
|
tasks:
|
||||||
|
- id: local_files
|
||||||
|
type: io.kestra.core.tasks.storages.LocalFiles
|
||||||
|
inputs:
|
||||||
|
inventory.ini: |
|
||||||
|
srv-demo-1.home.clcreative.de
|
||||||
|
# --> replace with your playbook
|
||||||
|
myplaybook.yml: |
|
||||||
|
---
|
||||||
|
- hosts: srv-demo-1.home.clcreative.de
|
||||||
|
tasks:
|
||||||
|
- name: upgrade apt packages
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
upgrade: yes
|
||||||
|
update_cache: yes
|
||||||
|
# <--
|
||||||
|
id_rsa: "{{ secret('SSH_KEY') }}"
|
||||||
|
- id: ansible_task
|
||||||
|
type: io.kestra.plugin.ansible.cli.AnsibleCLI
|
||||||
|
docker:
|
||||||
|
image: cytopia/ansible:latest-tools
|
||||||
|
user: "1000" # required to set ssh key permissions
|
||||||
|
env:
|
||||||
|
"ANSIBLE_HOST_KEY_CHECKING": "false"
|
||||||
|
# --> (optional) when using a different remote user
|
||||||
|
# "ANSIBLE_REMOTE_USER": "your-remote-user"
|
||||||
|
# <--
|
||||||
|
commands:
|
||||||
|
- ansible-playbook -i inventory.ini --key-file id_rsa myplaybook.yaml
|
33
kestra/ansible/playbook-password.yaml
Normal file
33
kestra/ansible/playbook-password.yaml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# Kestra ansible-playbook Template
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# Run an ansible playbook which has been uploaded to the server.
|
||||||
|
#
|
||||||
|
id: ansible_job
|
||||||
|
namespace: # your-namespace
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- id: ansible
|
||||||
|
type: io.kestra.plugin.core.flow.WorkingDirectory
|
||||||
|
tasks:
|
||||||
|
- 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
|
||||||
|
# <--
|
||||||
|
type: io.kestra.plugin.ansible.cli.AnsibleCLI
|
||||||
|
docker:
|
||||||
|
image: cytopia/ansible:latest-tools
|
||||||
|
env:
|
||||||
|
"ANSIBLE_HOST_KEY_CHECKING": "false"
|
||||||
|
# --> (optional) when using a different remote user
|
||||||
|
# "ANSIBLE_REMOTE_USER": "your-remote-user"
|
||||||
|
# <--
|
||||||
|
commands:
|
||||||
|
- apk add sshpass # only required if use ssh passwords.
|
||||||
|
- ansible-playbook -i inventory.ini myplaybook.yaml
|
38
kestra/ansible/playbook-ssh-key.yaml
Normal file
38
kestra/ansible/playbook-ssh-key.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
# Kestra ansible-playbook Template
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# Run an ansible playbook which has been uploaded to the server, using
|
||||||
|
# ssh key authentication.
|
||||||
|
#
|
||||||
|
id: ansible_job
|
||||||
|
namespace: # your-namespace
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- id: ansible
|
||||||
|
type: io.kestra.plugin.core.flow.WorkingDirectory
|
||||||
|
tasks:
|
||||||
|
- id: load_ssh_key
|
||||||
|
type: io.kestra.core.tasks.storages.LocalFiles
|
||||||
|
inputs:
|
||||||
|
id_rsa: "{{ secret('SSH_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
|
||||||
|
# <--
|
||||||
|
type: io.kestra.plugin.ansible.cli.AnsibleCLI
|
||||||
|
docker:
|
||||||
|
image: cytopia/ansible:latest-tools
|
||||||
|
user: "1000" # required to set ssh key permissions
|
||||||
|
env:
|
||||||
|
"ANSIBLE_HOST_KEY_CHECKING": "false"
|
||||||
|
# --> (optional) when using a different remote user
|
||||||
|
# "ANSIBLE_REMOTE_USER": "your-remote-user"
|
||||||
|
# <--
|
||||||
|
commands:
|
||||||
|
- ansible-playbook -i inventory.ini --key-file id_rsa myplaybook.yaml
|
Loading…
Reference in New Issue
Block a user