diff --git a/roles/common/files/USER_HOME/.config/autostart/x11vnc.desktop b/roles/common/files/USER_HOME/.config/autostart/x11vnc.desktop new file mode 100644 index 0000000..4814b2d --- /dev/null +++ b/roles/common/files/USER_HOME/.config/autostart/x11vnc.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Exec=x11vnc -rfbport -rfbauth /etc/x11vnc.pass +Hidden=false +NoDisplay=false +X-GNOME-Autostart-enabled=true +Name[de_DE]=X11VNC User-Service +Name=X11VNC User-Service +Comment[de_DE]= +Comment= diff --git a/roles/common/tasks/nis-user.yml b/roles/common/tasks/nis-user.yml index 5077d53..409c438 100644 --- a/roles/common/tasks/nis-user.yml +++ b/roles/common/tasks/nis-user.yml @@ -88,3 +88,88 @@ - system-user +- name: (nis_user.yml) Check if directory ~/.config/autostart exists + stat: + path: '{{ nis_base_home }}/{{ item.name }}/.config/autostart' + loop: "{{ nis_user }}" + loop_control: + label: '{{ item.name }}' + register: home_config_autostart + tags: + - nis-user + - x11vnc + + +- name: (nis_user.yml) Ensure directory ~/.config/autostart if not exists + file: + path: '{{ nis_base_home }}/{{ item.item.name }}/.config/autostart' + state: directory + owner: "{{ item.item.name }}" + group: "{{ item.item.name }}" + mode: 0700 + recurse: yes + loop: "{{ home_config_autostart.results }}" + loop_control: + label: '{{ item.item.name }}' + when : not item.stat.exists|bool + tags: + - nis-user + - x11vnc + + +#- name: (nis_user.yml) Ensure directory ~/.config/autostart if not exists +# file: +# path: '{{ nis_base_home }}/{{ item.name }}/.config/autostart' +# state: directory +# owner: "{{ item.name }}" +# group: "{{ item.name }}" +# mode: 0700 +# recurse: yes +# loop: "{{ nis_user }}" +# loop_control: +# label: '{{ item.name }}' +# tags: +# - nis-user +# - x11vnc + + +- name: (nis_user.yml) Check if file ~/.config/autostart/x11vnc.desktop exists + stat: + path: '{{ nis_base_home }}/{{ item.name }}/.config/autostart/x11vnc.desktop' + loop: "{{ nis_user }}" + loop_control: + label: '{{ item.name }}' + register: home_config_autostart_x11vnc + tags: + - nis-user + - x11vnc + +- name: (nis_user.yml) Ensure file ~/.config/autostart/x11vnc.desktop exists + copy: + src: "{{ role_path + '/files/USER_HOME/.config/autostart/x11vnc.desktop' }}" + dest: '{{ nis_base_home }}/{{ item.item.name }}/.config/autostart/x11vnc.desktop' + owner: '{{ item.item.name }}' + group: '{{ item.item.name }}' + mode: 0600 + loop: "{{ home_config_autostart_x11vnc.results }}" + loop_control: + label: '{{ item.item.name }}' + tags: + - nis-user + - x11vnc + +#- name: (nis_user.yml) Ensure file ~/.config/autostart/x11vnc.desktop exists +# copy: +# src: "{{ role_path + '/files/USER_HOME/.config/autostart/x11vnc.desktop' }}" +# dest: '{{ nis_base_home }}/{{ item.name }}/.config/autostart/x11vnc.desktop' +# owner: '{{ item.name }}' +# group: '{{ item.name }}' +# mode: 0600 +# loop: "{{ nis_user }}" +# loop_control: +# label: '{{ item.name }}' +# tags: +# - nis-user +# - x11vnc + + diff --git a/roles/common/tasks/ubuntu-x11vnc-1604-amd64.yml b/roles/common/tasks/ubuntu-x11vnc-1604-amd64.yml index 34ee9b5..52454ac 100644 --- a/roles/common/tasks/ubuntu-x11vnc-1604-amd64.yml +++ b/roles/common/tasks/ubuntu-x11vnc-1604-amd64.yml @@ -1,3 +1,4 @@ +--- # Title: app-x11vnc-server # # Author: Luc Rutten @@ -22,15 +23,6 @@ state: present when: x11vnc_active.stat.exists == False - - name: "(ubuntu-x11vnc-1804-amd64.yml) Install packages" - apt: - name: "{{ packages }}" - update_cache: yes - state: present - vars: - packages: - - x11vnc - - name: "(ubuntu-x11vnc-1604-amd64.yml) Store password" shell: "x11vnc -storepasswd {{ vnc_password }} /etc/x11vnc.pass" diff --git a/roles/common/tasks/ubuntu-x11vnc-1804-amd64.yml b/roles/common/tasks/ubuntu-x11vnc-1804-amd64.yml index 7c803be..7fe1792 100644 --- a/roles/common/tasks/ubuntu-x11vnc-1804-amd64.yml +++ b/roles/common/tasks/ubuntu-x11vnc-1804-amd64.yml @@ -36,13 +36,7 @@ - name: "(ubuntu-x11vnc-1804-amd64.yml) Enable service" systemd: name: x11vnc.service - enabled: true + daemon_reload: yes + enabled: yes state: restarted - - name: "(ubuntu-x11vnc-1804-amd64.yml) Remove whisker menu entry for allusers (except owner and group)" - file: - path: "/usr/share/applications/x11vnc.desktop" - mode: 0750 - owner: root - group: root - diff --git a/roles/common/tasks/ubuntu-x11vnc-2004-amd64.yml b/roles/common/tasks/ubuntu-x11vnc-2004-amd64.yml new file mode 100644 index 0000000..c74859c --- /dev/null +++ b/roles/common/tasks/ubuntu-x11vnc-2004-amd64.yml @@ -0,0 +1,49 @@ +--- + # Title: app-x11vnc-server + # + # Author: Luc Rutten + # Version: 1.0 + # File: tasks/main.yml + # + # Description: + # Remote support + # + # Source: + # - http://c-nergy.be/blog/?p=8984 + + - name: "(ubuntu-x11vnc-1804-amd64.yml) Install packages" + apt: + name: "{{ packages }}" + update_cache: yes + state: present + vars: + packages: + - x11vnc + + - name: "(ubuntu-x11vnc-1804-amd64.yml) Store password" + raw: "x11vnc -storepasswd {{ vnc_password }} /etc/x11vnc.pass" + + - name: "(ubuntu-x11vnc-1804-amd64.yml) Set permissions on /etc/x11vnc.pass" + file: + path: "/etc/x11vnc.pass" + mode: 0644 + + - name: "(ubuntu-x11vnc-1804-amd64.yml) Transfer x11vnc.service.j2 to /lib/systemd/system/x11vnc.service" + template: + src: lib/systemd/system/x11vnc.service.j2 + dest: /lib/systemd/system/x11vnc.service + + - name: "(ubuntu-x11vnc-1804-amd64.yml) Enable service" + systemd: + name: x11vnc.service + daemon_reload: yes + enabled: yes + state: restarted + +# - name: "(ubuntu-x11vnc-1804-amd64.yml) Remove whisker menu entry for allusers (except owner and group)" +# file: +# path: "/usr/share/applications/x11vnc.desktop" +# mode: 0750 +# owner: root +# group: root +