2016-09-23 21:51:59 +00:00
|
|
|
---
|
|
|
|
sudo: required
|
|
|
|
language: objective-c
|
2018-04-23 14:00:18 +00:00
|
|
|
# 10.13 (see https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version)
|
|
|
|
osx_image: xcode9.3
|
2016-09-23 21:51:59 +00:00
|
|
|
|
|
|
|
before_install:
|
2018-04-23 14:22:33 +00:00
|
|
|
# Uninstall existing Homebrew installation.
|
2018-04-23 14:37:54 +00:00
|
|
|
- curl -sLO https://raw.githubusercontent.com/Homebrew/install/master/uninstall
|
|
|
|
- chmod +x ./uninstall
|
|
|
|
- ./uninstall --force
|
2018-04-23 14:41:44 +00:00
|
|
|
- sudo rm -rf /usr/local/Homebrew
|
|
|
|
- sudo rm -rf /usr/local/Caskroom
|
|
|
|
- sudo rm -rf /usr/local/bin/brew
|
2016-09-23 21:51:59 +00:00
|
|
|
|
|
|
|
install:
|
|
|
|
# Install pip.
|
|
|
|
- sudo easy_install pip
|
|
|
|
|
|
|
|
# Install Ansible.
|
|
|
|
- sudo pip install ansible
|
|
|
|
|
|
|
|
# Add ansible.cfg to pick up roles path.
|
|
|
|
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
|
|
|
|
|
|
|
|
# Add a hosts file.
|
|
|
|
- sudo mkdir -p /etc/ansible
|
|
|
|
- sudo touch /etc/ansible/hosts
|
2016-09-24 00:32:46 +00:00
|
|
|
- "echo -e '[local]\nlocalhost ansible_connection=local' | sudo tee -a /etc/ansible/hosts > /dev/null"
|
2016-09-23 21:51:59 +00:00
|
|
|
|
|
|
|
script:
|
|
|
|
# Install dependencies.
|
|
|
|
- "ansible-galaxy install -r requirements.yml"
|
|
|
|
|
|
|
|
# Check the role/playbook's syntax.
|
|
|
|
- "ansible-playbook main.yml --syntax-check"
|
|
|
|
|
|
|
|
# Test the playbook.
|
2018-05-25 17:15:58 +00:00
|
|
|
- "travis_wait 30 ansible-playbook --extra-vars 'configure_sudoers=False' main.yml"
|
2016-09-23 21:51:59 +00:00
|
|
|
|
|
|
|
# Test the playbook's idempotence.
|
|
|
|
- idempotence=$(mktemp)
|
2016-09-24 00:35:00 +00:00
|
|
|
- "ansible-playbook --extra-vars '{\"configure_sudoers\":\"false\"}' main.yml | tee -a ${idempotence}"
|
2016-09-23 21:51:59 +00:00
|
|
|
- >
|
|
|
|
tail ${idempotence}
|
|
|
|
| grep -q 'changed=0.*failed=0'
|
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|