---

# Travis file for restore-files role

language: python
python: "2.7"

before_install:
  # Make sure everything's up to date.
  - sudo apt-get update -qq

install:
  # Install Ansible.
  - pip install ansible

  # Add ansible.cfg to pick up roles path.
  - "cp ./tests/ansible.cfg ./"

script:
  # Check the role/playbook's syntax.
  - ansible-playbook -i tests/inventory tests/test.yml --syntax-check

  # Run the role/playbook with ansible-playbook.
  - "ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo"
  - "ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo"

  # Run the role/playbook again, checking to make sure it's idempotent.
  # Set change=1 due to a bug in ansible service module always return changed
  - >
    ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo
    | grep -q 'changed=[012].*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)

---

# Travis file for restore-files role

language: python
python: "2.7"

before_install:
  # Make sure everything's up to date.
  - sudo apt-get update -qq

install:
  # Install Ansible.
  - pip install ansible

  # Add ansible.cfg to pick up roles path.
  - "cp ./tests/ansible.cfg ./"

script:
  # Check the role/playbook's syntax.
  - ansible-playbook -i tests/inventory tests/test.yml --syntax-check

  # Run the role/playbook with ansible-playbook.
  - "ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo"

  # Run the role/playbook again, checking to make sure it's idempotent.
  # Set change=1 due to a bug in ansible service module always return changed
  - >
    ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo
    | grep -q 'changed=[0123].*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)

Change valid change counter temporary
Change valid change counter temporary
