This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alban Andrieu
committed
May 12, 2017
1 parent
8050450
commit b168469
Showing
1 changed file
with
55 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,63 @@ | ||
--- | ||
language: python | ||
python: "2.7" | ||
env: | ||
- ANSIBLE_VERSION=2.1.0.0 | ||
cache: bundler | ||
cache: pip | ||
cache: | ||
directories: | ||
- $HOME/.m2 | ||
#sudo: false | ||
sudo: required | ||
dist: trusty | ||
before_install: | ||
- sudo apt-get update --assume-yes -qq | ||
- sudo apt-get install --assume-yes -qq python-apt python-pycurl | ||
install: | ||
- sudo pip install ansible | ||
# Install Ansible. | ||
- sudo pip install ansible==$ANSIBLE_VERSION | ||
|
||
# Add ansible.cfg to pick up roles path. | ||
#- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" | ||
|
||
# Install dependencies. | ||
#- ansible-galaxy install silpion.util | ||
#- git clone https://github.com/AlbanAndrieu/ansible-util.git silpion.util | ||
|
||
script: | ||
- ansible --version | ||
- ansible-playbook --inventory-file tests/hosts --syntax-check tests/playbook.yml | ||
- ansible-playbook --inventory-file tests/hosts --connection=local -vvvv tests/playbook.yml | ||
#- cd tests | ||
|
||
- echo -e "\e[31m######AnsibleVersion#######\e[0m" | ||
- sudo ansible --version | ||
|
||
# 0: install requirement | ||
- echo "\e[31m######***************************** REQUIREMENT (0) *****************************\e[0m" | ||
- sudo ansible-galaxy install --role-file requirements.yml | ||
|
||
# 1st: check syntax | ||
- echo "\e[31m######***************************** SYNTAX CHECK (1) *****************************\e[0m" | ||
- sudo ansible-playbook --inventory-file tests/hosts tests/playbook.yml --connection=local --syntax-check | ||
|
||
# 2nd: Make sure we run the entire playbook | ||
- echo "***************************** RUN PLAY (2) *****************************" | ||
- sudo ansible-playbook --inventory-file tests/hosts tests/playbook.yml --connection=local -vvvv | ||
|
||
# 3rd: Make sure our playbook is idempotent | ||
- echo "***************************** Idempotence test (3) *****************************" | ||
- > | ||
sudo ansible-playbook --inventory-file tests/hosts tests/playbook.yml --connection=local -vvvv | tee ansible_output | ||
| grep -q 'changed=0.*failed=0' | ||
&& (echo 'Idempotence test: pass' && exit 0) | ||
|| (echo 'Idempotence test: fail' && exit 1) | ||
after_failure: | ||
- echo -e "\e[31m######IdepotanceLog#######\e[0m" | ||
- sudo cat ansible_output | ||
- echo -e "\e[31m######version#######\e[0m" | ||
- sudo mvn --version | ||
- echo -e "\e[31m######AnsibleFacts#######\e[0m" | ||
- ansible -i 127.0.0.1, -m setup all -c local | ||
|
||
after_success: | ||
- echo -e "\e[0;32m######Cook Success#######\e[0m" |