-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (33 loc) · 1.65 KB
/
check-ubuntu-host.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
name: Ansible check
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install prerequisites
run: |
sudo apt update
sudo apt install --yes --reinstall software-properties-common sudo
- name: install ansible
run: |
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt-get install -y ansible python3 python3-setuptools
ansible-galaxy install --roles-path ./galaxy -r requirements.yml
- name: add application user
run: |
sudo adduser metacpan
- name: playbooks/deploy_users.yml
run: |
ansible-playbook -i inventories/ansible_test playbooks/deploy_users.yml --syntax-check
ansible-playbook -vvvv -i inventories/ansible_test tests/users.yml
idempotence=$(mktemp)
sudo ansible-playbook -i inventories/ansible_test tests/users.yml | tee -a ${idempotence}
tail ${idempotence} | grep -q 'changed=1.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
- name: playbooks/deploy_packages.yml
run: |
ansible-playbook -i inventories/ansible_test playbooks/deploy_packages.yml --syntax-check
ansible-playbook -vvvv -i inventories/ansible_test tests/deploy_packages.yml
idempotence=$(mktemp)
sudo ansible-playbook -i inventories/ansible_test tests/deploy_packages.yml | tee -a ${idempotence}
tail ${idempotence} | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)