-
Notifications
You must be signed in to change notification settings - Fork 12
59 lines (59 loc) · 2.39 KB
/
validate-ansible.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
name: Validate Ansible playbooks
on:
push:
paths:
- ".github/**"
- "ansible/**"
- "ansible.cfg"
- "requirements/development.txt"
env:
ANSIBLE_ASK_VAULT_PASS: False
ENVIRONMENT: testing
jobs:
ansible-lint:
name: Lint Ansible playbooks
runs-on: ubuntu-latest
container: python:3.9-bullseye
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Virtualenv caching
uses: actions/[email protected]
with:
path: ~/venv/current
key: ${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
restore-keys: |
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-
${{ runner.os }}-python3.9-venv-v1-
- name: Install Python dependencies
uses: mobolic/[email protected]
with:
virtualenv-location: "~/venv/current"
- name: Run ansible-lint
run: |
bash -c "source ~/venv/current/bin/activate &&
ansible-lint ansible/"
ansible-test:
name: Test Ansible playbooks
needs: ansible-lint
runs-on: ubuntu-latest
container: python:3.9-bullseye
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Virtualenv caching
uses: actions/[email protected]
with:
path: ~/venv/current
key: ${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
restore-keys: |
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-
${{ runner.os }}-python3.9-venv-v1-
- name: Install Python dependencies
uses: mobolic/[email protected]
with:
virtualenv-location: "~/venv/current"
- name: Run Ansible testing tasks
run: ~/venv/current/bin/ansible-playbook -i ansible/hosts -l testing --connection=local --tags testing ansible/testing.yml