diff --git a/ansible/roles.disabled/atmo-check-novnc/defaults/main.yml b/ansible/roles.disabled/atmo-check-novnc/defaults/main.yml new file mode 100644 index 000000000..3c6b1670f --- /dev/null +++ b/ansible/roles.disabled/atmo-check-novnc/defaults/main.yml @@ -0,0 +1,4 @@ +--- +# defaults file for atmo-check-vnc + +SSH_PORT_TIMEOUT: 30 diff --git a/ansible/roles.disabled/atmo-check-novnc/tasks/main.yml b/ansible/roles.disabled/atmo-check-novnc/tasks/main.yml new file mode 100644 index 000000000..706e90cca --- /dev/null +++ b/ansible/roles.disabled/atmo-check-novnc/tasks/main.yml @@ -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 diff --git a/ansible/roles.disabled/atmo-check-novnc/vars/CentOS-5.yml b/ansible/roles.disabled/atmo-check-novnc/vars/CentOS-5.yml new file mode 100644 index 000000000..64176fe79 --- /dev/null +++ b/ansible/roles.disabled/atmo-check-novnc/vars/CentOS-5.yml @@ -0,0 +1,6 @@ +--- + +XGUI: + xsession_path: /usr/bin/xinit + xterm_path: /usr/bin/xterm + diff --git a/ansible/roles.disabled/atmo-check-novnc/vars/CentOS.yml b/ansible/roles.disabled/atmo-check-novnc/vars/CentOS.yml new file mode 100644 index 000000000..1fa88553c --- /dev/null +++ b/ansible/roles.disabled/atmo-check-novnc/vars/CentOS.yml @@ -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 diff --git a/ansible/roles.disabled/atmo-check-novnc/vars/Ubuntu.yml b/ansible/roles.disabled/atmo-check-novnc/vars/Ubuntu.yml new file mode 100644 index 000000000..b95243eba --- /dev/null +++ b/ansible/roles.disabled/atmo-check-novnc/vars/Ubuntu.yml @@ -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 diff --git a/ansible/roles/atmo-check-novnc/defaults/main.yml b/ansible/roles/atmo-check-novnc/defaults/main.yml index 3c6b1670f..b78748785 100644 --- a/ansible/roles/atmo-check-novnc/defaults/main.yml +++ b/ansible/roles/atmo-check-novnc/defaults/main.yml @@ -1,4 +1,2 @@ --- # defaults file for atmo-check-vnc - -SSH_PORT_TIMEOUT: 30 diff --git a/ansible/roles/atmo-check-novnc/tasks/main.yml b/ansible/roles/atmo-check-novnc/tasks/main.yml index 706e90cca..ceb754404 100644 --- a/ansible/roles/atmo-check-novnc/tasks/main.yml +++ b/ansible/roles/atmo-check-novnc/tasks/main.yml @@ -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) @@ -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 diff --git a/ansible/roles/atmo-check-novnc/vars/CentOS.yml b/ansible/roles/atmo-check-novnc/vars/CentOS.yml index 1fa88553c..3eaa9d571 100644 --- a/ansible/roles/atmo-check-novnc/vars/CentOS.yml +++ b/ansible/roles/atmo-check-novnc/vars/CentOS.yml @@ -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 diff --git a/ansible/roles/atmo-check-novnc/vars/Ubuntu.yml b/ansible/roles/atmo-check-novnc/vars/Ubuntu.yml index b95243eba..406344fea 100644 --- a/ansible/roles/atmo-check-novnc/vars/Ubuntu.yml +++ b/ansible/roles/atmo-check-novnc/vars/Ubuntu.yml @@ -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