diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 52583bb..a0786d4 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -119,6 +119,7 @@ - nis-install - nis-install-server + # tags supported inside nfs.yml: # # nis-install-client @@ -128,6 +129,7 @@ - nis-install - nis-install-client + # tags supported inside samba_user.yml: # # samba-user @@ -137,18 +139,6 @@ - nis-samba-user -- import_tasks: mount_samba_shares.yml - when: "groups['client_pc']|string is search(inventory_hostname)" - tags: - - samba-shares - - -- import_tasks: mount_samba_shares.yml - when: "groups['client_pc']|string is search(inventory_hostname)" - tags: - - samba-shares - - # tags supported system-user-systemfiles.yml: # # profile @@ -202,15 +192,48 @@ - sudoers +# tags supported inside mount_samba_shares.yml: +# +- import_tasks: mount_samba_shares.yml + when: "groups['client_pc']|string is search(inventory_hostname)" + tags: + - samba-shares +# Tasks: Configure VNC (x11vnc) for Ubuntu systems +# +# Supported OS: +# - Ubuntu 16.04LTSi +# - Ubuntu 18.04LTSi + +- name: "For OS: Ubuntu 16.04LTS, Arch: amd64" + import_tasks: ubuntu-x11vnc-1604-amd64.yml + when: + - ansible_distribution_version == "16.04" + - ansible_architecture == "x86_64" + tags: + - x11vnc + - x11vnc-1604 + - finish-client-install +- name: "For OS: Ubuntu 18.04LTS, Arch: amd64" + import_tasks: ubuntu-x11vnc-1804-amd64.yml + when: + - ansible_distribution_version == "18.04" + - ansible_architecture == "x86_64" + tags: + - x11vnc + - x11vnc-1804 + - finish-client-install - - - - - - +- name: "For OS: Ubuntu 20.04LTS, Arch: amd64" + import_tasks: ubuntu-x11vnc-2004-amd64.yml + when: + - ansible_distribution_version == "20.04" + - ansible_architecture == "x86_64" + tags: + - x11vnc + - x11vnc-2004 + - finish-client-install diff --git a/roles/common/tasks/nis-install-client.yml b/roles/common/tasks/nis-install-client.yml index 9bb7f7f..665b378 100644 --- a/roles/common/tasks/nis-install-client.yml +++ b/roles/common/tasks/nis-install-client.yml @@ -179,7 +179,7 @@ - name: (nis-install-client.yml) Adjust file /etc/nsswitch.conf (set hosts) replace: path: /etc/nsswitch.conf - regexp: '(hosts:\s+files)\s+([^nis].*)' + regexp: '(hosts:\s+files)\s+((?!nis).*)$' replace: '\1 nis \2' tags: - nis-install @@ -188,7 +188,7 @@ - name: (nis-install-client.yml) Adjust file /etc/nsswitch.conf (set passwd/group/shadow) replace: path: /etc/nsswitch.conf - regexp: '^({{ item }}:\s+.*)' + regexp: '^({{ item }}:\s+((?!nis).)*)$' replace: '\1 nis' with_items: - passwd diff --git a/roles/common/tasks/ubuntu-x11vnc-1604-amd64.yml b/roles/common/tasks/ubuntu-x11vnc-1604-amd64.yml new file mode 100644 index 0000000..52454ac --- /dev/null +++ b/roles/common/tasks/ubuntu-x11vnc-1604-amd64.yml @@ -0,0 +1,55 @@ +--- + # 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-1604-amd64.yml) check if x11vnc is already installed, if not found skipping...." + stat: + path: /usr/bin/x11vnc + register: x11vnc_active + + - name: "(ubuntu-x11vnc-1604-amd64.yml) Install packages" + apt: + name: ['x11vnc'] + update_cache: yes + state: present + when: x11vnc_active.stat.exists == False + + - name: "(ubuntu-x11vnc-1604-amd64.yml) Store password" + shell: "x11vnc -storepasswd {{ vnc_password }} /etc/x11vnc.pass" + + - name: "(ubuntu-x11vnc-1604-amd64.yml) Set permissions on /etc/x11vnc.pass" + file: + path: /etc/x11vnc.pass + mode: 0644 + + - name: "(ubuntu-x11vnc-1604-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-1604-amd64.yml) Start x11vnc service" + shell: service x11vnc start + + - name: "(ubuntu-x11vnc-1604-amd64.yml) Enable x11vnc service on boot" + systemd: + name: x11vnc.service + daemon_reload: yes + enabled: yes + state: started + +# - name: "(ubuntu-x11vnc-1604-amd64.yml) Blocks x11vnc in GreenOS Desktop Environment for enduser " +# file: +# path: "/usr/share/applications/x11vnc.desktop" +# mode: 0740 +# owner: root +# group: administrator + diff --git a/roles/common/tasks/ubuntu-x11vnc-1804-amd64.yml b/roles/common/tasks/ubuntu-x11vnc-1804-amd64.yml new file mode 100644 index 0000000..0c939ea --- /dev/null +++ b/roles/common/tasks/ubuntu-x11vnc-1804-amd64.yml @@ -0,0 +1,61 @@ +--- + # 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) get numeric id for group 'gdm'" + shell: echo "$(id -u gdm)" + register: grp_id_gdm + + - name: Check if file '/etc/gdm3/custom.conf' exists + stat: + path: /etc/gdm3/custom.conf + register: etc_gdm_custom_conf_exists + + - name: Adjust file '/etc/gdm3/custom.conf' + lineinfile: + dest: /etc/gdm3/custom.conf + state: present + regexp: '^WaylandEnable' + line: 'WaylandEnable=false' + insertafter: '^#?\s*WaylandEnable' + when: + - etc_gdm_custom_conf_exists.stat.exists + + - 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-gdm3.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 + 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..5d67afe --- /dev/null +++ b/roles/common/tasks/ubuntu-x11vnc-2004-amd64.yml @@ -0,0 +1,69 @@ +--- + # 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-2004-amd64.yml) Install packages" + apt: + name: "{{ packages }}" + update_cache: yes + state: present + vars: + packages: + - x11vnc + + - name: "(ubuntu-x11vnc-2004-amd64.yml) get numeric id for group 'gdm'" + shell: echo "$(id -u gdm)" + register: grp_id_gdm + + - name: "(ubuntu-x11vnc-2004-amd64.yml) Store password" + raw: "x11vnc -storepasswd {{ vnc_password }} /etc/x11vnc.pass" + + - name: Check if file '/etc/gdm3/custom.conf' exists + stat: + path: /etc/gdm3/custom.conf + register: etc_gdm_custom_conf_exists + + - name: Adjust file '/etc/gdm3/custom.conf' + lineinfile: + dest: /etc/gdm3/custom.conf + state: present + regexp: '^WaylandEnable' + line: 'WaylandEnable=false' + insertafter: '^#?\s*WaylandEnable' + when: + - etc_gdm_custom_conf_exists.stat.exists + + + - name: "(ubuntu-x11vnc-2004-amd64.yml) Set permissions on /etc/x11vnc.pass" + file: + path: "/etc/x11vnc.pass" + mode: 0644 + + - name: "(ubuntu-x11vnc-2004-amd64.yml) Transfer x11vnc.service.j2 to /lib/systemd/system/x11vnc.service" + template: + src: lib/systemd/system/x11vnc-gdm3.service.j2 + dest: /lib/systemd/system/x11vnc.service + + - name: "(ubuntu-x11vnc-2004-amd64.yml) Enable service" + systemd: + name: x11vnc.service + daemon_reload: yes + enabled: yes + state: restarted + +# - name: "(ubuntu-x11vnc-2004-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 +