Skip to content

Project Clean Ups

Project Clean Ups #50

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)