-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathssh.yml
More file actions
47 lines (42 loc) · 951 Bytes
/
ssh.yml
File metadata and controls
47 lines (42 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: SSH Action Examples
description: Examples for using the ssh action
vars:
host: "{{SSH_HOST ?? ''}}"
port: "{{SSH_PORT ?? 22}}"
user: "{{SSH_USER ?? ''}}"
pass: "{{SSH_PASS ?? ''}}"
key_file: "{{SSH_KEY_FILE ?? '~/.ssh/id_rsa'}}"
jobs:
- name: SSH Connection Test
defaults:
ssh:
host: "{{vars.host}}"
port: "{{vars.port}}"
user: "{{vars.user}}"
password: "{{vars.pass}}"
timeout: 30s
strict_host_check: false
key_file: "{{vars.key_file}}"
steps:
- name: Get hostname
uses: ssh
with:
cmd: hostname
echo: "Hostname: {{res.stdout}}"
test: res.code == 0
- name: Pipe command
uses: ssh
with:
cmd: ls -l | wc -l
workdir: /tmp
timeout: 60s
test: res.code == 0
echo: "{{res.stdout}}"
- name: Multi-line command
uses: ssh
with:
cmd: |
whoami
date
test: res.code == 0
echo: "{{res.stdout}}"