---
image: "eugenmayer/rsync"

before_script:
  - ansible --version
  - printf '[defaults]\nroles_path=../' > ansible.cfg

test:
  script:
    # Basic role syntax check
    - ansible-playbook tests/gitlab-ci-test.yml -i tests/inventory --syntax-check

    # Run the first time
    - ansible-playbook tests/gitlab-ci-test.yml -i tests/inventory -c local -b

    # Run again and expect no changes
    - >
      ansible-playbook tests/gitlab-ci-test.yml -i tests/inventory -c local -b
      #| grep -q 'changed=0.*failed=0'
      #&& (echo 'Idempotence test: pass' && exit 0)
      #|| (echo 'Idempotence test: fail' && exit 1)
