Bo-Yi Wu 2019-09-29 12:29:29 +08:00
parent 79584d6cfa
commit 553894abe6

162
DOCS.md
View File

@ -11,123 +11,110 @@ image: appleboy/drone-ssh
Use the SSH plugin to execute commands on a remote server. The below pipeline configuration demonstrates simple usage:
```yaml
pipeline:
ssh:
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
script:
- echo hello
- echo world
- name: ssh commands
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
script:
- echo hello
- echo world
```
Example configuration in your `.drone.yml` file for multiple hosts:
```diff
pipeline:
ssh:
image: appleboy/drone-ssh
settings:
host:
+ - foo.com
+ - bar.com
username: root
password: 1234
port: 22
script:
- echo hello
- echo world
image: appleboy/drone-ssh
settings:
host:
+ - foo.com
+ - bar.com
username: root
password: 1234
port: 22
script:
- echo hello
- echo world
```
Example configuration for command timeout, default value is 60 seconds:
```diff
pipeline:
ssh:
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
+ command_timeout: 2m
script:
- echo hello
- echo world
script:
- echo hello
- echo world
```
Example configuration for execute commands on a remote server using SSHProxyCommand:
```diff
pipeline:
ssh:
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
script:
- echo hello
- echo world
+ proxy_host: 10.130.33.145
+ proxy_user: ubuntu
+ proxy_port: 22
+ proxy_password: 1234
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
script:
- echo hello
- echo world
+ proxy_host: 10.130.33.145
+ proxy_user: ubuntu
+ proxy_port: 22
+ proxy_password: 1234
```
Example configuration using password from secrets:
```diff
pipeline:
ssh:
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
+ password:
+ from_secret: ssh_password
port: 22
script:
- echo hello
- echo world
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
+ password:
+ from_secret: ssh_password
port: 22
script:
- echo hello
- echo world
```
Example configuration using ssh key from secrets:
```diff
pipeline:
ssh:
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
port: 22
+ key:
+ from_secret: ssh_key
script:
- echo hello
- echo world
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
port: 22
+ key:
+ from_secret: ssh_key
script:
- echo hello
- echo world
```
Example configuration for exporting custom secrets:
```diff
pipeline:
ssh:
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
+ envs:
- aws_access_key_id
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
image: appleboy/drone-ssh
settings:
host: foo.com
username: root
password: 1234
port: 22
+ envs:
- aws_access_key_id
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
```
## Secret Reference
@ -176,6 +163,9 @@ envs
script
: execute commands on a remote server
script_stop
: stop script after first failure
timeout
: Timeout is the maximum amount of time for the TCP connection to establish.