-
-
Notifications
You must be signed in to change notification settings - Fork 24
58 lines (52 loc) · 1.64 KB
/
ansible--cleanup-clients.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
name: Ansible --06- Cleanup Clients
on:
schedule:
- cron: '5 12 10,20 * *' # Run at 12:05 on the 10th and 20th of every month
workflow_dispatch:
inputs:
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
jobs:
run_playbook:
name: Run Play
runs-on: ubuntu-latest
strategy:
matrix:
host_groups:
- 'prd_oldeworld_clt'
- 'stg_oldeworld_clt'
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- 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 -- Cleanup Clients
env:
LINODE_API_TOKEN: ${{ secrets.LINODE_TOKEN }}
working-directory: './ansible'
run: |
SERIAL_VALUE=${{ inputs.serial || 1 }} # Default value of 1 if inputs.serial is not set
ansible-playbook play-any--cleanup-clients.yml \
--private-key=~/.ssh/id_for_ansible.pem \
-e '{"variable_host": "${{ matrix.host_groups }}", "variable_serial": '$SERIAL_VALUE'}' \
${{ inputs.verbosity }}