diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7fba1b4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,32 @@ +--- +language: python +python: "2.7" +sudo: required +dist: trusty +services: + - docker + +before_install: + - sudo apt-get update -qq + +install: + - sudo pip install docker-py + - sudo apt-get install -y sshpass software-properties-common python-software-properties + - sudo apt-add-repository -y ppa:ansible/ansible + - sudo apt-get update -qq + - sudo apt-get install -y ansible + - echo -e 'localhost ansible_connection=local' > tests/inventory + - echo -e '[defaults]\nroles_path = ../\nhostfile = ./tests/inventory' > ansible.cfg + - sudo rm /usr/bin/python && sudo ln -s /usr/bin/python2.7 /usr/bin/python + - ansible --version + +script: + - ansible-playbook --syntax-check tests/role.yml + - ansible-playbook -v --diff tests/role.yml + - > + ansible-playbook tests/role.yml + | grep -q 'changed=0.*failed=0' + && (echo 'Idempotence test: pass' && exit 0) + || (echo 'Idempotence test: fail' && exit 1) +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index 926809d..b245732 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ## GridRouter in docker +[![Build Status](https://travis-ci.org/iqoption/gridrouter-docker.svg?branch=add-travis)](https://travis-ci.org/iqoption/gridrouter-docker) Set up [GridRouter](https://github.com/aerokube/ggr) in docker diff --git a/meta/main.yml b/meta/main.yml index 2462ded..4d9cb6a 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -7,3 +7,18 @@ galaxy_info: - name: Ubuntu versions: - 16.04 + - name: EL + versions: + - 6 + - name: Debian + versions: + - jessie + - name: Ubuntu + versions: + - trusty + - xenial + galaxy_tags: + - containers + - docker + - selenoid + - gridrouter diff --git a/tasks/main.yml b/tasks/main.yml index 7428e0d..4307055 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,10 @@ --- -- name: Grid Router | Installing docker-py python package - pip: name=docker-py +- name: Grid Router | Install certain python modules for docker + pip: + name: "{{ item.name }}" + with_items: + - { name: docker-py } + - { name: passlib } - name: Grid Router | Download sctl get_url: @@ -25,9 +29,6 @@ args: creates: "{{ grid_router_qouta_path }}/selenoid.xml" -- name: Grid Router | Make sure we can use htpasswd module - apt: "pkg=python-passlib state=installed" - - name: Grid Router | Setup quota password htpasswd: path: "{{ grid_router_gr_path }}/users.htpasswd" @@ -42,8 +43,6 @@ image: "aerokube/ggr:{{ grid_router_version }}" network_mode: host state: started - env: - DOCKER_API_VERSION: "{{ grid_router_docker_api_version }}" volumes: - "{{ grid_router_gr_path }}:{{ grid_router_gr_path }}:ro" ports: diff --git a/tests/role.yml b/tests/role.yml new file mode 100644 index 0000000..413001d --- /dev/null +++ b/tests/role.yml @@ -0,0 +1,5 @@ +--- +- hosts: 'localhost' + roles: + - role: 'gridrouter-docker' + become: yes diff --git a/tests/test-local-inventory b/tests/test-local-inventory new file mode 100644 index 0000000..6b99bf3 --- /dev/null +++ b/tests/test-local-inventory @@ -0,0 +1 @@ +localhost ansible_connection=local ansible_python_interpreter=/usr/local/bin/python diff --git a/tests/test-local.yml b/tests/test-local.yml new file mode 100644 index 0000000..733cd72 --- /dev/null +++ b/tests/test-local.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - { role: ../../gridrouter-docker }