Files
2026-09-15 22:00:25 +05:30

371 lines
9.2 KiB
YAML

---
- hosts:
- 127.0.0.1
connection: local
name: setup fedora workstation
tasks:
- name: remove fedora fluff
become: true
ansible.builtin.dnf:
allowerasing: true
autoremove: true
name:
- anaconda-core
- anaconda-live
- anaconda-install-env-deps
- cockpit-system
- python3-botocore
- firefox
- nodejs
state: absent
- name: install core components
become: true
ansible.builtin.dnf:
state: present
install_weak_deps: false
name:
- git
- git-crypt
- git-lfs
- gnupg2
- tmux
- curl
- acl
- stow
- make
- just
- zsh
- neovim
- nnn
- openssh-clients
- openssh-server
- mosh
- unzip
- flatpak
- name: install pup
become: true
unarchive:
remote_src: yes
creates: /usr/local/bin/pup
dest: /usr/local/bin/
src: https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip
- name: install google-chrome dnf repository
become: true
copy:
dest: /etc/yum.repos.d/google-chrome.repo
content: |
[google-chrome]
name=google-chrome
baseurl=https://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
- name: install wayscriber dnf repository
become: true
copy:
dest: /etc/yum.repos.d/waysriber.repo
content: |
[wayscriber]
name=Wayscriber
baseurl=https://wayscriber.com/rpm
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://wayscriber.com/rpm/RPM-GPG-KEY-wayscriber.asc
- name: install tailscale dnf repository
become: true
copy:
dest: /etc/yum.repos.d/tailscale.repo
content: |
[tailscale]
name=Tailscale
baseurl=https://pkgs.tailscale.com/stable/fedora/$basearch
enabled=1
type=rpm
repo_gpgcheck=1
gpgcheck=1
gpgkey=https://pkgs.tailscale.com/stable/fedora/repo.gpg
- name: install dnf packages
become: true
ansible.builtin.dnf:
state: present
install_weak_deps: false
name:
- aria2
- bat
- bc
- btop
- btrfs-progs
- coreutils
- moreutils
- fcitx5-gtk4
- file
- gh
- google-chrome-stable
- gparted
- jo
- jq
- jrnl
- kitty
- kitty-terminfo
- lshw
- mpv
- ncdu
- pandoc
- podman
- runc
- pass
- wtype
- tailscale
- rclone
- rsync
- seahorse
- timew
- toolbox
- tree
- fzf
- socat
- tree-sitter-cli
- waybar
- wkhtmltopdf
- yq
- ImageMagick
- wayscriber
- qt6ct
- trash-cli
- name: install flatpak applications
become: true
flatpak:
state: present
name:
- https://valent.andyholmes.ca/valent.flatpakref
- com.nextcloud.desktopclient.nextcloud
- org.libreoffice.LibreOffice
- org.mozilla.thunderbird_esr
- com.logseq.Logseq
- com.github.xournalpp.xournalpp
- com.obsproject.Studio
- com.obsproject.Studio.Plugin.DroidCam
- com.yubico.yubioath
- com.github.tchx84.Flatseal
- org.gnome.Loupe
- com.github.johnfactotum.Foliate
- org.gnome.Papers
- org.gnome.FileRoller
- org.gnome.SimpleScan
- com.github.neithern.g4music
- info.febvre.Komikku
- org.gimp.GIMP
- net.scribus.Scribus
- org.inkscape.Inkscape
- org.darktable.Darktable
- org.audacityteam.Audacity
- name: create group myself
become: true
group:
name: myself
gid: 690
system: true
- name: create users
loop:
- name: kevins
uid: 6901
groups: ["wheel", "myself"]
- name: kevinsamuel
uid: 6902
groups: ["myself"]
- name: kevinnlsamuel
uid: 6903
groups: ["myself"]
ansible.builtin.include_role:
role: createworkstationuser
- name: use crun as podman engine
become: true
vars:
file: /etc/containers/containers.conf
block:
- lineinfile:
owner: root
group: root
mode: '0644'
create: true
path: "{{file}}"
line: "[engine]"
insertbefore: BOF
- lineinfile:
path: "{{file}}"
line: 'runtime = "/usr/bin/runc"'
search_string: 'runtime = '
- name: setup podman btrfs storage
become: true
vars:
file: /etc/containers/storage.conf
block:
- name: create container storage config
lineinfile:
owner: root
group: root
mode: '0644'
create: true
path: "{{file}}"
line: "[storage]"
insertbefore: BOF
- name: set podman storage config to btrfs
lineinfile:
path: "{{file}}"
line: 'driver_priority = ["btrfs", "overlay", "vfs"]'
search_string: 'driver_priority = '
- name: enable tpm-tss in dracut
become: true
lineinfile:
path: /etc/dracut.conf.d/55-tpm.conf
line: "add_dracutmodules+=' tpm2-tss '"
owner: root
group: root
mode: "1644"
create: true
state: present
- name: tell PAM to unlock gnome-keyring in tty
become: true
with_items:
- type: auth
args: ""
- type: session
args: auto_start
pamd:
name: login
state: before
type: "{{item.type}}"
control: include
module_path: postlogin
new_type: "-{{item.type}}"
new_control: optional
new_module_path: pam_gnome_keyring.so
module_arguments: "{{item.args}}"
- name: create wifi networks
become: true
loop:
- ssid: KEVINSAM_5
zone: home
- ssid: KEVINSAM
zone: home
- ssid: askKevin
zone: work
community.general.nmcli:
state: present
type: wifi
zone: "{{ item.zone }}"
conn_name: "{{ item.ssid }}"
ssid: "{{ item.ssid }}"
autoconnect: true
wifi:
hidden: true
wifi_sec:
key-mgmt: wpa-psk
psk: "not really the key"
- name: create tailscale firewall zone
become: true
shell: |
firewall-cmd --permanent --new-zone=tailscale
firewall-cmd --permanent --zone=tailscale --add-interface=tailscale0
firewall-cmd --permanent --zone=tailscale --add-forward
firewall-cmd --permanent --zone=tailscale --set-target=ACCEPT
firewall-cmd --reload
- name: other firewall rules
become: true
shell: |
firewall-cmd --permanent --zone public --remove-service ssh
firewall-cmd --permanent --zone public --add-service kdeconnect
firewall-cmd --permanent --zone home --add-service=kdeconnect --add-service=mosh --add-service=ssh
firewall-cmd --reload
- name: enabled tailscaled service
become: true
ansible.builtin.service:
name: tailscaled
enabled: true
state: started
- name: create /home/myself
become: true
file:
state: directory
path: /home/myself
group: myself
owner: kevins
mode: '2770'
- name: check if HOME.git is cloned
become: true
become_user: kevins
register: home_repo
stat:
path: /home/myself/HOME.git/HEAD
- name: "clone HOME.git"
become: true
become_user: kevins
when: not home_repo.stat.exists
shell: |
mkdir -p /home/myself/HOME.git
cd /home/myself/HOME.git
git init --bare .
git remote add \
origin \
-t stable \
-m stable \
git@github.com:kevinnlsamuel/HOME.git
git fetch --set-upstream origin stable
- name: clone HOME to my selves
vars:
src: /home/myself/HOME.git
dest: "/home/{{item}}/.local/state/HOME"
with_items:
- kevins
- kevinsamuel
- kevinnlsamuel
become_user: "{{item}}"
become: true
failed_when:
- result.rc != 140
- result.rc != 0
changed_when: "result.rc != 140"
register: result
shell: |
mkdir -p "{{dest}}"
cd "{{dest}}"
if [ -f ".git/HEAD" ]; then exit 140 2>/dev/null; fi
git init -b main
git config --add safe.directory "{{src}}"
git remote add myself "{{src}}"
git pull myself main
# manually install:
# - sieve