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