-
-
Notifications
You must be signed in to change notification settings - Fork 24
76 lines (70 loc) · 2.04 KB
/
ansible--uptime.yml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Ansible --04- Uptime
on:
workflow_call:
inputs:
hosts:
description: 'The value for the variable_host argument'
type: string
required: true
verbosity:
description: 'The verbosity level for logs'
type: string
serial:
description: 'The value for the variable_serial argument'
type: number
secrets:
SSH_PRIVATE_KEY:
description: 'The SSH private key for the Ansible user'
required: true
LINODE_TOKEN:
description: 'The Linode API token'
required: true
workflow_dispatch:
inputs:
hosts:
description: 'The value for the variable_host argument'
type: string
required: true
default: 'none'
verbosity:
description: 'The verbosity level for logs'
type: choice
required: true
default: '-v'
options:
- '-v'
- '-vv'
- '-vvv'
serial:
description: 'The value for the variable_serial argument'
type: number
required: true
default: 1
jobs:
run_playbook:
name: Run Play
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3b9b8c884f6b4bb4d5be2779c26374abadae0871
- name: Setup Ansible and Dependencies
env:
LINODE_API_TOKEN: ${{ secrets.LINODE_TOKEN }}
working-directory: './ansible'
run: |
make install
ansible --version
- name: Set up SSH key
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_for_ansible.pem
chmod 600 ~/.ssh/id_for_ansible.pem
- name: Play -- Uptime
env:
LINODE_API_TOKEN: ${{ secrets.LINODE_TOKEN }}
working-directory: './ansible'
run: |
ansible-playbook play-any--uptime.yml \
--private-key=~/.ssh/id_for_ansible.pem \
-e '{"variable_host": "${{ inputs.hosts }}", "variable_serial": ${{ inputs.serial }}}' \
${{ inputs.verbosity }}