Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
moved atmo-check-novnc to disabled; and copied atmo-check-vnc to atmo…
Browse files Browse the repository at this point in the history
…-check-novnc to fix webdesktop
  • Loading branch information
edwins committed Aug 18, 2020
1 parent 05617c7 commit 2dcbe35
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 54 deletions.
4 changes: 4 additions & 0 deletions ansible/roles.disabled/atmo-check-novnc/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
# defaults file for atmo-check-vnc

SSH_PORT_TIMEOUT: 30
101 changes: 101 additions & 0 deletions ansible/roles.disabled/atmo-check-novnc/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---

- name: set environment variables for legacy systems
set_fact: ansible_python_interpreter=/usr/bin/python
when: ansible_distribution == "CentOS" and ansible_distribution_major_version < '6'
tags:
- vnc
- x

- name: gather os specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
- "{{ ansible_distribution }}.yml"
tags:
- vnc
- x

# Only install RealVNC Server if VM is NOT headless
- name: verify that X server exists
stat: path={{ XGUI.xsession_path }}
register: xsession
tags:
- vnc
- x

- name: verify that xterm session exists
stat: path={{ XGUI.xterm_path }}
register: xterm
tags:
- vnc
- x

- name: check to see if VNC server is running
shell: /bin/ps aux | /bin/grep "/usr/bin/Xvnc-core :1 -auth /home/{{ ATMOUSERNAME }}/" | /bin/grep -v grep
ignore_errors: yes
failed_when: False
register: vnc_state
tags:
- vnc

- name: check to see if novnc is installed
shell: "{{ CHECK_IF_PACKAGE_INSTALLED }}"
ignore_errors: yes
failed_when: False
register: novnc_state
tags:
- novnc

- name: check to see if websockify is running
shell: /bin/ps aux | grep "websockify" | grep -v grep
ignore_errors: yes
failed_when: False
register: websockify_state
tags:
- novnc

- name: Fail if novnc is not installed
action: >
{{ ansible_pkg_mgr }} name={{ NOVNC_PACKAGE }} state=present
tags:
- novnc

- name: fail if OS does not contain a GUI
fail: msg="OS does NOT have a GUI for VNC to run on."
when: not (xsession.stat.exists and xterm.stat.exists)
tags:
- no-gui
- vnc

- name: fail when VNC is not running
fail: msg="VNC is NOT running for user '{{ ATMOUSERNAME }}'"
when: vnc_state.stdout == ""
tags:
- vnc
- check-vnc

- name: fail when novnc is not installed
fail: msg="novnc is not installed for user '{{ ATMOUSERNAME }}'"
when: novnc_state.stdout == ""
tags:
- novnc
- check-novnc

- name: fail when websockify is not running
fail: msg="Websockify is not running for user '{{ ATMOUSERNAME }}'"
when: websockify_state.stdout == ""
tags:
- novnc
- check-novnc

# disabled until further notice
#- name: fail if shell can't talk to vm
# wait_for: >
# search_regex=OpenSSH
# port={{ ansible_port }}
# host={{ ansible_host }}
# delay=1
# timeout={{ SSH_PORT_TIMEOUT }}
# tags: gateone_networking_check
# delegate_to: shell
6 changes: 6 additions & 0 deletions ansible/roles.disabled/atmo-check-novnc/vars/CentOS-5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

XGUI:
xsession_path: /usr/bin/xinit
xterm_path: /usr/bin/xterm

9 changes: 9 additions & 0 deletions ansible/roles.disabled/atmo-check-novnc/vars/CentOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

XGUI:
xsession_path: /usr/bin/xinit
xterm_path: /usr/bin/Xorg

NOVNC_PACKAGE: novnc

CHECK_IF_PACKAGE_INSTALLED: rpm -qa | grep novnc
9 changes: 9 additions & 0 deletions ansible/roles.disabled/atmo-check-novnc/vars/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

XGUI:
xsession_path: /usr/bin/X
xterm_path: /usr/bin/xinit

NOVNC_PACKAGE: novnc

CHECK_IF_PACKAGE_INSTALLED: dpkg -l {{ NOVNC_PACKAGE }} | grep ii
2 changes: 0 additions & 2 deletions ansible/roles/atmo-check-novnc/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
---
# defaults file for atmo-check-vnc

SSH_PORT_TIMEOUT: 30
46 changes: 0 additions & 46 deletions ansible/roles/atmo-check-novnc/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,6 @@
tags:
- vnc

- name: check to see if novnc is installed
shell: "{{ CHECK_IF_PACKAGE_INSTALLED }}"
ignore_errors: yes
failed_when: False
register: novnc_state
tags:
- novnc

- name: check to see if websockify is running
shell: /bin/ps aux | grep "websockify" | grep -v grep
ignore_errors: yes
failed_when: False
register: websockify_state
tags:
- novnc

- name: Fail if novnc is not installed
action: >
{{ ansible_pkg_mgr }} name={{ NOVNC_PACKAGE }} state=present
tags:
- novnc

- name: fail if OS does not contain a GUI
fail: msg="OS does NOT have a GUI for VNC to run on."
when: not (xsession.stat.exists and xterm.stat.exists)
Expand All @@ -75,27 +53,3 @@
- vnc
- check-vnc

- name: fail when novnc is not installed
fail: msg="novnc is not installed for user '{{ ATMOUSERNAME }}'"
when: novnc_state.stdout == ""
tags:
- novnc
- check-novnc

- name: fail when websockify is not running
fail: msg="Websockify is not running for user '{{ ATMOUSERNAME }}'"
when: websockify_state.stdout == ""
tags:
- novnc
- check-novnc

# disabled until further notice
#- name: fail if shell can't talk to vm
# wait_for: >
# search_regex=OpenSSH
# port={{ ansible_port }}
# host={{ ansible_host }}
# delay=1
# timeout={{ SSH_PORT_TIMEOUT }}
# tags: gateone_networking_check
# delegate_to: shell
3 changes: 0 additions & 3 deletions ansible/roles/atmo-check-novnc/vars/CentOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ XGUI:
xsession_path: /usr/bin/xinit
xterm_path: /usr/bin/Xorg

NOVNC_PACKAGE: novnc

CHECK_IF_PACKAGE_INSTALLED: rpm -qa | grep novnc
3 changes: 0 additions & 3 deletions ansible/roles/atmo-check-novnc/vars/Ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ XGUI:
xsession_path: /usr/bin/X
xterm_path: /usr/bin/xinit

NOVNC_PACKAGE: novnc

CHECK_IF_PACKAGE_INSTALLED: dpkg -l {{ NOVNC_PACKAGE }} | grep ii

0 comments on commit 2dcbe35

Please sign in to comment.