Unify everything into one config playbook. Handle some more stuff

This commit is contained in:
exu 2024-10-09 21:40:52 +02:00
parent 9a00a664fe
commit 916b0d41eb
5 changed files with 308 additions and 269 deletions

View File

@ -197,7 +197,6 @@ sudo cp -r "$tempdir/arch-config/etc" /
# Copy pacman config depending on system architecture # Copy pacman config depending on system architecture
# This is required due to differences in available repos between Arch on x86_64 and ALARM for aarch64 # This is required due to differences in available repos between Arch on x86_64 and ALARM for aarch64
# TODO
if [ "$(uname --machine)" == "x86_64" ]; then if [ "$(uname --machine)" == "x86_64" ]; then
sudo cp "/etc/pacman-x86_64.conf" "/etc/pacman.conf" sudo cp "/etc/pacman-x86_64.conf" "/etc/pacman.conf"
fi fi
@ -231,7 +230,6 @@ EOF
systemctl --user daemon-reload systemctl --user daemon-reload
# set systemd services for vmware (only if installed) # set systemd services for vmware (only if installed)
# TODO
if [[ $(pacman -Q | grep vmware-workstation) ]]; then if [[ $(pacman -Q | grep vmware-workstation) ]]; then
sudo systemctl enable --now vmware-networks.service || echo "Service failed, continuing" sudo systemctl enable --now vmware-networks.service || echo "Service failed, continuing"
sudo systemctl enable --now vmware-usbarbitrator.service || echo "Service failed, continuing" sudo systemctl enable --now vmware-usbarbitrator.service || echo "Service failed, continuing"
@ -247,7 +245,6 @@ fi
sudo systemctl enable fstrim.timer sudo systemctl enable fstrim.timer
# enable btrfs maintenance timers # enable btrfs maintenance timers
# TODO
if [[ $(pacman -Q | grep btrfsmaintenance) ]]; then if [[ $(pacman -Q | grep btrfsmaintenance) ]]; then
sudo systemctl restart btrfsmaintenance-refresh.service sudo systemctl restart btrfsmaintenance-refresh.service
sudo systemctl enable btrfs-balance.timer sudo systemctl enable btrfs-balance.timer
@ -261,7 +258,6 @@ sudo timedatectl set-ntp true
systemctl --user enable --now ssh-agent systemctl --user enable --now ssh-agent
# enable reflector timer # enable reflector timer
# TODO
if [[ $(pacman -Q | grep reflector) ]]; then if [[ $(pacman -Q | grep reflector) ]]; then
sudo systemctl enable reflector.timer sudo systemctl enable reflector.timer
fi fi
@ -277,7 +273,6 @@ cat <<EOF
EOF EOF
# set systemd and group for vmware (only if installed) # set systemd and group for vmware (only if installed)
# TODO
if [[ $(pacman -Q | grep vmware-workstation) ]]; then if [[ $(pacman -Q | grep vmware-workstation) ]]; then
echo "Setting up group for vmware" echo "Setting up group for vmware"
sudo groupadd -f vmware sudo groupadd -f vmware

View File

@ -1,66 +0,0 @@
---
- name: Copy new files and directories
ansible.builtin.copy:
src: "files/{{ item }}"
dest: "~/{{ item }}"
loop:
- ".config"
- ".face"
- ".gitconfig"
- ".gtkrc-2.0"
- ".local"
- ".ssh"
- "scripts"
- name: Copy new files and directories (root)
ansible.builtin.copy:
src: "files/{{ item }}"
dest: "~/{{ item }}"
loop:
- "etc"
become: true
- name: Symlink xdg environment variables
ansible.builtin.file:
src: "~/.config/user-dirs.dirs"
dest: "~/.config/environment.d/user-dirs.dirs.conf"
state: "link"
- name: Download bash cat
ansible.builtin.git:
repo: https://github.com/exu-g/bash-cat-with-cat.git
dest: "/tmp/bash-cat-with-cat"
- name: Copy bash cat to scripts
ansible.builtin.copy:
src: "/tmp/bash-cat-with-cat/cat.sh"
dest: "~/scripts/pieces/cat.sh"
mode: "0755"
- name: Reload user systemd services
ansible.builtin.systemd_service:
daemon_reload: true
- name: Enable fstrim
ansible.builtin.systemd_service:
name: fstrim.timer
state: "started"
enabled: true
become: true
- name: Enable NTP
ansible.builtin.command: timedatectl set-ntp true
become: true
- name: Enable ssh-agent
ansible.builtin.systemd_service:
name: ssh-agent
state: "restarted"
enabled: true
- name: Enable vnstat
ansible.builtin.systemd_service:
name: vnstat
state: "started"
enabled: true
become: true

