Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes debian 8 and centos 7 #44

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ Thumbs.db
*.komodoproject
*.kpf
/.idea
/*.iml

# Other files #
###############
!empty
/tests/test.sh
/tests/test.retry
29 changes: 21 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@
when: "ansible_service_mgr != 'systemd'"
tags: [configuration, selenium, selenium-install]

- name: Install start script (for systemd systems)
template:
src: "selenium-start.j2"
dest: "{{ selenium_install_dir }}/selenium/start.sh"
owner: root
group: root
mode: 0755
when: "ansible_service_mgr == 'systemd'"
tags: [configuration, selenium, selenium-install]

- name: Install systemd unit file (for systemd systems)
template:
src: "selenium-unit.j2"
Expand All @@ -93,14 +103,17 @@
when: "ansible_service_mgr == 'systemd'"
tags: [configuration, selenium, selenium-install]

- name: Register systemd service status (for systemd systems)
shell: 'systemctl status selenium | grep "active (running)"'
- name: Start selenium service (for systemd systems)
service: name=selenium state=started enabled=yes
tags: [configuration, selenium, selenium-run]
when: "ansible_service_mgr == 'systemd'"
register: selenium_running
ignore_errors: yes
changed_when: false

- name: Ensure selenium is running
service: name=selenium state=started enabled=yes
- name: Ensure selenium server is up and running (for systemd systems)
shell: 'systemctl status selenium'
register: result
until: result.stdout.find("Selenium Server is up and running") != -1
retries: 3
delay: 5
changed_when: false
tags: [configuration, selenium, selenium-run]
when: selenium_running.failed is defined and selenium_running.failed == true
when: "ansible_service_mgr == 'systemd'"
3 changes: 3 additions & 0 deletions templates/selenium-start.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

/usr/bin/xvfb-run {{ selenium_xvfb_args }} /usr/bin/java -client -jar {{ selenium_install_dir }}/selenium/selenium-server-standalone-{{ selenium_version }}.jar
2 changes: 1 addition & 1 deletion templates/selenium-unit.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=selenium test framework
After=syslog.target network.target

[Service]
ExecStart=/usr/bin/xvfb-run {{ selenium_xvfb_args }} /usr/bin/java -client -jar {{ selenium_install_dir }}/selenium/selenium-server-standalone-{{ selenium_version }}.jar
ExecStart={{ selenium_install_dir }}/selenium/start.sh
Restart=on-failure
RestartSec=20s

Expand Down