feat(ansible): add install desktop packages task and yay&pacman config

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
This commit is contained in:
Rodney Osodo
2025-02-16 00:26:26 +03:00
committed by b1ackd0t
parent 029703b36f
commit 7edfd4921c
15 changed files with 484 additions and 109 deletions
+17
View File
@@ -1,3 +1,20 @@
.PHONY: ping
ping:
ansible-playbook playbooks/ping.yaml --connection=local
.PHONY: prep
prep:
ansible-galaxy collection install community.general
ansible-galaxy collection install kewlfft.aur
.PHONY: install-desktop
install-desktop: prep
ansible-playbook playbooks/environment.yaml --connection=local --ask-become-pass
ansible-playbook playbooks/yay.yaml --connection=local --ask-become-pass
ansible-playbook playbooks/pacman.yaml --connection=local --ask-become-pass
ansible-playbook playbooks/packages/desktop.yaml --connection=local --ask-become-pass
ansible-playbook playbooks/amd.yaml --connection=local --ask-become-pass
ansible-playbook playbooks/audio.yaml --connection=local --ask-become-pass
ansible-playbook playbooks/docker.yaml --connection=local --ask-become-pass
ansible-playbook playbooks/go.yaml --connection=local
ansible-playbook playbooks/rust.yaml --connection=local
+21
View File
@@ -0,0 +1,21 @@
- name: Install AMD GPU Utilities
hosts: 127.0.0.1
tasks:
- name: Install AMD GPU Utilities
kewlfft.aur.aur:
name:
- amd-ucode
- amdgpu_top-bin
- mesa
- xf86-video-amdgpu
- vulkan-radeon
- vulkan-icd-loader
- libva-mesa-driver
- mesa-vdpau
use: yay
state: present
- name: Update GRUB
become: yes
become_user: root
shell: grub-mkconfig -o /boot/grub/grub.cfg
+33
View File
@@ -0,0 +1,33 @@
- name: Setup Audio
hosts: 127.0.0.1
tasks:
- name: Install Bluetooth Utilities
kewlfft.aur.aur:
name:
- bluez
- blueman
- bluez-utils
use: yay
state: present
- name: Add Bluetooth Module to Linux Kernel
community.general.modprobe:
name: btusb
state: present
- name: Start Bluetooth Service
ansible.builtin.systemd_service:
name: bluetooth
state: started
enabled: true
- name: Install Audio Utilities
kewlfft.aur.aur:
name:
- pulseaudio
- pulseaudio-alsa
- pulseaudio-bluetooth
- pulseaudio-jack
- pavucontrol
use: yay
state: present
+31
View File
@@ -0,0 +1,31 @@
- name: Docker Setup After Install
hosts: 127.0.0.1
vars:
ansible_user: rodneyosodo
tasks:
- name: Install Docker if not already installed
kewlfft.aur.aur:
name:
- docker
- docker-buildx
- docker-compose
use: yay
state: present
- name: Start Docker
ansible.builtin.systemd_service:
name: docker
state: started
enabled: true
- name: Add Current User to Docker Group
ansible.builtin.shell:
cmd: usermod -aG docker "{{ ansible_user }}"
executable: /bin/bash
become: yes
- name: Restart libvirtd
ansible.builtin.systemd_service:
name: libvirtd
state: restarted
daemon_reload: true
+24
View File
@@ -0,0 +1,24 @@
- name: Setup Environment
hosts: 127.0.0.1
become: yes
become_user: root
tasks:
- name: Add Language to Environment
ansible.builtin.lineinfile:
path: /etc/environment
line: "LANG=en_GB.utf-8"
state: present
create: true
mode: 0644
owner: root
group: root
- name: Add Locale to Environment
ansible.builtin.lineinfile:
path: /etc/environment
line: "LC_ALL=en_GB.utf-8"
state: present
create: true
mode: 0644
owner: root
group: root
+25
View File
@@ -0,0 +1,25 @@
- name: Rust Setup After Install
hosts: 127.0.0.1
tasks:
- name: Install Golang if not already installed
kewlfft.aur.aur:
name:
- go
use: yay
state: present
- name: Install Golang Tools
ansible.builtin.shell: |
go install golang.org/x/tools/cmd/godoc@latest
go install github.com/go-delve/delve/cmd/dlv@latest
go install github.com/google/pprof@latest
go install golang.org/x/tools/gopls@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/go-critic/go-critic/cmd/gocritic@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/orlangure/gocovsh@latest
go install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest
go install go.uber.org/nilaway/cmd/nilaway@latest
go install github.com/oligot/go-mod-upgrade@latest
go install github.com/vektra/mockery/v2@latest
+155
View File
@@ -0,0 +1,155 @@
7zip
act
alacritty
ansible
arduino-cli
arduino-ide
asciinema
beekeeper-studio-bin
biome-bin
brave-bin
btop
bun-bin
ccache
cloud-sql-proxy
cloud-utils
cmake
commitizen-go
ctop
dbeaver
discord
dmidecode
docker
docker-buildx
docker-compose
easyeda-bin
eslint
esp-idf
eza
flameshot
fzf
ghostty
gimp
git
git-delta
git-lfs
github-cli
go
google-chrome
google-cloud-cli
google-cloud-cli-gke-gcloud-auth-plugin
graphviz
grub-customizer
guestfs-tools
helm
httpie
hyperfine
inkscape
ipython
jdk-openjdk
jq
just
k6
kconfig
kompose
kubectl
lazydocker
lazysql
lens-bin
libc++
libguestfs
libvirt
libvirt-glib
libvirt-python
localsearch
markdownlint-cli
neofetch
neovim
ngrok
ninja
nodejs
nodejs-npm-upgrade
obs-studio
obsidian
openbsd-netcat
openssl-1.1
openvpn
openvpn3
pacman-contrib
pandoc-cli
platformio-core
pnpm
postman-bin
pre-commit
psutils
putty
pyenv
pyenv-virtualenv
python-pip
python-psycopg2
python36
qbittorrent
qemu-base
qemu-desktop
qemu-full
quota-tools
redisinsight-bin
ruff
rustup
rye
slack-desktop
sshpass
staticcheck
stm32cubeide
swtpm
tailscale
teams
terraform
thefuck
tinygo
tldr
tmux
tree
ttf-hack-nerd
ttf-meslo-nerd
unrar
upx
uv
virt-install
virt-manager
virt-viewer
visual-studio-code-bin
vlc
w3m
wabt
wakatime
wasmer
yarn
yay
zed
zellij
zen-browser-bin
zephyr
zig
zip
zsh
bat
lsof
downgrade
make
npm
rsync
vim
p7zip
tar
curl
wget
preload
kicad
mosquitto-clients
less
syncthing
k9s
lazygit
goreleaser
golangci-lint
+58
View File
@@ -0,0 +1,58 @@
- name: Ping all hosts
hosts: 127.0.0.1
vars:
package_file: "desktop.txt"
tasks:
- name: Read package list from file
slurp:
src: "{{ package_file }}"
register: package_file_content
delegate_to: localhost
- name: Set package list variable
set_fact:
package_list: "{{ (package_file_content['content'] | b64decode).split('\n') | select('regex', '^[a-zA-Z0-9_-]+$') | list }}"
- name: Run the equivalent of "pacman -Sy" as a separate step
community.general.pacman:
update_cache: true
become: yes
remote_user: root
- name: Run the equivalent of "pacman -Su" as a separate step
community.general.pacman:
upgrade: true
become: yes
remote_user: root
- name: Install packages using yay
kewlfft.aur.aur:
name: "{{ package_list }}"
use: yay
state: latest
- name: Remove unnecessary packages
community.general.pacman:
name:
- gnome-connections
- gnome-contacts
- simple-scan
- gnome-maps
- gnome-tour
state: absent
become: yes
become_user: root
- name: Install Syncthing
kewlfft.aur.aur:
name:
- syncthing
use: yay
state: present
- name: Start Syncthing Service
ansible.builtin.systemd_service:
name: syncthing@rodneyosodo
state: started
enabled: true
register: syncthing
+52
View File
@@ -0,0 +1,52 @@
- name: Setup Pacman
hosts: 127.0.0.1
become: yes
become_user: root
tasks:
- name: Enable Colour in pacman.conf
ansible.builtin.replace:
path: /etc/pacman.conf
regexp: "^#Color"
replace: "Color"
- name: Enable Parallel Downloads in pacman.conf
ansible.builtin.replace:
path: /etc/pacman.conf
regexp: '^(#\s*)?ParallelDownloads\s*=.*'
replace: "ParallelDownloads = 5"
- name: Run the equivalent of "pacman -Sy" as a separate step
community.general.pacman:
update_cache: true
- name: Run the equivalent of "pacman -Su" as a separate step
community.general.pacman:
upgrade: true
- name: Install Preload
kewlfft.aur.aur:
name:
- preload
use: yay
state: latest
become: no
- name: Start Preload
ansible.builtin.systemd_service:
name: preload
state: started
enabled: true
- name: Install pacman-contrib
kewlfft.aur.aur:
name:
- pacman-contrib
use: yay
state: latest
become: no
- name: Start paccache.timer
ansible.builtin.systemd_service:
name: paccache.timer
state: started
enabled: true
+21
View File
@@ -0,0 +1,21 @@
- name: Rust Setup After Install
hosts: 127.0.0.1
tasks:
- name: Install Rustup if not already installed
kewlfft.aur.aur:
name:
- rustup
use: yay
state: present
- name: Install Nightly Toolchain
ansible.builtin.shell: |
rustup update
rustup target add wasm32-wasip1 wasm32-wasip2 wasm32-wasi wasm32-unknown-unknown
rustup toolchain install nightly nightly-2018-12-27
rustup component add clippy cargo rustfmt rust-std
- name: Install Cargo Tools
ansible.builtin.shell:
cmd: cargo install du-dust fd-find ripgrep cargo-generate jwt-cli wasm-pack git-cliff cargo-dist
executable: /bin/bash
+34
View File
@@ -0,0 +1,34 @@
- name: Install yay
hosts: 127.0.0.1
vars:
build_directory: "/tmp/yay-build"
tasks:
- name: Check if yay is installed
command: yay --version
register: yay_version
ignore_errors: true
- name: Install prerequisites
community.general.pacman:
name:
- git
- base-devel
state: present
- name: Clone yay repository
git:
repo: https://aur.archlinux.org/yay.git
dest: "{{ build_directory }}"
when: yay_version.rc != 0
- name: Build and install yay
shell: cd "{{ build_directory }}" && makepkg -si --noconfirm
when: yay_version.rc != 0
args:
creates: /usr/bin/yay
- name: Clean up build directory
file:
path: "{{ build_directory }}"
state: absent
when: ansible_check_mode == false
-5
View File
@@ -1,5 +0,0 @@
# Pacman Conf
The file `pacman.conf` is copied to `/etc/pacman.conf`. This mainly adds support to the parallel download of packages.
The file environment is copied to `/etc/environment`. This sets the locale.
-7
View File
@@ -1,7 +0,0 @@
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#
LANG=en_GB.utf-8
LC_ALL=en_GB.utf-8
-97
View File
@@ -1,97 +0,0 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
#NoProgressBar
CheckSpace
#VerbosePkgLists
ParallelDownloads = 5
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[core-testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
#[extra-testing]
#Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/bash
if command -v apt &>/dev/null; then
sudo apt install ansible
sudo apt install ansible-galaxy
elif command -v pacman &>/dev/null; then
sudo pacman -S ansible
sudo pacman -S ansible-galaxy
else
echo "Could not find apt or pacman"
exit 1
fi