View File

@ -1,8 +1,143 @@
--- ---
- name: Include tasks from preparation.yml # - name: Include tasks from preparation.yml
ansible.builtin.include_tasks: # ansible.builtin.include_tasks:
file: preparation.yml # file: preparation.yml
- name: Include tasks from copy_new.yml - name: Gather the package facts
ansible.builtin.include_tasks: ansible.builtin.package_facts:
file: copy_new.yml
- name: Create backup structure
ansible.builtin.file:
path: "~/old_dat"
state: "directory"
- name: Copy files to backup
ansible.builtin.copy:
src: "~/{{ item }}"
dest: "~/old_dat/{{ item }}"
loop:
- ".config"
- ".ssh"
- ".local/share/applications"
- ".mozilla"
- "scripts"
- name: Remove old files and directories
ansible.builtin.file:
path: "{{ item }}"
state: "absent"
loop:
- "~/.config/Vorlagen"
- "~/scripts/in_path"
- "~/scripts/pieces"
- "~/scripts/polybar"
- "~/scripts/archive"
# - name: Include tasks from copy_new.yml
# ansible.builtin.include_tasks:
# file: copy_new.yml
- name: Copy new files and directories
ansible.builtin.copy:
#src: "files/{{ item }}"
src: "{{ item }}"
dest: "~/{{ item }}"
loop:
- ".config"
- ".face"
- ".gitconfig"
- ".gtkrc-2.0"
- ".local"
- ".ssh"
- "scripts"
- name: Copy new files and directories (root)
ansible.builtin.copy:
#src: "files/{{ item }}"
src: "{{ item }}"
dest: "~/{{ item }}"
loop:
- "etc"
become: true
- name: x86_64 | Copy files (root)
ansible.builtin.copy:
src: "{{ item }}"
dest: "/etc/pacman.conf"
loop:
- "/etc/pacman-x86_64.conf"
when: ansible_architecture == "x86_64"
become: true
- name: Symlink xdg environment variables
ansible.builtin.file:
src: "~/.config/user-dirs.dirs"
dest: "~/.config/environment.d/user-dirs.dirs.conf"
state: "link"
- name: Bash cat | Download
ansible.builtin.git:
repo: https://github.com/exu-g/bash-cat-with-cat.git
dest: "/tmp/bash-cat-with-cat"
- name: Bash cat | Copy to scripts
ansible.builtin.copy:
src: "/tmp/bash-cat-with-cat/cat.sh"
dest: "~/scripts/pieces/cat.sh"
mode: "0755"
- name: Reload user systemd services
ansible.builtin.systemd_service:
daemon_reload: true
- name: Enable fstrim
ansible.builtin.systemd_service:
name: fstrim.timer
state: "started"
enabled: true
become: true
- name: Enable btrfsmaintenance timers
ansible.builtin.systemd_service:
name: "{{ item }}"
enabled: true
loop:
- "btrfs-balance.timer"
- "btrfs-scrub.timer"
when: ('btrfsmaintenance' in ansible_facts.packages)
become: true
- name: Enable btrfsmaintenance services
ansible.builtin.systemd_service:
name: "{{ item }}"
state: "restarted"
loop:
- "btrfsmaintenance-refresh.service"
when: ('btrfsmaintenance' in ansible_facts.packages)
become: true
- name: Enable reflector
ansible.builtin.systemd_service:
name: "{{ item }}"
enabled: true
loop:
- "reflector.timer"
when: ('reflector' in ansible_facts.packages)
become: true
- name: Enable NTP
ansible.builtin.command: timedatectl set-ntp true
become: true
- name: Enable ssh-agent
ansible.builtin.systemd_service:
name: ssh-agent
state: "restarted"
enabled: true
- name: Enable vnstat
ansible.builtin.systemd_service:
name: vnstat
state: "started"
enabled: true
become: true

View File

@ -1,26 +0,0 @@
- name: Create backup structure
ansible.builtin.file:
path: "~/old_dat"
state: "directory"
- name: Copy files to backup
ansible.builtin.copy:
src: "~/{{ item }}"
dest: "~/old_dat/{{ item }}"
loop:
- ".config"
- ".ssh"
- ".local/share/applications"
- ".mozilla"
- "scripts"
- name: Remove old files and directories
ansible.builtin.file:
path: "{{ item }}"
state: "absent"
loop:
- "~/.config/Vorlagen"
- "~/scripts/in_path"
- "~/scripts/pieces"
- "~/scripts/polybar"
- "~/scripts/archive"

