Skip to content

Commit

Permalink
Merge pull request #1 from MassiveHiggsField/master
Browse files Browse the repository at this point in the history
PR: Fix on systemd issue by MassiveHiggsField
  • Loading branch information
icasimpan committed Feb 14, 2018
2 parents 4fda3ee + 7527405 commit ee0aa40
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
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
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
@@ -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
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

0 comments on commit ee0aa40

Please sign in to comment.