aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md100
-rw-r--r--group_vars/all/vars.yml88
-rw-r--r--inventory.yml3
-rw-r--r--run.yml170
4 files changed, 361 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d93c466
--- /dev/null
+++ b/README.md
@@ -0,0 +1,100 @@
1# ansible-desktop
2Ansible playbook to install a copy of my desktop setup
3
4## Features
5Simple one-command deployment of a fully functional desktop
6
7- Custom builds of:
8
9 - dwm
10 - dmenu
11 - st
12 - slock
13 - tabbed
14
15- Configuration for a variety of programs including:
16
17 - abook
18 - calcurse
19 - cava
20 - cmus
21 - dunst
22 - firejail
23 - fontconfig
24 - gtk2 & gtk3
25 - htop
26 - khard
27 - mutt/neomutt
28 - newsboat
29 - picom
30 - ranger
31 - sxhkd
32 - ufw
33 - vim
34 - zathura
35 - zsh
36
37- Custom shell scripts for:
38
39 - dwm status bar
40 - document compilation
41 - encrypted usb management
42 - getting passwords from `pass` via dmenu
43 - mounting and unmounting removable drives
44 - screenshots
45 - volume control
46 and more
47
48## Distros
49
50This playbook has been specifically designed to run on Debian systems. The current Debian stable version is considered to be the supported distro.
51
52The playbook should work for other distros; most seamlessly on Debian-derivatives.
53However, updates to package names may be necessary when not running against Debian stable.
54
55## Usage
56
57### Prerequisite non-root user
58The playbook assumes you have a non-root user that was created during the installation.
59
60The playbook will add this user to the sudo group and deploy the dotfiles in their home directory.
61
62If you do not have a non-root user please create one prior to running the playbook.
63
64### Clone the repository
65```
66git clone https://git.chudnick.com/ansible-desktop
67```
68
69### Modify the inventory
70Modify the inventory.yml for your deployment.
71At a minimum, change `desktop.local` to the name of your desktop to configure. This could also `localhost` if you are running the playbook on the machine to be configured.
72
73### Modify vars.yml
74Modify group\_vars/all/vars.yml for your deployment.
75Below is a list of the variables and there function:
76
77 - amdcpu - installs amd cpu microcode
78 - amdgpu - installs amd gpu firmware
79 - intelcpu - install intel cpu firmware
80 - nvidiagpu - installs nvidia gpu firmware and drivers
81 - amd_microcode_package - package that install amd cpu microcode
82 - intel_microcode_package - package that install intel cpu microcode
83 - amdgpu_firwamre_package - package that installs amdgpu firmware
84 - nvidia_firmware_package - package that installs nvidia firmware
85 - user - the username of your non-root user on the desktop
86 - build_packages - packages needed to build suckless programs
87 - packages - list of packages to install
88
89
90Make sure to modify the hardware variables for your machine.
91Set user to the non-root user you created during installation.
92
93### Run the playbook
94From the repo root directory run:
95```
96ansible-playbook run.yml -i inventory.yml
97```
98
99### Login to the desktop
100When the playbook finishes you can login to your desktop. If you were already logged in you will need to logout and back in to load the changes.
diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml
new file mode 100644
index 0000000..3c952f9
--- /dev/null
+++ b/group_vars/all/vars.yml
@@ -0,0 +1,88 @@
1amdcpu: yes
2amdgpu: yes
3intelcpu: no
4nvidiagpu: no
5
6amd_microcode_package: amd64-microcode
7intel_microcode_package: intel-microcode
8amdgpu_firware_package: firmware-amdgpu
9nvidia_firmware_package: firmware-misc-nonfree
10
11user: user
12
13# Don't change these unless you know what you are doing
14build_packages:
15 - build-essential
16 - libx11-dev
17 - libx11-xcb-dev
18 - libxcb-res0-dev
19 - libxft-dev
20 - libxinerama-dev
21 - libxrender-dev
22 - libx11-dev
23 - libx11-xcb-dev
24 - libxcb-res0-dev
25 - libxft-dev
26 - libxinerama-dev
27 - libxrender-dev
28 - fontconfig
29 - libharfbuzz-dev
30
31
32packages:
33 - acl
34 - apt-file
35 - arc-theme
36 - bc
37 - calcurse
38 - cava
39 - cmus
40 - cryptsetup
41 - curl
42 - diffutils
43 - dunst
44 - feh
45 - ffmpeg
46 - findutils
47 - firefox-esr
48 - firejail
49 - fonts-inconsolata
50 - fonts-liberation
51 - fonts-noto-color-emoji
52 - fzf
53 - gcc
54 - gdb
55 - git
56 - gpg
57 - groff
58 - htop
59 - imagemagick
60 - keepassxc
61 - lm-sensors
62 - locate
63 - maim
64 - make
65 - mpv
66 - neofetch
67 - neomutt
68 - network-manager
69 - newsboat
70 - pass-extension-otp
71 - pass
72 - picom
73 - pulseaudio
74 - ranger
75 - rsync
76 - sshfs
77 - suckless-tools
78 - sudo
79 - sxhkd
80 - sysstat
81 - ufw
82 - unclutter-xfixes
83 - vim
84 - xclip
85 - xorg
86 - zathura
87 - zsh-syntax-highlighting
88 - zsh
diff --git a/inventory.yml b/inventory.yml
new file mode 100644
index 0000000..564430d
--- /dev/null
+++ b/inventory.yml
@@ -0,0 +1,3 @@
1all:
2 hosts:
3 desktop.local:
diff --git a/run.yml b/run.yml
new file mode 100644
index 0000000..e543701
--- /dev/null
+++ b/run.yml
@@ -0,0 +1,170 @@
1- name: deployment
2 hosts: all
3 become: yes
4
5 tasks:
6 - name: use https repos
7 when: ansible_facts['os_family'] == 'Debian'
8 replace:
9 path: /etc/apt/sources.list
10 regexp: "http://"
11 replace: "https://"
12
13 - name: temporarily enable non-free suites
14 when: ansible_facts['os_family'] == 'Debian'
15 replace:
16 path: /etc/apt/sources.list
17 regexp: "main"
18 replace: "main contrib non-free non-free-firmware"
19
20 - name: update and upgrade
21 when: ansible_facts['os_family'] == 'Debian'
22 apt:
23 name: "*"
24 state: latest
25 update_cache: yes
26 register: apt_upgrade
27 retries: 100
28 until: apt_upgrade is success or ('Failed to lock apt for exclusive operation' not in apt_upgrade.msg and '/var/lib/dpkg/lock' not in apt_upgrade.msg)
29
30 - name: install amdgpu firmware
31 when: "{{ amdgpu }}|bool"
32 package:
33 name: "{{ amdgpu_firmware_package }}"
34 state: latest
35
36 - name: install nvidia gpu firmware
37 when: "{{ nvidiagpu }}|bool"
38 package:
39 name: "{{ nvidia_firmware_package }}"
40 state: latest
41
42 - name: install amd cpu microcode
43 when: "{{ amdcpu }}|bool"
44 package:
45 name: "{{ amd_microcode_package }}"
46 state: latest
47
48 - name: install intel cpu microcode
49 when: "{{ intelcpu }}|bool"
50 package:
51 name: "{{ intel_microcode_package }}"
52 state: latest
53
54 - name: remove non-free suites
55 when: ansible_facts['os_family'] == 'Debian'
56 replace:
57 path: /etc/apt/sources.list
58 regexp: "main contrib non-free non-free-firmware"
59 replace: "main"
60
61 - name: update and upgrade
62 when: ansible_facts['os_family'] == 'Debian'
63 apt:
64 name: "*"
65 state: latest
66 update_cache: yes
67 register: apt_upgrade
68 retries: 100
69 until: apt_upgrade is success or ('Failed to lock apt for exclusive operation' not in apt_upgrade.msg and '/var/lib/dpkg/lock' not in apt_upgrade.msg)
70
71 - name: install packages
72 package:
73 name: "{{ packages }}"
74 state: latest
75
76 - name: enable ufw
77 ufw:
78 state: enabled
79
80 - name: default deny incoming
81 ufw:
82 default: deny
83 direction: incoming
84
85 - name: default allow outgoing
86 ufw:
87 default: allow
88 direction: outgoing
89
90 - name: reload ufw
91 ufw:
92 state: reloaded
93
94 - name: add user to sudo group and change shell
95 user:
96 name: "{{ username }}"
97 shell: /usr/bin/zsh
98 groups: sudo
99 append: yes
100
101 - name: clone dotfiles repo
102 git:
103 repo: https://git.chudnick.com/dwm
104 dest: /tmp/dotfiles
105
106 - name: copy dotfiles into home directory
107 become_user: "{{ username }}"
108 command:
109 cmd: "rsync --exclude .git/ --exclude LICENSE -av /tmp/dotfiles/ /home/{{ username }}"
110
111 # ------
112
113 - name: install packages for building suckless tools
114 package:
115 name: "{{ build_packages }}"
116 state: latest
117
118 - name: clone dwm repo
119 git:
120 repo: https://git.chudnick.com/dwm
121 dest: /tmp/dwm
122
123 - name: build dwm
124 make:
125 chdir: /tmp/dwm
126 target: clean install
127
128
129 - name: clone dmenu repo
130 git:
131 repo: https://git.chudnick.com/dmenu
132 dest: /tmp/dmenu
133
134 - name: build dmenu
135 make:
136 chdir: /tmp/dmenu
137 target: clean install
138
139
140 - name: clone st repo
141 git:
142 repo: https://git.chudnick.com/st
143 dest: /tmp/st
144
145 - name: build st
146 make:
147 chdir: /tmp/st
148 target: clean install
149
150
151 - name: clone slock repo
152 git:
153 repo: https://git.chudnick.com/slock
154 dest: /tmp/slock
155
156 - name: build slock
157 make:
158 chdir: /tmp/slock
159 target: clean install
160
161
162 - name: clone tabbed repo
163 git:
164 repo: https://git.chudnick.com/tabbed
165 dest: /tmp/tabbed
166
167 - name: build tabbed
168 make:
169 chdir: /tmp/tabbed
170 target: clean install