View File

@ -1,174 +1,175 @@
--- ---
- name: Update packages - name: Update packages
community.general.pacman: community.general.pacman:
update_cache: true update_cache: true
upgrade: true upgrade: true
become: true become: true
- name: Install official packages - name: Install official packages
community.general.pacman: community.general.pacman:
state: present state: present
# select the lines and use 'M-x sort-lines' # select the lines and use 'M-x sort-lines'
name: name: "{{ item }}"
#- gnome-keyring loop:
#- hdparm #- gnome-keyring
#- libaacs #- hdparm
#- libbluray #- libaacs
#- libcdio #- libbluray
#- libdvdcss #- libcdio
#- libdvdnav #- libdvdcss
#- libdvdread #- libdvdnav
#- libsecret #- libdvdread
#- phonon-qt5-gstreamer #- libsecret
#- seahorse #- phonon-qt5-gstreamer
- aardvark-dns # containers #- seahorse
- amd-ucode # microcode - aardvark-dns # containers
- ansible # iac - amd-ucode # microcode
- base-devel # devel stuff - ansible # iac
- bind # dnsutils (nslookup, dig) - base-devel # devel stuff
- btrfs-progs # btrfs - bind # dnsutils (nslookup, dig)
- buildah # containers - btrfs-progs # btrfs
- clang - buildah # containers
- cmake - clang
- composer - cmake
- discord - composer
- dnsmasq # virtualization - discord
- dosfstools # fat - dnsmasq # virtualization
- e2fsprogs # ext4 - dosfstools # fat
- easyeffects # audio effects - e2fsprogs # ext4
- edk2-ovmf # virtualization - easyeffects # audio effects
- emacs-wayland - edk2-ovmf # virtualization
- exfatprogs # exfat - emacs-wayland
- f2fs-tools # f2fs - exfatprogs # exfat
- fd - f2fs-tools # f2fs
- ffmpeg # multimedia - fd
- firefox # browser - ffmpeg # multimedia
- firewalld # firewall - firefox # browser
- fish # shell - firewalld # firewall
- flatpak # packages - fish # shell
- freetype2 # fonts - flatpak # packages
- fuse-overlayfs # containers - freetype2 # fonts
- fwupd # firmware - fuse-overlayfs # containers
- fwupd-efi # firmware - fwupd # firmware
- gdb - fwupd-efi # firmware
- git # code - gdb
- git-lfs # code - git # code
- hunspell # spelling - git-lfs # code
- hunspell-de # spelling - hunspell # spelling
- hunspell-en_gb # spelling - hunspell-de # spelling
- hunspell-en_us # spelling - hunspell-en_gb # spelling
- hyphen # spelling - hunspell-en_us # spelling
- hyphen-de # spelling - hyphen # spelling
- hyphen-en # spelling - hyphen-de # spelling
- imv # image viewer - hyphen-en # spelling
- intel-media-driver # VAAPI - imv # image viewer
- intel-ucode # microcode - intel-media-driver # VAAPI
- jre-openjdk # java - intel-ucode # microcode
- just # command runner - jre-openjdk # java
- kde-applications-meta # kde - just # command runner
- kid3 # music metadata - kde-applications-meta # kde
- krita - kid3 # music metadata
- languagetool - krita
- lib32-mesa # video driver - languagetool
- lib32-vulkan-intel # video driver - lib32-mesa # video driver
- lib32-vulkan-radeon # video driver - lib32-vulkan-intel # video driver
- libreoffice-fresh # office - lib32-vulkan-radeon # video driver
- libreoffice-fresh-de # office - libreoffice-fresh # office
- libva-intel-driver # VAAPI - libreoffice-fresh-de # office
- libva-mesa-driver # VAAPI - libva-intel-driver # VAAPI
- libva-utils # VAAPI - libva-mesa-driver # VAAPI
- libvirt # virtualization - libva-utils # VAAPI
- linux # kernel - libvirt # virtualization
- linux-firmware # kernel - linux # kernel
- linux-headers # kernel - linux-firmware # kernel
- lldb - linux-headers # kernel
- lldb-mi - lldb
- lutris # games - lldb-mi
- man-db # docs - lutris # games
- mesa # video driver - man-db # docs
- mesa-vdpau # VDPAU - mesa # video driver
- mosh # remote shell - mesa-vdpau # VDPAU
- mtools # fat - mosh # remote shell
- mythes-de # thesaurus - mtools # fat
- mythes-en # thesaurus - mythes-de # thesaurus
- nerd-fonts # fonts - mythes-en # thesaurus
- nextcloud-client # cloud - nerd-fonts # fonts
- nodejs - nextcloud-client # cloud
- noto-fonts # fonts - nodejs
- noto-fonts-cjk # fonts - noto-fonts # fonts
- noto-fonts-emoji # fonts - noto-fonts-cjk # fonts
- ntfs-3g # ntfs - noto-fonts-emoji # fonts
- nvme-cli # nvme ssd - ntfs-3g # ntfs
- obs-studio # recording - nvme-cli # nvme ssd
- okular # pdf - obs-studio # recording
- openssh # remote shell - okular # pdf
- opentofu # iac - openssh # remote shell
- otf-font-awesome # fonts - opentofu # iac
- p7zip # compression - otf-font-awesome # fonts
- packagekit-qt6 - p7zip # compression
- pacman-contrib # scripts - packagekit-qt6
- pandoc - pacman-contrib # scripts
- php # code - pandoc
- piper # mouse - php # code
- pipewire # audio - piper # mouse
- pipewire-alsa # audio - pipewire # audio
- pipewire-jack # audio - pipewire-alsa # audio
- pipewire-pulse # audio - pipewire-jack # audio
- pkgstats - pipewire-pulse # audio
- podman # containers - pkgstats
- power-profiles-daemon # power management - podman # containers
- prettier # code - power-profiles-daemon # power management
- pyright # code - prettier # code
- python-black # code - pyright # code
- python-debugpy # code - python-black # code
- python-isort # code - python-debugpy # code
- python-pip # code - python-isort # code
- python-pipenv # code - python-pip # code
- python-pyflakes # code - python-pipenv # code
- python-pytest # code - python-pyflakes # code
- qemu-full # virtualization - python-pytest # code
- rebuild-detector # packages - qemu-full # virtualization
- reflector # mirrors - rebuild-detector # packages
- restic # backup - reflector # mirrors
- ripgrep # doom emacs - restic # backup
- rsync # file sync - ripgrep # doom emacs
- ruby-sass # code - rsync # file sync
- shellcheck # code - ruby-sass # code
- shfmt # code - shellcheck # code
- smartmontools # disks - shfmt # code
- steam # games - smartmontools # disks
- stress # benchmark - steam # games
- stylelint # code - stress # benchmark
- tesseract-data-deu - stylelint # code
- tesseract-data-eng - tesseract-data-deu
- texlive-core - tesseract-data-eng
- thunderbird # email - texlive-core
- tidy - thunderbird # email
- traceroute # network - tidy
- transmission-remote-gtk # torrent - traceroute # network
- ttf-fira-code # fonts - transmission-remote-gtk # torrent
- ttf-fira-sans # fonts - ttf-fira-code # fonts
- udftools # udf - ttf-fira-sans # fonts
- unrar # compression - udftools # udf
- unzip # compression - unrar # compression
- util-linux # various utils - unzip # compression
- vdpauinfo # VDPAU - util-linux # various utils
- vim # editor - vdpauinfo # VDPAU
- virt-manager # virtualization - vim # editor
- vscode-css-languageserver - virt-manager # virtualization
- vulkan-intel # video driver - vscode-css-languageserver
- vulkan-radeon # video driver - vulkan-intel # video driver
- wget # network - vulkan-radeon # video driver
- wine # windows - wget # network
- wireguard-tools # vpn - wine # windows
- wireplumber # audio - wireguard-tools # vpn
- xdg-desktop-portal-gtk # flatpak theming - wireplumber # audio
- xdg-user-dirs # standards - xdg-desktop-portal-gtk # flatpak theming
- xdg-utils # standards - xdg-user-dirs # standards
- xfsprogs # xfs - xdg-utils # standards
- yt-dlp - xfsprogs # xfs
# - dockerfile-language-server # code # AUR - yt-dlp
# - dockfmt # AUR # - dockerfile-language-server # code # AUR
# - refind-theme-nord # bootmenu # AUR # - dockfmt # AUR
# - btrfsmaintenance # AUR # - refind-theme-nord # bootmenu # AUR
# - btrfsmaintenance # AUR
become: true become: true