YAML examples for SSH Command
SSH commands to multiple servers
yaml
- action: Deploy to production servers
type: SSH_COMMAND
trigger_time: ON_EVERY_EXECUTION
disabled: false
working_directory: /var/www/app
commands: |-
cd /var/www/app
git pull origin main
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
sudo systemctl reload php-fpm
ignore_errors: false
retry_interval: 60
retry_count: 3
run_as_script: false
shell: BASH
timeout: 3600
execute_every_command: true
targets:
- target: prod-web-1
type: SSH
name: Production Web Server 1
host: web1.prod.example.com
port: "22"
path: /var/www
auth:
method: PASSWORD
username: deployer
password: $SSH_PASSWORD
tags:
- primary
- production
- web
- target: prod-web-2
type: SSH
name: Production Web Server 2
host: web2.prod.example.com
port: "2222"
path: /var/www
auth:
method: SSH_KEY
username: deployer
passphrase: $KEY_PASSPHRASE
key: $SSH_PRIVATE_KEY
tags:
- production
- web
- secondary
Simple SSH command
yaml
- action: Simple SSH
type: SSH_COMMAND
trigger_time: ON_EVERY_EXECUTION
commands: "echo 'Hello World'"
targets:
- target: server
type: SSH
host: example.com
auth:
method: PASSWORD
username: user
password: "$SSH_PASSWORD"