From fbee2136ab7072f325bec0ab517492090a11450b Mon Sep 17 00:00:00 2001 From: Andrey Limachko Date: Fri, 3 Jun 2022 08:12:15 +0400 Subject: [PATCH] Add VNC support --- roles/common/tasks/main.yml | 13 +++++++++++++ roles/common/tasks/vnc.yml | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 roles/common/tasks/vnc.yml diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 8d74705..d56f98d 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -196,3 +196,16 @@ state: mounted with_items: "{{node.mounts}}" when: node.mounts is defined + +- name: Add VNC Service + include_tasks: vnc.yml + when: node.vnc | default(True) | bool + +- name: Populate service facts + service_facts: + +- name: Restart LightDM service + service: + name: lightdm + state: restarted + when: node.vnc | default(True) | bool and 'lightdm.service' in services diff --git a/roles/common/tasks/vnc.yml b/roles/common/tasks/vnc.yml new file mode 100644 index 0000000..cf197c6 --- /dev/null +++ b/roles/common/tasks/vnc.yml @@ -0,0 +1,20 @@ +--- +- name: Install xorg-extension-vnc + apt_rpm: + pkg: xorg-extension-vnc + state: present + +- name: Uncomment Xorg VNC config + replace: + path: /etc/X11/xorg.conf.d/vnc.conf + regexp: '^#(.*)$' + replace: '\1' + +- name: Create .vnc directory + file: + path: /root/.vnc + state: directory + mode: '0755' + +- name: Set VNC password + shell: echo "123456" | vncpasswd -f > /root/.vnc/passwd