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

Replace TigerVNC with XRDP for Workstation #69

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 13 additions & 45 deletions ansible/roles/linux-webconsole/files/guacamole-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,54 +40,23 @@
key: "{{ guacamole_ssh_public_key }}"

- block:
- name: Generate VNC password for Guacamole
- name: Generate password for Guacamole
set_fact:
guacamole_vnc_password: "{{ lookup('community.general.random_string', length = 16, override_special = special_chars) }}"
guacamole_password: "{{ lookup('community.general.random_string', length = 16, override_special = special_chars) }}"
vars:
# Even though this string is within a CDATA tag, there's very small chance of
# generating ]]>, which will still break XML. Therefore remove ">" from special
# characters.
special_chars: '!"#$%&()*+,-./:;<=?@[\]^_`{|}~'

- block:
- name: Get Guacamole user info
getent:
database: passwd
key: "{{ guacamole_user }}"

- name: Set Guacamole user home directory
set_fact:
guacamole_user_home: "{{ ansible_facts.getent_passwd[guacamole_user][4] }}"

- name: Generate VNC password
command: vncpasswd -f
args:
stdin: "{{ guacamole_vnc_password }}"
register: vncpassword

- name: Create VNC directory
file:
state: directory
path: "{{ guacamole_user_home }}/.vnc"
owner: "{{ guacamole_user }}"
group: "{{ guacamole_user }}"
mode: "0775"

- name: Create VNC password file
copy:
content: "{{ vncpassword.stdout }}"
dest: "{{ guacamole_user_home }}/.vnc/passwd"
owner: "{{ guacamole_user }}"
group: "{{ guacamole_user }}"
mode: "0600"
become: yes
become_user: "{{ guacamole_user }}"

- name: Start and enable VNC server
service:
name: vncserver@:1.service
state: started
enabled: yes
- name: Configure default user
ansible.builtin.user:
name: "{{ guacamole_user }}"
state: present
password: "{{ guacamole_password | password_hash('sha512') }}"
append: true
groups: ssl-cert
become: true
when: desktop_enabled

- name: Write Guacamole user mapping file
Expand All @@ -105,12 +74,11 @@
</connection>
{% if desktop_enabled %}
<connection name="desktop">
<protocol>vnc</protocol>
<protocol>rdp</protocol>
<param name="hostname">{{ ansible_default_ipv4.address }}</param>
<param name="port">5901</param>
<param name="autoretry">3</param>
<param name="port">3389</param>
<param name="username">{{ guacamole_user }}</param>
<param name="password"><![CDATA[{{ guacamole_vnc_password }}]]></param>
<param name="password"><![CDATA[{{ guacamole_password }}]]></param>
</connection>
{% endif %}
</authorize>
Expand Down
5 changes: 0 additions & 5 deletions ansible/roles/linux-webconsole/files/vnc_server/restart.conf

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions ansible/roles/linux-webconsole/files/vnc_server/[email protected]

This file was deleted.

12 changes: 0 additions & 12 deletions ansible/roles/linux-webconsole/files/vnc_server/xstartup

This file was deleted.

13 changes: 12 additions & 1 deletion ansible/roles/linux-webconsole/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,20 @@

- block:
- include_tasks: desktop.yml
- include_tasks: vnc_server.yml
when: desktop_enabled is defined and desktop_enabled

- name: Install xrdp
apt:
name: xrdp
state: present
when: ansible_os_family == "Debian"

- name: Install dbus-x11 package
apt:
name: dbus-x11
state: present
when: ansible_os_family == "Debian"

- include_role:
name: linux-ansible-init

Expand Down
67 changes: 0 additions & 67 deletions ansible/roles/linux-webconsole/tasks/vnc_server.yml

This file was deleted.

2 changes: 0 additions & 2 deletions ansible/roles/linux-webconsole/vars/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---

desktop_environment_package: ubuntu-desktop-minimal

tigervnc_server_packages: [tigervnc-standalone-server, tigervnc-xorg-extension, dbus-x11]