From 973643cfbc46db5452eaa4554f7058fbc8e3c4a4 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 21 Oct 2019 09:09:44 +0100 Subject: [PATCH] Split CLI and GUI setup --- gui.yml | 13 ++++ main.yml | 2 +- .../files/keyboard-gb.conf | 0 roles/distro-gui/tasks/debian.yml | 27 ++++++++ roles/distro-gui/tasks/freebsd.yml | 46 +++++++++++++ roles/distro-gui/tasks/main.yml | 5 ++ roles/distro/tasks/debian.yml | 21 +----- roles/distro/tasks/freebsd.yml | 39 +---------- roles/home-gui/files/Xresources | 67 +++++++++++++++++++ roles/{home => home-gui}/files/fonts.conf | 0 .../files/nextcloud.desktop | 0 .../files/redshift-gtk.desktop | 0 roles/{home => home-gui}/files/redshift.conf | 0 .../files/remmina-applet.desktop | 0 roles/{home => home-gui}/files/user.js | 0 roles/home-gui/files/zshrc | 3 + roles/home-gui/tasks/dirs.yml | 9 +++ roles/home-gui/tasks/dotfiles.yml | 25 +++++++ roles/{home => home-gui}/tasks/emacs.yml | 0 roles/{home => home-gui}/tasks/firefox.yml | 0 roles/home-gui/tasks/main.yml | 7 ++ roles/{home => home-gui}/tasks/mate.yml | 0 .../templates/mate-acp.layout | 0 roles/home/tasks/dirs.yml | 8 --- roles/home/tasks/dotfiles.yml | 24 ------- roles/home/tasks/main.yml | 3 - 26 files changed, 208 insertions(+), 91 deletions(-) create mode 100755 gui.yml rename roles/{distro => distro-gui}/files/keyboard-gb.conf (100%) create mode 100644 roles/distro-gui/tasks/debian.yml create mode 100644 roles/distro-gui/tasks/freebsd.yml create mode 100644 roles/distro-gui/tasks/main.yml create mode 100644 roles/home-gui/files/Xresources rename roles/{home => home-gui}/files/fonts.conf (100%) rename roles/{home => home-gui}/files/nextcloud.desktop (100%) rename roles/{home => home-gui}/files/redshift-gtk.desktop (100%) rename roles/{home => home-gui}/files/redshift.conf (100%) rename roles/{home => home-gui}/files/remmina-applet.desktop (100%) rename roles/{home => home-gui}/files/user.js (100%) create mode 100644 roles/home-gui/files/zshrc create mode 100644 roles/home-gui/tasks/dirs.yml create mode 100644 roles/home-gui/tasks/dotfiles.yml rename roles/{home => home-gui}/tasks/emacs.yml (100%) rename roles/{home => home-gui}/tasks/firefox.yml (100%) create mode 100644 roles/home-gui/tasks/main.yml rename roles/{home => home-gui}/tasks/mate.yml (100%) rename roles/{home => home-gui}/templates/mate-acp.layout (100%) diff --git a/gui.yml b/gui.yml new file mode 100755 index 0000000..b642db4 --- /dev/null +++ b/gui.yml @@ -0,0 +1,13 @@ +#!/usr/bin/env ansible-playbook +--- +- name: Setup GUI + hosts: localhost + tasks: + - include_role: + name: distro + - include_role: + name: distro-gui + - include_role: + name: home + - include_role: + name: home-gui diff --git a/main.yml b/main.yml index c382a4c..cf78199 100755 --- a/main.yml +++ b/main.yml @@ -1,6 +1,6 @@ #!/usr/bin/env ansible-playbook --- -- name: Setup +- name: Setup CLI hosts: localhost tasks: - include_role: diff --git a/roles/distro/files/keyboard-gb.conf b/roles/distro-gui/files/keyboard-gb.conf similarity index 100% rename from roles/distro/files/keyboard-gb.conf rename to roles/distro-gui/files/keyboard-gb.conf diff --git a/roles/distro-gui/tasks/debian.yml b/roles/distro-gui/tasks/debian.yml new file mode 100644 index 0000000..89f5a91 --- /dev/null +++ b/roles/distro-gui/tasks/debian.yml @@ -0,0 +1,27 @@ +--- +- name: Install Debian GUI packages + become: true + apt: + name: '{{ packages }}' + state: present + force_apt_get: yes + vars: + packages: + - caja-open-terminal + - dconf-cli + - desktop-base + - emacs + - evolution + - galculator + - git-gui + - mpv + - nextcloud-desktop + - redshift-gtk + - remmina + - rxvt-unicode + - seahorse + - task-british-desktop + - task-mate-desktop + - vim-gtk + - xinput + - xterm diff --git a/roles/distro-gui/tasks/freebsd.yml b/roles/distro-gui/tasks/freebsd.yml new file mode 100644 index 0000000..3a40417 --- /dev/null +++ b/roles/distro-gui/tasks/freebsd.yml @@ -0,0 +1,46 @@ +--- +- name: Install FreeBSD core GUI packages + become: true + pkgng: + name: drm-kmod mate xdm xorg xterm + state: present +- name: Install FreeBSD additional GUI packages + become: true + pkgng: + name: '{{ packages }}' + state: present + vars: + packages: + - dbus + - emacs + - en_GB-libreoffice + - firefox-esr + - galculator + - git-gui + - iosevka + - libreoffice + - mpv + - nextcloudclient + - redshift + - remmina + - remmina-plugin-rdp + - rxvt-unicode + - seahorse + - xinput +- name: Start DBUS service + become: true + service: + name: dbus + state: started + enabled: yes +- name: Enable XDM + become: true + lineinfile: + path: /etc/ttys + regexp: '^ttyv8\s.*' + line: 'ttyv8 "/usr/local/bin/xdm -nodaemon" xterm on secure' +- name: Set xorg keyboard layout + become: true + copy: + src: keyboard-gb.conf + dest: /usr/local/etc/X11/xorg.conf.d/keyboard-gb.conf diff --git a/roles/distro-gui/tasks/main.yml b/roles/distro-gui/tasks/main.yml new file mode 100644 index 0000000..ee52af3 --- /dev/null +++ b/roles/distro-gui/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- include: debian.yml + when: ansible_distribution == 'Debian' +- include: freebsd.yml + when: ansible_distribution == 'FreeBSD' diff --git a/roles/distro/tasks/debian.yml b/roles/distro/tasks/debian.yml index fbf78a2..42973b8 100644 --- a/roles/distro/tasks/debian.yml +++ b/roles/distro/tasks/debian.yml @@ -1,5 +1,5 @@ --- -- name: Install Debian packages +- name: Install Debian CLI packages become: true apt: name: '{{ packages }}' @@ -11,39 +11,22 @@ - ansible - asciidoctor - build-essential - - caja-open-terminal - dc - - dconf-cli - - desktop-base - devscripts - dnsutils - - emacs - - evolution - - galculator - git - - git-gui - gnupg - mc - - mpv - - nextcloud-desktop - nmap - openssh-server - packagekit - python3 - python3-psutil - realmd - - redshift-gtk - - remmina - - rxvt-unicode - - seahorse - sqlite3 - sssd - sudo - - task-british-desktop - - task-mate-desktop - tlp - tmux - - vim-gtk - - xinput - - xterm + - vim - zsh diff --git a/roles/distro/tasks/freebsd.yml b/roles/distro/tasks/freebsd.yml index bda8946..458e70f 100644 --- a/roles/distro/tasks/freebsd.yml +++ b/roles/distro/tasks/freebsd.yml @@ -1,61 +1,28 @@ --- -- name: Install FreeBSD core packages +- name: Install FreeBSD core CLI packages become: true pkgng: - name: drm-kmod en-freebsd-doc git mate pkg py36-ansible sudo xdm xorg xterm + name: en-freebsd-doc git pkg py36-ansible sudo state: present -- name: Install FreeBSD additional packages +- name: Install FreeBSD additional CLI packages become: true pkgng: name: '{{ packages }}' state: present vars: packages: - - dbus - - emacs - - en_GB-libreoffice - - firefox-esr - fusefs-ntfs - - galculator - - git-gui - gnu-watch - gnupg - - iosevka - - libreoffice - mc - - mpv - - nextcloudclient - nmap - openvpn - py36-psutil - - redshift - - remmina - - remmina-plugin-rdp - rubygem-asciidoctor - - rxvt-unicode - - seahorse - sqlite3 - tmux - vim - - xinput - zsh -- name: Start DBUS service - become: true - service: - name: dbus - state: started - enabled: yes -- name: Enable XDM - become: true - lineinfile: - path: /etc/ttys - regexp: '^ttyv8\s.*' - line: 'ttyv8 "/usr/local/bin/xdm -nodaemon" xterm on secure' -- name: Set xorg keyboard layout - become: true - copy: - src: keyboard-gb.conf - dest: /usr/local/etc/X11/xorg.conf.d/keyboard-gb.conf - name: Disable core dumps become: true sysctl: diff --git a/roles/home-gui/files/Xresources b/roles/home-gui/files/Xresources new file mode 100644 index 0000000..c11ded2 --- /dev/null +++ b/roles/home-gui/files/Xresources @@ -0,0 +1,67 @@ +*color: true +URxvt*background: #111111 +URxvt*color0: #1e1e1e +URxvt*color1: #cc0000 +URxvt*color2: #4e9a06 +URxvt*color3: #c4a000 +URxvt*color4: #3465a4 +URxvt*color5: #75507b +URxvt*color6: #0b939b +URxvt*color7: #d3d7cf +URxvt*color8: #555753 +URxvt*color9: #ef2929 +URxvt*color10: #8ae234 +URxvt*color11: #fce94f +URxvt*color12: #729fcf +URxvt*color13: #ad7fa8 +URxvt*color14: #00f5e9 +URxvt*color15: #eeeeec +URxvt*font: xft:Monospace:Regular:size=10 +URxvt*foreground: #c0c0c0 +URxvt*letterSpace: -1 +URxvt*locale: true +URxvt*metaSendsEscape: true +URxvt*perl-ext: -searchable-scrollback +URxvt*scrollBar_right: true +URxvt*termName: rxvt-unicode +XClock*hourColor: black +XClock*majorColor: red +XClock*minorColor: black +XClock*minuteColor: black +XClock*render: true +XClock*secondColor: red +XClock*update: 1 +Xft.hintstyle: hintfull +Xft.rgba: none +xterm*background: #111111 +xterm*color0: #1e1e1e +xterm*color1: #cc0000 +xterm*color2: #4e9a06 +xterm*color3: #c4a000 +xterm*color4: #3465a4 +xterm*color5: #75507b +xterm*color6: #0b939b +xterm*color7: #d3d7cf +xterm*color8: #555753 +xterm*color9: #ef2929 +xterm*color10: #8ae234 +xterm*color11: #fce94f +xterm*color12: #729fcf +xterm*color13: #ad7fa8 +xterm*color14: #00f5e9 +xterm*color15: #eeeeec +xterm*faceName: xft:Monospace:Regular:size=10 +xterm*faceSize1: 4 +xterm*faceSize2: 6 +xterm*faceSize3: 8 +xterm*faceSize4: 12 +xterm*faceSize5: 14 +xterm*faceSize6: 16 +xterm*faceSize: 9 +xterm*foreground: #c0c0c0 +xterm*locale: true +xterm*metaSendsEscape: true +xterm*scrollBar: true +xterm*utf8: always +xterm*utf8Fonts: always +xterm*utf8Title: true diff --git a/roles/home/files/fonts.conf b/roles/home-gui/files/fonts.conf similarity index 100% rename from roles/home/files/fonts.conf rename to roles/home-gui/files/fonts.conf diff --git a/roles/home/files/nextcloud.desktop b/roles/home-gui/files/nextcloud.desktop similarity index 100% rename from roles/home/files/nextcloud.desktop rename to roles/home-gui/files/nextcloud.desktop diff --git a/roles/home/files/redshift-gtk.desktop b/roles/home-gui/files/redshift-gtk.desktop similarity index 100% rename from roles/home/files/redshift-gtk.desktop rename to roles/home-gui/files/redshift-gtk.desktop diff --git a/roles/home/files/redshift.conf b/roles/home-gui/files/redshift.conf similarity index 100% rename from roles/home/files/redshift.conf rename to roles/home-gui/files/redshift.conf diff --git a/roles/home/files/remmina-applet.desktop b/roles/home-gui/files/remmina-applet.desktop similarity index 100% rename from roles/home/files/remmina-applet.desktop rename to roles/home-gui/files/remmina-applet.desktop diff --git a/roles/home/files/user.js b/roles/home-gui/files/user.js similarity index 100% rename from roles/home/files/user.js rename to roles/home-gui/files/user.js diff --git a/roles/home-gui/files/zshrc b/roles/home-gui/files/zshrc new file mode 100644 index 0000000..6157cec --- /dev/null +++ b/roles/home-gui/files/zshrc @@ -0,0 +1,3 @@ +if [ -r $HOME/.shrc ]; then + . $HOME/.shrc +fi diff --git a/roles/home-gui/tasks/dirs.yml b/roles/home-gui/tasks/dirs.yml new file mode 100644 index 0000000..c1d6c72 --- /dev/null +++ b/roles/home-gui/tasks/dirs.yml @@ -0,0 +1,9 @@ +--- +- name: Create user applications directory + file: + path: "{{ ansible_env.HOME }}/.local/share/applications" + state: directory +- name: Create user autostart directory + file: + path: "{{ ansible_env.HOME }}/.config/autostart" + state: directory diff --git a/roles/home-gui/tasks/dotfiles.yml b/roles/home-gui/tasks/dotfiles.yml new file mode 100644 index 0000000..7fdba8e --- /dev/null +++ b/roles/home-gui/tasks/dotfiles.yml @@ -0,0 +1,25 @@ +--- +- name: Copy .Xresources + copy: + src: Xresources + dest: "{{ ansible_env.HOME }}/.Xresources" +- name: Copy .fonts.conf + copy: + src: fonts.conf + dest: "{{ ansible_env.HOME }}/.fonts.conf" +- name: Copy redshift.conf + copy: + src: redshift.conf + dest: "{{ ansible_env.HOME }}/.config/redshift.conf" +- name: Auto start nextcloud + copy: + src: nextcloud.desktop + dest: "{{ ansible_env.HOME }}/.config/autostart/nextcloud.desktop" +- name: Auto start redshift-gtk + copy: + src: redshift-gtk.desktop + dest: "{{ ansible_env.HOME }}/.config/autostart/redshift-gtk.desktop" +- name: Auto start remmina-applet + copy: + src: remmina-applet.desktop + dest: "{{ ansible_env.HOME }}/.config/autostart/remmina-applet.desktop" diff --git a/roles/home/tasks/emacs.yml b/roles/home-gui/tasks/emacs.yml similarity index 100% rename from roles/home/tasks/emacs.yml rename to roles/home-gui/tasks/emacs.yml diff --git a/roles/home/tasks/firefox.yml b/roles/home-gui/tasks/firefox.yml similarity index 100% rename from roles/home/tasks/firefox.yml rename to roles/home-gui/tasks/firefox.yml diff --git a/roles/home-gui/tasks/main.yml b/roles/home-gui/tasks/main.yml new file mode 100644 index 0000000..73b31a0 --- /dev/null +++ b/roles/home-gui/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- include: dirs.yml + +- include: dotfiles.yml +- include: emacs.yml +- include: firefox.yml +- include: mate.yml diff --git a/roles/home/tasks/mate.yml b/roles/home-gui/tasks/mate.yml similarity index 100% rename from roles/home/tasks/mate.yml rename to roles/home-gui/tasks/mate.yml diff --git a/roles/home/templates/mate-acp.layout b/roles/home-gui/templates/mate-acp.layout similarity index 100% rename from roles/home/templates/mate-acp.layout rename to roles/home-gui/templates/mate-acp.layout diff --git a/roles/home/tasks/dirs.yml b/roles/home/tasks/dirs.yml index 0f5af1e..4541a01 100644 --- a/roles/home/tasks/dirs.yml +++ b/roles/home/tasks/dirs.yml @@ -11,14 +11,6 @@ file: path: "{{ ansible_env.HOME }}/.config/systemd/user" state: directory -- name: Create user applications directory - file: - path: "{{ ansible_env.HOME }}/.local/share/applications" - state: directory -- name: Create user autostart directory - file: - path: "{{ ansible_env.HOME }}/.config/autostart" - state: directory - name: Create ~/.ssh directory file: path: "{{ ansible_env.HOME }}/.ssh" diff --git a/roles/home/tasks/dotfiles.yml b/roles/home/tasks/dotfiles.yml index c607bb7..275bb7c 100644 --- a/roles/home/tasks/dotfiles.yml +++ b/roles/home/tasks/dotfiles.yml @@ -1,12 +1,4 @@ --- -- name: Copy .Xresources - copy: - src: Xresources - dest: "{{ ansible_env.HOME }}/.Xresources" -- name: Copy .fonts.conf - copy: - src: fonts.conf - dest: "{{ ansible_env.HOME }}/.fonts.conf" - name: Copy .gitconfig copy: src: gitconfig @@ -27,19 +19,3 @@ copy: src: openpgp.asc dest: "{{ ansible_env.HOME }}/.config/openpgp.asc" -- name: Copy redshift.conf - copy: - src: redshift.conf - dest: "{{ ansible_env.HOME }}/.config/redshift.conf" -- name: Auto start nextcloud - copy: - src: nextcloud.desktop - dest: "{{ ansible_env.HOME }}/.config/autostart/nextcloud.desktop" -- name: Auto start redshift-gtk - copy: - src: redshift-gtk.desktop - dest: "{{ ansible_env.HOME }}/.config/autostart/redshift-gtk.desktop" -- name: Auto start remmina-applet - copy: - src: remmina-applet.desktop - dest: "{{ ansible_env.HOME }}/.config/autostart/remmina-applet.desktop" diff --git a/roles/home/tasks/main.yml b/roles/home/tasks/main.yml index dc3c748..2ddd5a0 100644 --- a/roles/home/tasks/main.yml +++ b/roles/home/tasks/main.yml @@ -2,9 +2,6 @@ - include: dirs.yml - include: dotfiles.yml -- include: emacs.yml -- include: firefox.yml -- include: mate.yml - include: shell.yml - include: vim.yml - include: ssh-authorized-keys.yml