From c1d31742a825b4d2fbf977415468c44cd301de48 Mon Sep 17 00:00:00 2001 From: Salt Date: Mon, 17 Feb 2020 16:15:45 -0600 Subject: [PATCH] Add desktop setup role Assumes a Kubuntu full installation --- localhost.yml | 2 + roles/desktop/meta/main.yml | 2 + roles/desktop/tasks/main.yml | 119 ++++++++++++++++++++++ roles/desktop/templates/g810-led.rules | 22 ++++ roles/desktop/templates/hosts | 48 +++++++++ roles/desktop/templates/nomouseaccel.conf | 6 ++ 6 files changed, 199 insertions(+) create mode 100644 roles/desktop/meta/main.yml create mode 100644 roles/desktop/tasks/main.yml create mode 100644 roles/desktop/templates/g810-led.rules create mode 100644 roles/desktop/templates/hosts create mode 100644 roles/desktop/templates/nomouseaccel.conf diff --git a/localhost.yml b/localhost.yml index 246d58e..24cf5b8 100644 --- a/localhost.yml +++ b/localhost.yml @@ -3,4 +3,6 @@ --- - hosts: localhost roles: + - common + - desktop - localansible diff --git a/roles/desktop/meta/main.yml b/roles/desktop/meta/main.yml new file mode 100644 index 0000000..d098f75 --- /dev/null +++ b/roles/desktop/meta/main.yml @@ -0,0 +1,2 @@ +--- +allow_duplicates: no diff --git a/roles/desktop/tasks/main.yml b/roles/desktop/tasks/main.yml new file mode 100644 index 0000000..88797fb --- /dev/null +++ b/roles/desktop/tasks/main.yml @@ -0,0 +1,119 @@ +#!/usr/bin/ansible-playbook +# vim:ft=ansible: +--- +- name: Configure desktop system + block: + - name: Create config directories + file: + path: "{{ item }}" + state: directory + recurse: yes + loop: + - "/etc/X11/xorg.conf.d" + - name: Copy system configs + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + loop: + - { src: "hosts", dest: "/etc/hosts", mode: "0644" } + - { src: "nomouseaccel.conf", dest: "/etc/X11/xorg.conf.d/90-mouse-acceleration.conf", mode: "0644" } + - { src: "g810-led.rules", dest: "/etc/udev/rules.d/50-g810-led.rules", mode: "0644" } + - name: Reload udev + command: /usr/bin/udevadm trigger + - name: Enable i386 architecture + command: /usr/bin/dpkg --add-architecture i386 + - name: Add repos + apt_repository: + repo: "{{ item }}" + loop: + - "ppa:lutris-team/lutris" + - name: Update and upgrade apt packages + apt: + upgrade: yes + update_cache: yes + # One day + cache_valid_time: 86400 + - name: Install basic packages + apt: + name: "{{ packages }}" + vars: + packages: + - build-essential + - git + - openjdk-8-jre # For Minecraft + - python-pip + - python3-pip + - qt5-default # For Multimc, should be installed on Kubuntu + - vim + - xz-utils # For Ansible deb support + - name: Install fonts and themes + apt: + name: "{{ packages }}" + vars: + packages: + - arc-theme + - fonts-inconsolata + - fonts-noto + - fonts-roboto + - papirus-icon-theme + - name: Install games + apt: + name: "{{ packages }}" + vars: + packages: + - minetest + - name: Install out-of-repo packages + apt: + deb: "{{ item }}" + loop: + - "https://github.com/MultiMC/MultiMC5/releases/download/0.6.8/multimc_1.4-1.deb" + - name: Install applications through APT + apt: + name: "{{ packages }}" + vars: + packages: + - chromium-browser + - firefox + - g810-led + - keepassxc + - lutris + - mesa-vulkan-drivers + - mpc + - mpd + - nextcloud-desktop + - redshift + - rofi + - sonata + - steam-installer + - syncthing-gtk + - telegram-desktop + - vulkan-tools + - vulkan-utils + - winetricks + - "libgl1-mesa-dri:i386" + - "mesa-vulkan-drivers:i386" + - name: Install applications through pip3 + pip: + executable: "/usr/bin/pip3" + name: "{{ packages }}" + vars: + packages: + - protontricks + - youtube-dl + - name: Install applications through Snap + snap: + name: "{{ packages }}" + vars: + packages: + - discord + - riot-web + - name: Disable MPD services + systemd: + name: "{{ item }}" + enabled: no + state: stopped + loop: + - mpd.socket + - mpd.service + become: yes diff --git a/roles/desktop/templates/g810-led.rules b/roles/desktop/templates/g810-led.rules new file mode 100644 index 0000000..1757150 --- /dev/null +++ b/roles/desktop/templates/g810-led.rules @@ -0,0 +1,22 @@ +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c336", MODE="666" RUN+="/usr/bin/g213-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c330", MODE="666" RUN+="/usr/bin/g410-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33a", MODE="666" RUN+="/usr/bin/g413-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33c", MODE="666" RUN+="/usr/bin/g513-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c333", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c338", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c331", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c337", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c32b", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c335", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c339", MODE="666" RUN+="/usr/bin/gpro-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c336", MODE="666" RUN+="/usr/bin/g213-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c330", MODE="666" RUN+="/usr/bin/g410-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33a", MODE="666" RUN+="/usr/bin/g413-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33c", MODE="666" RUN+="/usr/bin/g513-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c333", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c338", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c331", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c337", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c32b", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c335", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c339", MODE="666" RUN+="/usr/bin/gpro-led -p /etc/g810-led/profile" diff --git a/roles/desktop/templates/hosts b/roles/desktop/templates/hosts new file mode 100644 index 0000000..390f241 --- /dev/null +++ b/roles/desktop/templates/hosts @@ -0,0 +1,48 @@ +127.0.0.1 localhost +127.0.0.1 {{ ansible_facts['nodename'] }} + +# Fuck off, Spotify +0.0.0.0 adclick.g.doublecklick.net +0.0.0.0 adeventtracker.spotify.com +0.0.0.0 ads-fa.spotify.com +0.0.0.0 analytics.spotify.com +0.0.0.0 audio2.spotify.com +0.0.0.0 b.scorecardresearch.com +0.0.0.0 bounceexchange.com +0.0.0.0 bs.serving-sys.com +0.0.0.0 content.bitsontherun.com +0.0.0.0 core.insightexpressai.com +0.0.0.0 crashdump.spotify.com +0.0.0.0 d2gi7ultltnc2u.cloudfront.net +0.0.0.0 d3rt1990lpmkn.cloudfront.net +0.0.0.0 desktop.spotify.com +0.0.0.0 doubleclick.net +0.0.0.0 ds.serving-sys.com +0.0.0.0 googleadservices.com +0.0.0.0 googleads.g.doubleclick.net +0.0.0.0 gtssl2-ocsp.geotrust.com +0.0.0.0 js.moatads.com +0.0.0.0 log.spotify.com +0.0.0.0 media-match.com +0.0.0.0 omaze.com +0.0.0.0 open.spotify.com +0.0.0.0 pagead46.l.doubleclick.net +0.0.0.0 pagead2.googlesyndication.com +0.0.0.0 partner.googleadservices.com +0.0.0.0 pubads.g.doubleclick.net +0.0.0.0 redirector.gvt1.com +0.0.0.0 s0.2mdn.net +0.0.0.0 securepubads.g.doubleclick.net +0.0.0.0 spclient.wg.spotify.com +0.0.0.0 tpc.googlesyndication.com +0.0.0.0 v.jwpcdn.com +0.0.0.0 video-ad-stats.googlesyndication.com +0.0.0.0 weblb-wg.gslb.spotify.com +0.0.0.0 www.googleadservices.com +0.0.0.0 www.googletagservices.com +0.0.0.0 www.omaze.com + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters diff --git a/roles/desktop/templates/nomouseaccel.conf b/roles/desktop/templates/nomouseaccel.conf new file mode 100644 index 0000000..3887edb --- /dev/null +++ b/roles/desktop/templates/nomouseaccel.conf @@ -0,0 +1,6 @@ +Section "InputClass" + Identifier "mouse" + MatchIsPointer "yes" + Option "AccelProfile" "flat" + Option "AccelSpeed" "-1" +EndSection