new version after nix

This commit is contained in:
Bartal Laearsson
2026-06-29 13:23:11 +01:00
commit 753dfe7dc8
14 changed files with 898 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
---
- name: Enable RPM Fusion free repository
ansible.builtin.dnf:
name: "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ ansible_facts['distribution_major_version'] }}.noarch.rpm"
state: present
disable_gpg_check: true
- name: Upgrade installed Fedora packages
ansible.builtin.dnf:
name: "*"
state: latest
update_cache: true
when: upgrade_system
- name: Install Fedora workstation packages
ansible.builtin.dnf:
name: "{{ fedora_packages }}"
state: present
allowerasing: true
update_cache: true
- name: Install virtualization package group
ansible.builtin.dnf:
name: "{{ virtualization_packages }}"
state: present
when: install_virtualization
+27
View File
@@ -0,0 +1,27 @@
---
- name: Ensure Stow target directories exist
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ user_name }}"
mode: "{{ item.mode }}"
loop:
- { path: "{{ user_home }}/.config", mode: "0755" }
- { path: "{{ user_home }}/.ssh", mode: "0700" }
become: false
- name: Clone or update the public dotfiles repository
ansible.builtin.git:
repo: "{{ dotfiles_repo }}"
dest: "{{ dotfiles_dir }}"
version: main
update: true
become: false
- name: Install all dotfiles with GNU Stow
ansible.builtin.shell: stow -R *
args:
chdir: "{{ dotfiles_dir }}"
executable: /bin/bash
become: false
changed_when: false
+35
View File
@@ -0,0 +1,35 @@
---
- name: Enable workstation system services
ansible.builtin.systemd_service:
name: "{{ item }}"
enabled: true
state: started
loop:
- NetworkManager.service
- cups.service
- sshd.service
- name: Select SDDM as the display manager
ansible.builtin.file:
src: /usr/lib/systemd/system/sddm.service
dest: /etc/systemd/system/display-manager.service
state: link
force: true
- name: Use the graphical boot target
ansible.builtin.file:
src: /usr/lib/systemd/system/graphical.target
dest: /etc/systemd/system/default.target
state: link
force: true
- name: Reload systemd after selecting the display manager
ansible.builtin.systemd_service:
daemon_reload: true
- name: Enable libvirt
ansible.builtin.systemd_service:
name: libvirtd.service
enabled: true
state: started
when: install_virtualization
+43
View File
@@ -0,0 +1,43 @@
---
- name: Check if sqlcmd is already installed
ansible.builtin.stat:
path: /usr/local/bin/sqlcmd
register: sqlcmd_bin
- name: Download sqlcmd archive
ansible.builtin.get_url:
url: "{{ sqlcmd_url }}"
dest: "/tmp/{{ sqlcmd_archive }}"
when: not sqlcmd_bin.stat.exists
- name: Create sqlcmd extraction directory
ansible.builtin.file:
path: /tmp/sqlcmd_extract
state: directory
mode: "0755"
when: not sqlcmd_bin.stat.exists
- name: Extract sqlcmd
ansible.builtin.unarchive:
src: "/tmp/{{ sqlcmd_archive }}"
dest: /tmp/sqlcmd_extract
remote_src: true
creates: /tmp/sqlcmd_extract/sqlcmd
when: not sqlcmd_bin.stat.exists
- name: Move sqlcmd binary to /usr/local/bin
ansible.builtin.copy:
src: /tmp/sqlcmd_extract/sqlcmd
dest: /usr/local/bin/sqlcmd
mode: "0755"
remote_src: true
when: not sqlcmd_bin.stat.exists
- name: Clean up sqlcmd temp files
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- "/tmp/{{ sqlcmd_archive }}"
- /tmp/sqlcmd_extract
when: not sqlcmd_bin.stat.exists
+76
View File
@@ -0,0 +1,76 @@
---
- name: Read the configured timezone
ansible.builtin.command: timedatectl show --property=Timezone --value
register: configured_timezone
changed_when: false
- name: Set the system timezone
ansible.builtin.command: "timedatectl set-timezone {{ system_timezone }}"
when: configured_timezone.stdout != system_timezone
- name: Configure system locale
ansible.builtin.copy:
dest: /etc/locale.conf
mode: "0644"
content: |
LANG={{ system_locale }}
LC_ADDRESS={{ regional_locale }}
LC_IDENTIFICATION={{ regional_locale }}
LC_MEASUREMENT={{ regional_locale }}
LC_MONETARY={{ regional_locale }}
LC_NAME={{ regional_locale }}
LC_NUMERIC={{ regional_locale }}
LC_PAPER={{ regional_locale }}
LC_TELEPHONE={{ regional_locale }}
LC_TIME={{ regional_locale }}
- name: Configure console keyboard
ansible.builtin.copy:
dest: /etc/vconsole.conf
mode: "0644"
content: |
KEYMAP=dk
- name: Add workstation user to administrative and device groups
ansible.builtin.user:
name: "{{ user_name }}"
groups: "{{ ['wheel', 'video', 'input'] + (['libvirt'] if install_virtualization else []) }}"
append: true
shell: /usr/bin/zsh
- name: Check transparent hugepage kernel argument
ansible.builtin.shell: |
grubby --info=ALL | awk '
/^args=/ {
seen = 1
if (index($0, "transparent_hugepage=never") == 0) missing = 1
}
END { exit !(seen && !missing) }
'
args:
executable: /bin/bash
register: transparent_hugepage_argument
changed_when: false
failed_when: false
- name: Disable transparent hugepages in all boot entries
ansible.builtin.command:
argv:
- grubby
- --update-kernel=ALL
- --args=transparent_hugepage=never
when: transparent_hugepage_argument.rc != 0
- name: Configure workstation environment
ansible.builtin.copy:
dest: /etc/profile.d/fedora-workstation.sh
mode: "0644"
content: |
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export GOPATH="${GOPATH:-$HOME/go}"
export PATH="$HOME/.scripts:$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.bun/bin:$HOME/bin/zig:$HOME/bin/zls:$GOPATH/bin:$PATH"
export TERMINAL=foot
export BROWSER=zen
export GTK_THEME=Adwaita:dark
export MOZ_ENABLE_WAYLAND=1
export ELECTRON_OZONE_PLATFORM_HINT=wayland
+119
View File
@@ -0,0 +1,119 @@
---
- name: List globally installed npm packages
ansible.builtin.command: npm list --global --depth=0 --json
register: npm_global_list
changed_when: false
failed_when: false
- name: Install global language servers and formatters
ansible.builtin.command: "npm install --global {{ item }}"
loop: "{{ npm_global_packages }}"
when: item not in ((npm_global_list.stdout | default('{}', true) | from_json).dependencies | default({}))
- name: Check for rustup
ansible.builtin.stat:
path: "{{ user_home }}/.cargo/bin/rustup"
become: false
register: rustup_binary
- name: Download the official rustup installer
ansible.builtin.get_url:
url: https://sh.rustup.rs
dest: /tmp/rustup-init.sh
mode: "0755"
when: not rustup_binary.stat.exists
- name: Install Rust stable with the official rustup installer
ansible.builtin.command:
argv:
- /tmp/rustup-init.sh
- -y
- --default-toolchain
- stable
- --profile
- default
environment:
HOME: "{{ user_home }}"
become: false
when: not rustup_binary.stat.exists
- name: Remove the rustup installer
ansible.builtin.file:
path: /tmp/rustup-init.sh
state: absent
- name: Check the active Rust toolchain
ansible.builtin.command: "{{ user_home }}/.cargo/bin/rustup show active-toolchain"
become: false
register: active_rust_toolchain
changed_when: false
failed_when: false
- name: Select the Rust stable toolchain
ansible.builtin.command: "{{ user_home }}/.cargo/bin/rustup default stable"
become: false
when: active_rust_toolchain.rc != 0 or not active_rust_toolchain.stdout.startswith('stable-')
- name: List installed rustup components
ansible.builtin.command: "{{ user_home }}/.cargo/bin/rustup component list --installed"
become: false
register: installed_rustup_components
changed_when: false
- name: Install Rust development components
ansible.builtin.command: "{{ user_home }}/.cargo/bin/rustup component add {{ item }}"
loop: "{{ rustup_components }}"
become: false
when: installed_rustup_components.stdout_lines | select('match', '^' ~ item ~ '(-|$)') | list | length == 0
- name: Check for StyLua
ansible.builtin.stat:
path: "{{ user_home }}/.cargo/bin/stylua"
become: false
register: stylua_binary
- name: Install StyLua
ansible.builtin.command: "{{ user_home }}/.cargo/bin/cargo install stylua --locked"
become: false
when: not stylua_binary.stat.exists
- name: Check for Starship
ansible.builtin.stat:
path: "{{ user_home }}/.local/bin/starship"
become: false
register: starship_binary
- name: Download the Starship installer
ansible.builtin.get_url:
url: https://starship.rs/install.sh
dest: /tmp/starship-install.sh
mode: "0755"
when: not starship_binary.stat.exists
- name: Install Starship for the workstation user
ansible.builtin.command:
argv:
- /tmp/starship-install.sh
- --yes
- --bin-dir
- "{{ user_home }}/.local/bin"
become: false
when: not starship_binary.stat.exists
- name: Check for Bun
ansible.builtin.stat:
path: "{{ user_home }}/.bun/bin/bun"
become: false
register: bun_binary
- name: Download the Bun installer
ansible.builtin.get_url:
url: https://bun.sh/install
dest: /tmp/bun-install.sh
mode: "0755"
when: not bun_binary.stat.exists
- name: Install Bun for the workstation user
ansible.builtin.command: /tmp/bun-install.sh
become: false
when: not bun_binary.stat.exists
+56
View File
@@ -0,0 +1,56 @@
---
- name: Create Ansible-managed user directories
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ user_name }}"
mode: "{{ item.mode }}"
loop:
- { path: "{{ user_home }}/.ssh", mode: "0700" }
- { path: "{{ user_home }}/Pictures", mode: "0755" }
become: false
- name: Check for the Git signing public key
ansible.builtin.stat:
path: "{{ git_signing_key }}"
become: false
register: git_signing_public_key
- name: Read the Git signing public key
ansible.builtin.slurp:
src: "{{ git_signing_key }}"
become: false
register: git_signing_public_key_contents
when: git_signing_public_key.stat.exists
- name: Configure allowed SSH signers
ansible.builtin.copy:
dest: "{{ user_home }}/.ssh/allowed_signers"
owner: "{{ user_name }}"
mode: "0644"
content: "{{ git_email }} {{ git_signing_public_key_contents.content | b64decode | trim }}\n"
become: false
when: git_signing_public_key.stat.exists
- name: Install Typora from Flathub
when: install_typora
block:
- name: Ensure Flathub is configured
ansible.builtin.command:
argv:
- flatpak
- remote-add
- --if-not-exists
- flathub
- https://flathub.org/repo/flathub.flatpakrepo
changed_when: false
- name: Check for Typora
ansible.builtin.command: flatpak info io.typora.Typora
register: typora_flatpak
changed_when: false
failed_when: false
- name: Install Typora
ansible.builtin.command: flatpak install --noninteractive flathub io.typora.Typora
when: typora_flatpak.rc != 0
+112
View File
@@ -0,0 +1,112 @@
---
- name: Check for Zen Browser
ansible.builtin.stat:
path: "{{ zen_install_dir }}/zen"
become: false
register: zen_binary
- name: Create Zen installation directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ user_name }}"
mode: "0755"
become: false
loop:
- "{{ user_home }}/.tarball-installations"
- "{{ user_home }}/.config"
- "{{ user_home }}/.local/bin"
- "{{ user_home }}/.local/share/applications"
- "{{ user_home }}/.local/share/icons/hicolor/128x128/apps"
- name: Download the current Zen release binary
ansible.builtin.get_url:
url: "{{ zen_archive_url }}"
dest: "{{ zen_archive }}"
mode: "0644"
become: false
when: not zen_binary.stat.exists
- name: Extract Zen Browser
ansible.builtin.unarchive:
src: "{{ zen_archive }}"
dest: "{{ user_home }}/.tarball-installations"
remote_src: true
creates: "{{ zen_install_dir }}/zen"
become: false
- name: Link Zen into the user's PATH
ansible.builtin.file:
src: "{{ zen_install_dir }}/zen"
dest: "{{ user_home }}/.local/bin/zen"
state: link
force: true
become: false
- name: Install Zen application icon
ansible.builtin.copy:
src: "{{ zen_install_dir }}/browser/chrome/icons/default/default128.png"
dest: "{{ user_home }}/.local/share/icons/hicolor/128x128/apps/zen.png"
remote_src: true
owner: "{{ user_name }}"
mode: "0644"
become: false
- name: Install Zen desktop entry
ansible.builtin.copy:
dest: "{{ user_home }}/.local/share/applications/{{ zen_desktop_file }}"
owner: "{{ user_name }}"
mode: "0644"
content: |
[Desktop Entry]
Version=1.0
Type=Application
Name=Zen Browser
Comment=Browse the web
Exec=zen %u
Icon=zen
Terminal=false
StartupNotify=true
StartupWMClass=zen
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
Actions=new-window;new-private-window;profile-manager;
[Desktop Action new-window]
Name=New Window
Exec=zen --new-window %u
[Desktop Action new-private-window]
Name=New Private Window
Exec=zen --private-window %u
[Desktop Action profile-manager]
Name=Profile Manager
Exec=zen --ProfileManager
become: false
- name: Remove downloaded Zen archive
ansible.builtin.file:
path: "{{ zen_archive }}"
state: absent
become: false
- name: Query default MIME handlers
ansible.builtin.command: "xdg-mime query default {{ item }}"
become: false
loop:
- text/html
- application/xhtml+xml
- x-scheme-handler/http
- x-scheme-handler/https
register: current_browser_handlers
changed_when: false
failed_when: false
- name: Set Zen as the default browser
ansible.builtin.command: "xdg-mime default {{ zen_desktop_file }} {{ item.item }}"
become: false
loop: "{{ current_browser_handlers.results }}"
loop_control:
label: "{{ item.item }}"
when: item.stdout != zen_desktop_file