Skip to content

Commit

Permalink
Add FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrieu, Alban committed Nov 25, 2017
1 parent 79a16d4 commit ca09260
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 26 deletions.
50 changes: 43 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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:
- [email protected]
# - [email protected]
on_success: [always|never|change] # default: change
on_failure: [always|never|change] # default: always
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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....

Expand Down Expand Up @@ -121,4 +123,4 @@ README generated by [Ansigenome](https://github.com/nickjj/ansigenome/).

Alban Andrieu

[linkedin](fr.linkedin.com/in/nabla/)
[linkedin](fr.linkedin.com/in/nabla/)
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 19 additions & 10 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
51 changes: 46 additions & 5 deletions tasks/selenium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ca09260

Please sign in to comment.