|
23 | 23 | when: selenium_install_firefox
|
24 | 24 | tags: [configuration, selenium, selenium-firefox]
|
25 | 25 |
|
| 26 | +- name: Add Chrome key (if configured, Debian) |
| 27 | + apt_key: |
| 28 | + url: "https://dl-ssl.google.com/linux/linux_signing_key.pub" |
| 29 | + state: present |
| 30 | + when: ansible_os_family == 'Debian' and selenium_install_chrome |
| 31 | + tags: [configuration, selenium, selenium-chrome] |
| 32 | + |
| 33 | +- name: Add Chrome repo (if configured, Debian) |
| 34 | + apt_repository: |
| 35 | + repo: "deb http://dl.google.com/linux/chrome/deb/ stable main" |
| 36 | + state: present |
| 37 | + update_cache: yes |
| 38 | + when: ansible_os_family == 'Debian' and selenium_install_chrome |
| 39 | + tags: [configuration, selenium, selenium-chrome] |
| 40 | + |
26 | 41 | - name: Install Chrome (if configured, Debian)
|
27 | 42 | apt:
|
28 |
| - deb: https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
| 43 | + name: google-chrome-stable |
29 | 44 | state: present
|
30 | 45 | when: ansible_os_family == 'Debian' and selenium_install_chrome
|
31 | 46 | tags: [configuration, selenium, selenium-chrome]
|
|
67 | 82 | mode: 0755
|
68 | 83 | tags: [configuration, selenium, selenium-install]
|
69 | 84 |
|
| 85 | +- name: Install systemd unit file (for systemd systems) |
| 86 | + template: |
| 87 | + src: "selenium-unit.j2" |
| 88 | + dest: /etc/systemd/system/selenium.service |
| 89 | + owner: root |
| 90 | + group: root |
| 91 | + mode: 0755 |
| 92 | + when: > |
| 93 | + (ansible_distribution == 'Ubuntu' and ansible_distribution_version.split(".")[0]|int >= 16) or |
| 94 | + (ansible_distribution == 'Debian' and ansible_distribution_version.split(".")[0]|int >= 8) or |
| 95 | + (ansible_distribution == 'CentOS' and ansible_distribution_version.split(".")[0]|int >= 7) or |
| 96 | + (ansible_distribution == 'Fedora') |
| 97 | + tags: [configuration, selenium, selenium-install] |
| 98 | + |
| 99 | +- name: Register systemd service status (for systemd systems) |
| 100 | + shell: 'systemctl status selenium | grep "active (running)"' |
| 101 | + when: > |
| 102 | + (ansible_distribution == 'Ubuntu' and ansible_distribution_version.split(".")[0]|int >= 16) or |
| 103 | + (ansible_distribution == 'Debian' and ansible_distribution_version.split(".")[0]|int >= 8) or |
| 104 | + (ansible_distribution == 'CentOS' and ansible_distribution_version.split(".")[0]|int >= 7) or |
| 105 | + (ansible_distribution == 'Fedora') |
| 106 | + register: selenium_running |
| 107 | + ignore_errors: yes |
| 108 | + changed_when: false |
| 109 | + |
70 | 110 | - name: Ensure selenium is running
|
71 | 111 | service: name=selenium state=started enabled=yes
|
72 | 112 | tags: [configuration, selenium, selenium-run]
|
| 113 | + when: selenium_running.failed is defined and selenium_running.failed == true |
0 commit comments