Use FQCN for debut task #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Ansible-Test | |
on: [ push, pull_request ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
ANSIBLE_FORCE_COLOR: true | |
steps: | |
- name: Checkout code from Github | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Show APT repos | |
run: ls /etc/apt/sources.list.d/ | |
- name: Apt update | |
run: sudo apt-get update | |
- name: Install python apt package | |
run: sudo apt-get install python3-apt | |
- name: Install latest Ansible through pip | |
run: pip install ansible | |
- name: Output python and ansible versions | |
run: | | |
python --version | |
ansible --version | |
- name: Create ansible.cfg with correct roles_path | |
run: printf '[defaults]\nroles_path=../' > ansible.cfg | |
- name: Add role dependency (mediafellows.elasticsearch) | |
run: | | |
wget -O mediafellows.elasticsearch.zip https://github.com/mediafellows/ansible-role-elasticsearch/archive/master.zip && unzip mediafellows.elasticsearch.zip | |
rm mediafellows.elasticsearch.zip | |
mv ansible-role-elasticsearch-master tests/roles/mediafellows.elasticsearch | |
- name: Output added roles | |
run: ls tests/roles | |
- name: Basic Ansible role syntax check | |
run: ansible-playbook -i tests/inventory --syntax-check tests/test.yml | |
- name: Real Ansible run | |
run: ansible-playbook -i tests/inventory tests/test.yml | |
- name: Second run to check for indempotence (allow 3 'changes' for staus checks) | |
run: "ansible-playbook -i tests/inventory tests/test.yml | grep -q 'changed=3.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)" | |
- name: Setup serverspec (install gem) | |
run: sudo gem install serverspec | |
- name: Wait until Graylog is reachable | |
run: sleep 20 | |
- name: Check if Graylog port is open | |
run: ss -tnl | |
- name: Show graylog server log output for verification | |
run: tail -n 10 /var/log/graylog-server/server.log | |
- name: Curl Graylog http endpoint | |
run: curl --silent http://localhost:9000/api/ | |
- name: Run serverspec | |
run: rake spec |