diff --git a/.travis.yml b/.travis.yml index 179bb7f..c5f005d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,60 @@ --- language: python -python: "2.7" +python: + - 2.7 +# - 3.3 +# - 3.4 +# - 3.5 +cache: + directories: + - $HOME/.cache/pip env: +# - ANSIBLE_VERSION=latest +# - ANSIBLE_VERSION=2.4.1.0 - ANSIBLE_VERSION=2.3.1.0 +# - ANSIBLE_VERSION=2.2.2.0 cache: bundler #sudo: false sudo: required dist: trusty + +branches: + only: + - master + before_install: - sudo apt-get update -qq - sudo apt-get install -qq python-apt python-pycurl install: # Install Ansible. - - sudo pip install ansible==$ANSIBLE_VERSION + - if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi + - if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible-lint; fi # Add ansible.cfg to pick up roles path. #- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" script: - - sudo ansible --version - - export ANSIBLE_ROLES_PATH="../" -# - echo localhost > inventory - - sudo ansible-playbook -i hosts --syntax-check selenium.yml - - sudo ansible-playbook -i hosts --connection=local --sudo -vvvv selenium.yml + # Check ansible version + - ansible --version + + # Prepare tests + #- echo localhost > hosts + + # Check syntax + - ansible-playbook -i hosts --syntax-check selenium.yml -e "python_versions=[2.7]" + + # First run + #- travis_wait 30 + - ansible-playbook -i hosts --connection=local --sudo -vvvv selenium.yml -e "python_versions=[2.7]" + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ +# email: false +# hipchat: +# rooms: +# secure: GPUtM44MpgqN/3+TXw4Onp7TpF6YOKpVQkB/sfwGYS1oHUCkp2eb3eGGfJAIUtNxkfFVkdUxM/Bp9GMCnpVjJwRRZP6hYUmlpjCHl8CiK2MjbLvzV65qqBAqYl5bLzKkmmRdPiC31m9ixMe4TiAhJFBK1NoETOP1LkCJ04ezL6U= + email: + recipients: + - alban.andrieu@nabla.mobi +# - other@example.com + on_success: [always|never|change] # default: change + on_failure: [always|never|change] # default: always diff --git a/README.md b/README.md index 874e720..dcbcf91 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,10 @@ This file was generated by Ansigenome. Do not edit this file directly but instea [![Branch](http://img.shields.io/github/tag/AlbanAndrieu/ansible-selenium.svg?style=flat-square)](https://github.com/AlbanAndrieu/ansible-selenium/tree/master) [![Donate](https://img.shields.io/gratipay/AlbanAndrieu.svg?style=flat)](https://www.gratipay.com/~AlbanAndrieu) [![Ansible Galaxy](https://img.shields.io/badge/galaxy-alban.andrieu.selenium-660198.svg?style=flat)](https://galaxy.ansible.com/alban.andrieu/selenium) -[![Platforms](http://img.shields.io/badge/platforms-ubuntu-lightgrey.svg?style=flat)](#) - +[![Platform](http://img.shields.io/badge/platform-centos-932279.svg?style=flat)](#) +[![Platform](http://img.shields.io/badge/platform-debian-a80030.svg?style=flat)](#) +[![Platform](http://img.shields.io/badge/platform-redhat-cc0000.svg?style=flat)](#) +[![Platform](http://img.shields.io/badge/platform-ubuntu-dd4814.svg?style=flat)](#) Describe your role in a few paragraphs.... @@ -121,4 +123,4 @@ README generated by [Ansigenome](https://github.com/nickjj/ansigenome/). Alban Andrieu -[linkedin](fr.linkedin.com/in/nabla/) \ No newline at end of file +[linkedin](fr.linkedin.com/in/nabla/) diff --git a/defaults/main.yml b/defaults/main.yml index 3128669..477d8d5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ --- # Package states: present or installed or latest -selenium_pkg_state: present +util_pkg_state: present selenium_enabled: yes # Enable module selenium_server_major_version: "2.47" # Selenium client major version diff --git a/meta/main.yml b/meta/main.yml index 1ddae8d..347eeb4 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -5,21 +5,30 @@ galaxy_info: author: Alban Andrieu description: A role for installing selenium company: Nabla - license: MIT + license: GPLv3 min_ansible_version: 2.3.1.0 platforms: - name: Ubuntu versions: - all - - lucid - - maverick - - natty - - oneiric - - precise - - quantal - - raring - - saucy - - trusty + - name: EL + versions: + - all + - name: FreeBSD + versions: + - all + - name: Solaris + versions: + - all +# - name: MacOSX +# versions: +# - all + - name: Fedora + versions: + - all + - name: Debian + versions: + - all categories: - development - jenkins diff --git a/tasks/selenium.yml b/tasks/selenium.yml index aba7cec..a4fc5fb 100644 --- a/tasks/selenium.yml +++ b/tasks/selenium.yml @@ -11,6 +11,7 @@ - name: selenium | Download selenium on 'master' if we don't have it # connection: local get_url: url={{ selenium_download_url }} dest={{ selenium_server_path }}/{{ selenium_jar_file }} force=no owner=root group=root mode=755 + when: (ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu') tags: selenium_setup become: yes @@ -21,19 +22,30 @@ - name: selenium | Install Configuration template: src=defaults.j2 dest=/etc/default/selenium_{{ selenium_sel_role }} owner=root group=root mode=644 + when: (ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu') tags: ['config'] # notify: selenium_reload become: yes - name: selenium | Install init script template: src=selenium-server.sh.j2 dest=/etc/init.d/selenium_{{ selenium_sel_role }} owner=root group=root mode=755 + when: (ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu') tags: ['config'] notify: selenium_started become: yes +- name: selenium | Install selenium package (Freebsd) + pkgng: name={{ item }} state={{ util_pkg_state|default('present') }} + when: (ansible_distribution == 'FreeBSD') + tags: package + with_items: + - selenium + become: yes + changed_when: false + - name: selenium | Install selenium tools - action: "{{ ansible_pkg_mgr}} name={{ item }} state={{ selenium_pkg_state|default('present') }} update_cache=yes" - when: selenium_sel_role != 'hub' + action: "{{ ansible_pkg_mgr}} name={{ item }} state={{ util_pkg_state|default('present') }} update_cache=yes" + when: (ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu') and ( selenium_sel_role != 'hub' ) with_items: - xfonts-100dpi - xfonts-75dpi @@ -44,25 +56,54 @@ - imagemagick become: yes +- name: selenium | Install selenium tools (Freebsd) + pkgng: name={{ item }} state={{ util_pkg_state|default('present') }} + when: (ansible_distribution == 'FreeBSD') and ( selenium_sel_role != 'hub' ) + tags: package + with_items: + - www/geckodriver + - x11-servers/xorg-vfbserver + - x11-fonts/xorg-fonts + - x11-fonts/webfonts + - x11/xauth + - x11/xkeyboard-config + - x11/xkbcomp +#Clients can also be found: + - www/rubygem-selenium-webdriver + - www/py-selenium + - devel/p5-Test-WWW-Selenium + become: yes + changed_when: false + #TODO download it from http://chromedriver.storage.googleapis.com/index.html?path=2.14/ instead - name: selenium | Install browser tools specific action: "{{ ansible_pkg_mgr}} name={{ item }} state={{ selenium_pkg_state|default('present') }} update_cache=yes" #specific for ubuntu 13.04 and 13.10 # when: ( ansible_distribution_release == 'saucy' ) and ( selenium_sel_role != 'hub' ) - when: selenium_sel_role != 'hub' + when: (ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu') and ( selenium_sel_role != 'hub' ) with_items: - chromium-chromedriver become: yes - name: selenium | Install browser tools action: "{{ ansible_pkg_mgr}} name={{ item }} state={{ selenium_pkg_state|default('present') }} update_cache=yes" - when: selenium_sel_role != 'hub' with_items: - firefox + - google-chrome-stable # - chromium-browser -# use chrome-stable + when: (ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu') and ( selenium_sel_role != 'hub' ) become: yes +- name: selenium | Install browser tools (Freebsd) + pkgng: name={{ item }} state={{ util_pkg_state|default('present') }} + become: yes + when: (ansible_distribution == 'FreeBSD') + tags: package + with_items: + - www/firefox + - www/chromium + changed_when: false + #TODO by hand for Ubuntu saucy #better is to us Jenkins plugins that is intalling chromedriver #cd /usr/lib/chromium-browser