Enable idempotence check again #31
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 | |
strategy: | |
fail-fast: false | |
matrix: | |
test_play: ['test-6.yml', 'test-7.yml', 'test-8.yml'] | |
env: | |
ANSIBLE_FORCE_COLOR: true | |
steps: | |
- name: Checkout code from Github | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.10.14 | |
- 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: Basic Ansible role syntax check | |
run: ansible-playbook -i tests/inventory --syntax-check tests/${{ matrix.test_play }} | |
- name: Real Ansible run | |
run: ansible-playbook -i tests/inventory tests/${{ matrix.test_play }} | |
- name: Second run to check for indempotence (allowing 4-5 changes) | |
run: "ansible-playbook -i tests/inventory tests/${{ matrix.test_play }} | grep -qE 'changed=(4|5).+failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)" | |
- name: Test ES with curl | |
run: curl --silent http://localhost:9200 | |
- name: Setup serverspec (install gem) | |
run: sudo gem install serverspec | |
- name: Run serverspec (as root to test everything) | |
run: sudo rake spec PLAY=${{ matrix.test_play }} | |