move most important config to ansible
This commit is contained in:
@ -1,20 +1,19 @@
|
||||
default_roles:
|
||||
# === Core System Tools (Recommended) ===
|
||||
- system # Essential system configurations and tools
|
||||
- fonts # Developer-friendly fonts (Nerd Fonts)
|
||||
# - fonts # Developer-friendly fonts (Nerd Fonts)
|
||||
|
||||
# === Development Core ===
|
||||
- git # Version control system
|
||||
- neovim # Modern text editor (or use 'vim')
|
||||
- tmux # Terminal multiplexer for session management
|
||||
|
||||
# - git # Version control system
|
||||
- nvim # Modern text editor (or use 'vim')
|
||||
# - tmux # Terminal multiplexer for session management
|
||||
#
|
||||
# === Shell Environment ===
|
||||
- zsh # Modern shell with oh-my-zsh
|
||||
# - ssh
|
||||
|
||||
temp:
|
||||
# === Development Languages ===
|
||||
- nvm # Node Version Manager
|
||||
- npm # Node Package Manager
|
||||
- go # Go programming language
|
||||
# - rust # Rust programming language
|
||||
# - ruby # Ruby programming language
|
||||
# - lua # Lua programming language
|
||||
@ -22,81 +21,55 @@ default_roles:
|
||||
- docker # Container platform
|
||||
|
||||
# === System Monitoring ===
|
||||
- btop # Modern system monitor (better than htop)
|
||||
# - neofetch # System information display
|
||||
# - nerdfetch # Alternative system info with ASCII art
|
||||
# - ncdu # Disk usage analyzer
|
||||
|
||||
# === Terminal Emulators ===
|
||||
- ghostty
|
||||
# - kitty # GPU-accelerated terminal
|
||||
# - warp # Modern terminal with AI features
|
||||
|
||||
# === Productivity Tools ===
|
||||
# - obsidian # Knowledge management and note-taking
|
||||
# - raycast # macOS launcher and productivity tool
|
||||
# - hammerspoon # macOS automation and window management
|
||||
# - taskfile # Modern task runner (alternative to make)
|
||||
# - tldr # Simplified command documentation
|
||||
# - slides # Terminal-based presentation tool
|
||||
|
||||
system_packages:
|
||||
# Network
|
||||
- curl
|
||||
- wget
|
||||
- rsync
|
||||
- nmap
|
||||
# - nslookup
|
||||
# - dig
|
||||
|
||||
# === Communication & Media ===
|
||||
# - discord # Team communication
|
||||
# - spotify # Music streaming
|
||||
|
||||
# === Network & Remote Access ===
|
||||
# - ssh # SSH client configuration
|
||||
# - sshfs # Mount remote filesystems via SSH
|
||||
# - tmate # Terminal sharing for pair programming
|
||||
|
||||
# === macOS Specific ===
|
||||
# - aldente # Battery charge limiter for macOS
|
||||
|
||||
# === Linux Specific ===
|
||||
# - flatpak # Universal Linux package manager
|
||||
# - nala # Better apt frontend for Ubuntu/Debian
|
||||
|
||||
# === Browser Tools ===
|
||||
# - brave # Privacy-focused web browser
|
||||
|
||||
# === Cloud & Infrastructure CLIs ===
|
||||
# - aws # Amazon Web Services CLI
|
||||
# - azure # Microsoft Azure CLI
|
||||
# - nomad # HashiCorp Nomad (alternative to Kubernetes)
|
||||
|
||||
# === Container Alternatives ===
|
||||
# - orbstack # Docker Desktop alternative for macOS
|
||||
|
||||
# === Additional Terminal Emulators ===
|
||||
# - alacritty # Cross-platform GPU-accelerated terminal
|
||||
# - ghostty # Fast, feature-rich terminal emulator
|
||||
|
||||
# === Development Tools ===
|
||||
# - just # Command runner (modern alternative to make)
|
||||
# - goreleaser # Go application release automation
|
||||
|
||||
# === Kubernetes Ecosystem ===
|
||||
# - kind # Kubernetes in Docker for local testing
|
||||
# - kwctl # Kubernetes policy engine management
|
||||
|
||||
# === Network & VPN Tools ===
|
||||
# - wireguard # Modern VPN solution
|
||||
|
||||
# === Alternative Shells ===
|
||||
# - bash # Traditional bash shell configuration
|
||||
# - pwsh # PowerShell for cross-platform scripting
|
||||
# - zellij # Terminal workspace manager (alternative to tmux)
|
||||
|
||||
# === Package Managers ===
|
||||
# - whalebrew # Homebrew but with Docker images
|
||||
|
||||
# === Windows Specific ===
|
||||
# - winget # Windows package manager (Windows only)
|
||||
|
||||
# === Fun Stuff ===
|
||||
# - asciiquarium # Animated ASCII aquarium for your terminal
|
||||
|
||||
# === Security & Authentication ===
|
||||
# - 1password # 1Password CLI integration
|
||||
|
||||
# === Network Analysis ===
|
||||
# - tshark # Command-line network protocol analyzer
|
||||
# archive/compression
|
||||
- unzip
|
||||
- tar
|
||||
|
||||
# text processing
|
||||
- jq
|
||||
- ripgrep
|
||||
- fd
|
||||
|
||||
# utilities
|
||||
- btop
|
||||
- which
|
||||
# - fzf
|
||||
- bat
|
||||
- eza
|
||||
- tealdeer
|
||||
- neofetch
|
||||
|
||||
# dev
|
||||
- nvm
|
||||
- go
|
||||
- discord # Team communication
|
||||
|
||||
|
||||
# TODO
|
||||
aur_packages:
|
||||
- autojump
|
||||
- spotify
|
||||
- qownnotes
|
||||
- stripe-cli
|
||||
- pgformatter-git
|
||||
# - jetbrains-toolbox
|
||||
|
||||
config_dir: "{{ ansible_facts.env.HOME }}/.config"
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
[local]
|
||||
localhost ansible_connection=local
|
||||
localhost ansible_connection=local ansible_user=johannes
|
||||
|
||||
135
playbook.yml
135
playbook.yml
@ -5,123 +5,24 @@
|
||||
become: false
|
||||
vars:
|
||||
dotfiles_dir: "{{ ansible_env.HOME }}/dotfiles"
|
||||
|
||||
tasks:
|
||||
- name: Install packages with pacman
|
||||
# roles:
|
||||
# - zsh
|
||||
|
||||
pre_tasks:
|
||||
- name: Create btrfs snapshot before changes
|
||||
shell: |
|
||||
sudo btrfs subvolume snapsho / /.snapshots/before-dotfiles-$(date +%Y%m%d-%H%M%S)
|
||||
tags: [snapshot]
|
||||
become: true
|
||||
pacman:
|
||||
name:
|
||||
- neovim
|
||||
- zsh
|
||||
- git
|
||||
- openssh
|
||||
state: present
|
||||
become_method: sudo
|
||||
|
||||
- name: Install oh-my-zsh from AUR
|
||||
kewlfft.aur.aur:
|
||||
name: oh-my-zsh-git
|
||||
state: present
|
||||
|
||||
- name: Create necessary directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
tasks:
|
||||
- name: Install enabled roles
|
||||
ansible.builtin.include_role:
|
||||
name: "{{ item }}"
|
||||
apply:
|
||||
tags:
|
||||
- install
|
||||
loop:
|
||||
- "{{ ansible_env.HOME }}/.config"
|
||||
- "{{ ansible_env.HOME }}/.ssh"
|
||||
|
||||
- name: Check if neovim config exists
|
||||
stat:
|
||||
path: "{{ dotfiles_dir }}/nvim"
|
||||
register: nvim_config
|
||||
|
||||
- name: Symlink neovim config
|
||||
file:
|
||||
src: "{{ dotfiles_dir }}/nvim"
|
||||
dest: "{{ ansible_env.HOME }}/.config/nvim"
|
||||
state: link
|
||||
force: true
|
||||
when: nvim_config.stat.exists
|
||||
|
||||
- name: Check if zsh config exists
|
||||
stat:
|
||||
path: "{{ dotfiles_dir }}/zsh/.zshrc"
|
||||
register: zsh_config
|
||||
|
||||
- name: Symlink zsh config
|
||||
file:
|
||||
src: "{{ dotfiles_dir }}/zsh/.zshrc"
|
||||
dest: "{{ ansible_env.HOME }}/.zshrc"
|
||||
state: link
|
||||
force: true
|
||||
when: zsh_config.stat.exists
|
||||
|
||||
- name: Change default shell to zsh
|
||||
become: true
|
||||
user:
|
||||
name: "{{ ansible_env.USER }}"
|
||||
shell: /usr/bin/zsh
|
||||
|
||||
- name: Symlink SSH askpass config
|
||||
file:
|
||||
src: "{{ dotfiles_dir }}/ssh_askpass.conf"
|
||||
dest: "{{ ansible_env.HOME }}/.ssh/askpass.conf"
|
||||
state: link
|
||||
force: true
|
||||
when: zsh_config.stat.exists
|
||||
|
||||
- name: Check if git config exists
|
||||
stat:
|
||||
path: "{{ dotfiles_dir }}/git/.gitconfig"
|
||||
register: git_config
|
||||
|
||||
- name: Symlink global git config
|
||||
file:
|
||||
src: "{{ dotfiles_dir }}/git/.gitconfig"
|
||||
dest: "{{ ansible_env.HOME }}/.gitconfig"
|
||||
state: link
|
||||
force: true
|
||||
when: git_config.stat.exists
|
||||
|
||||
- name: Check if kde config exists
|
||||
stat:
|
||||
path: "{{ dotfiles_dir }}/kde"
|
||||
register: kde_config
|
||||
|
||||
- name: Find KDE config files in dotfiles
|
||||
find:
|
||||
paths: "{{ dotfiles_dir }}/kde"
|
||||
patterns: "*"
|
||||
file_type: file
|
||||
register: kde_configs
|
||||
when: kde_config.stat.exists
|
||||
|
||||
- name: Symlink KDE config files
|
||||
file:
|
||||
src: "{{ item.path }}"
|
||||
dest: "{{ ansible_env.HOME }}/.config/{{ item.path | basename }}"
|
||||
state: link
|
||||
force: true
|
||||
loop: "{{ kde_configs.files }}"
|
||||
when: kde_configs.files is defined
|
||||
|
||||
- name: Install yay if not present (for AUR packages)
|
||||
block:
|
||||
- name: Check if yay is installed
|
||||
command: which yay
|
||||
register: yay_check
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: Install yay from AUR
|
||||
become: true
|
||||
shell: |
|
||||
cd /tmp
|
||||
git clone https://aur.archlinux.org/yay.git
|
||||
cd yay
|
||||
makepkg -si --noconfirm
|
||||
cd ..
|
||||
rm -rf yay
|
||||
when: yay_check.rc != 0
|
||||
|
||||
"{{ default_roles }}"
|
||||
# when: default_roles is defined
|
||||
|
||||
@ -6,7 +6,7 @@ local opts = { noremap = true, silent = true }
|
||||
-- INSERT MODE
|
||||
|
||||
-- map `ctrl + backspace` to delete previous word in insert mode
|
||||
keymap.set('i', '<C-H>', '<C-W>', opts)
|
||||
keymap.set('i', '<C-BS>', '<C-W>', opts)
|
||||
|
||||
-- map `ctrl + delete` to delete next word in insert mode
|
||||
keymap.set('i', '<C-Del>', '<C-o>dw', opts)
|
||||
12
roles/nvim/tasks/main.yml
Normal file
12
roles/nvim/tasks/main.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Install neovim
|
||||
package:
|
||||
name: neovim
|
||||
state: present
|
||||
|
||||
- name: Symlink neovim
|
||||
file:
|
||||
src: "{{ role_path }}/files"
|
||||
dest: "{{ config_dir }}/nvim"
|
||||
state: link
|
||||
force: true
|
||||
20
roles/system/tasks/main.yml
Normal file
20
roles/system/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Update package cache (Arch-based systems)
|
||||
pacman:
|
||||
update_cache: yes
|
||||
when: ansible_os_family == "Archlinux"
|
||||
become: yes
|
||||
|
||||
- name: Install system packages
|
||||
package:
|
||||
name: "{{ system_packages }}"
|
||||
state: present
|
||||
become: yes
|
||||
|
||||
- name: Ensure .config directory exists
|
||||
file:
|
||||
path: "{{ config_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
52
roles/zsh/files/.zshrc
Normal file
52
roles/zsh/files/.zshrc
Normal file
@ -0,0 +1,52 @@
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||
|
||||
# Path to your Oh My Zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
ZSH_THEME="bira"
|
||||
zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
plugins=(
|
||||
git
|
||||
zsh-syntax-highlighting
|
||||
zsh-autosuggestions
|
||||
fzf-zsh-plugin
|
||||
)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
if [[ -n $SSH_CONNECTION ]]; then
|
||||
export EDITOR='vim'
|
||||
else
|
||||
export EDITOR='nvim'
|
||||
fi
|
||||
|
||||
# TODO prettier solution?
|
||||
DOTFILES_ZSH_DIR="${0:A:h}"
|
||||
|
||||
for zsh_file in "$DOTFILES_ZSH_DIR"/*.zsh; do
|
||||
[[ -r "$zsh_file" ]] && source "$zsh_file"
|
||||
done
|
||||
|
||||
|
||||
# TODO source all files with .zsh suffix
|
||||
# source ./aliases.zsh
|
||||
# source ./dev_env.zsh
|
||||
# source ./tools.zsh
|
||||
|
||||
# TODO
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
if [[ -n "$MACHINE_TYPE" && -f "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh" ]]; then
|
||||
source "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh"
|
||||
fi
|
||||
|
||||
|
||||
alias drun='docker run -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined'
|
||||
|
||||
24
roles/zsh/tasks/main.yaml
Normal file
24
roles/zsh/tasks/main.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
- name: Install zsh
|
||||
package:
|
||||
name: zsh
|
||||
state: present
|
||||
|
||||
- name: Install oh-my-zsh
|
||||
shell: |
|
||||
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended
|
||||
args:
|
||||
creates: "{{ ansible_env.HOME }}/.oh-my-zsh"
|
||||
|
||||
- name: Check for custom zshrc
|
||||
stat:
|
||||
path: "{{ role_path }}/files/.zshrc"
|
||||
register: custom_zshrc
|
||||
|
||||
- name: Symlink custom zshrc
|
||||
file:
|
||||
src: "{{ role_path }}/files/.zshrc"
|
||||
dest: "{{ ansible_env.HOME }}/.zshrc"
|
||||
state: link
|
||||
force: yes
|
||||
when: custom_zshrc.stat.exists
|
||||
130
zsh/.zshrc
130
zsh/.zshrc
@ -1,130 +0,0 @@
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||
|
||||
# Path to your Oh My Zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
# Set name of the theme to load --- if set to "random", it will
|
||||
# load a random theme each time Oh My Zsh is loaded, in which case,
|
||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||
ZSH_THEME="bira"
|
||||
|
||||
# Set list of themes to pick from when loading at random
|
||||
# Setting this variable when ZSH_THEME=random will cause zsh to load
|
||||
# a theme from this variable instead of looking in $ZSH/themes/
|
||||
# If set to an empty array, this variable will have no effect.
|
||||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion.
|
||||
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
||||
# HYPHEN_INSENSITIVE="true"
|
||||
|
||||
# Uncomment one of the following lines to change the auto-update behavior
|
||||
# zstyle ':omz:update' mode disabled # disable automatic updates
|
||||
# zstyle ':omz:update' mode auto # update automatically without asking
|
||||
zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# zstyle ':omz:update' frequency 13
|
||||
|
||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# You can also set it to another string to have that shown instead of the default red dots.
|
||||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
||||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# You can set one of the optional three formats:
|
||||
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
# or set a custom format using the strftime function format specifications,
|
||||
# see 'man strftime' for details.
|
||||
# HIST_STAMPS="mm/dd/yyyy"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load?
|
||||
# Standard plugins can be found in $ZSH/plugins/
|
||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(
|
||||
git
|
||||
zsh-syntax-highlighting
|
||||
zsh-autosuggestions
|
||||
fzf-zsh-plugin
|
||||
)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# User configuration
|
||||
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
if [[ -n $SSH_CONNECTION ]]; then
|
||||
export EDITOR='vim'
|
||||
else
|
||||
export EDITOR='nvim'
|
||||
fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch $(uname -m)"
|
||||
|
||||
# Set personal aliases, overriding those provided by Oh My Zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
|
||||
# users are encouraged to define aliases within a top-level file in
|
||||
# the $ZSH_CUSTOM folder, with .zsh extension. Examples:
|
||||
# - $ZSH_CUSTOM/aliases.zsh
|
||||
# - $ZSH_CUSTOM/macos.zsh
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
# bindkey '^R' history-incremental-search-backward
|
||||
|
||||
# TODO source all files with .zsh suffix
|
||||
source ~/dotfiles/zsh/aliases.zsh
|
||||
source ~/dotfiles/zsh/dev_env.zsh
|
||||
source ~/dotfiles/zsh/tools.zsh
|
||||
|
||||
|
||||
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
if [[ -n "$MACHINE_TYPE" && -f "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh" ]]; then
|
||||
source "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh"
|
||||
fi
|
||||
|
||||
|
||||
alias drun='docker run -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined'
|
||||
|
||||
Reference in New Issue
Block a user