Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Ansible upgrade #8

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 56 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,64 @@
---
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/test.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/test.yml --connection=local -vvvv

# 3rd: Make sure our playbook is idempotent
- echo "***************************** Idempotence test (3) *****************************"
- >
sudo ansible-playbook --inventory-file tests/hosts tests/test.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"

3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
- src: https://github.com/silpion/ansible-lib.git
name: silpion.lib

- src: https://github.com/silpion/ansible-java.git
name: silpion.java
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
filename: "{{ maven_redis_filename }}"
checksum: "{{ maven_redis_checksum }}"


- name: Upload installation archive
tags: maven
include: "{{ maven_path_to_lib_role }}/silpion.lib/tasks/copy.yml"
vars:
filename: "{{ maven_redis_filename }}"
ignore_errors: "{{ ansible_check_mode }}"

- name: Install Maven installation directory
tags: maven
Expand Down