first commit

This commit is contained in:
2024-10-05 10:06:52 +02:00
commit 0784cad8af
57 changed files with 965 additions and 0 deletions

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
/.git/
/.venv/

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/.venv/

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM debian:bookworm
WORKDIR /app
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /app
RUN pip3 install -r requirements.txt
COPY . /app

27
Makefile Normal file
View File

@@ -0,0 +1,27 @@
.PHONY: setup update-requirements .venv lint lint-fix setup-local clean
.venv: .venv/touchfile
.venv/touchfile: requirements.txt
test -d venv || virtualenv .venv
. .venv/bin/activate; pip install -Ur requirements.txt
touch .venv/touchfile
update-requirements:
. .venv/bin/activate; pip freeze > requirements.txt
install: .venv
lint: .venv
. .venv/bin/activate; \
ansible-lint playbooks/*.yml
lint-fix: .venv
. .venv/bin/activate; \
ansible-lint --fix playbooks/*.yml
setup-local: .venv
./scripts/setup-local.sh
clean:
rm -rf .venv

5
docker-compose.yml Normal file
View File

@@ -0,0 +1,5 @@
name: system
services:
playground:
image: ghcr.io/morten-olsen/system-playground
build: .

4
init.sh Normal file
View File

@@ -0,0 +1,4 @@
git clone https://github.com/morten-olsen/configs.git ~/.configs/system
cd ~/.configs/system
make install
./scripts/setup-local.sh

5
inventory.yml Normal file
View File

@@ -0,0 +1,5 @@
desktops:
hosts:
zn-macbook:
contexts:
- zeronorth

View File

@@ -0,0 +1,86 @@
font_family Fira Code Regular
disable_ligatures cursor
enable_audio_bell no
bell_on_tab no
# background_opacity 0.8
# vim:ft=kitty
## name: Catppuccin Kitty Mocha
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/themes/mocha.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #CDD6F4
background #1E1E2E
selection_foreground #1E1E2E
selection_background #F5E0DC
# Cursor colors
cursor #F5E0DC
cursor_text_color #1E1E2E
# URL underline color when hovering with mouse
url_color #F5E0DC
# Kitty window border colors
active_border_color #B4BEFE
inactive_border_color #6C7086
bell_border_color #F9E2AF
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #11111B
active_tab_background #CBA6F7
inactive_tab_foreground #CDD6F4
inactive_tab_background #181825
tab_bar_background #11111B
# Colors for marks (marked text in the terminal)
mark1_foreground #1E1E2E
mark1_background #B4BEFE
mark2_foreground #1E1E2E
mark2_background #CBA6F7
mark3_foreground #1E1E2E
mark3_background #74C7EC
# The 16 terminal colors
# black
color0 #45475A
color8 #585B70
# red
color1 #F38BA8
color9 #F38BA8
# green
color2 #A6E3A1
color10 #A6E3A1
# yellow
color3 #F9E2AF
color11 #F9E2AF
# blue
color4 #89B4FA
color12 #89B4FA
# magenta
color5 #F5C2E7
color13 #F5C2E7
# cyan
color6 #94E2D5
color14 #94E2D5
# white
color7 #BAC2DE
color15 #A6ADC8

View File

@@ -0,0 +1,4 @@
---
dependencies:
- role: info
- role: system

View File

@@ -0,0 +1,26 @@
---
- name: "Copy templates : {{ context }}"
tags:
- config
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path | regex_replace('\\.j2$', '') }}"
mode: "{{ item.mode }}"
with_community.general.filetree:
- ../templates/{{ context }}
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'
- name: "Copy config : {{ context }}"
tags:
- config
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"
mode: "{{ item.mode }}"
with_community.general.filetree:
- ../files/{{ context }}
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'

View File

@@ -0,0 +1,33 @@
---
- name: "Unload vars : {{ context }}"
ansible.builtin.include_vars: ../vars/empty.yml
tags:
- install
- name: "Load vars : {{ context }}"
ansible.builtin.include_vars: "{{ item }}"
tags:
- install
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- default.yml
paths: ../vars/{{ context }}
skip: true
- name: "Install dependencies : {{ context }}"
tags:
- install
when: desktop_pkgs
ansible.builtin.package:
name: "{{ desktop_pkgs }}"
- name: "Install casks : {{ context }}"
tags:
- install
when: desktop_casks
community.general.homebrew_cask:
name: "{{ desktop_casks }}"
state: installed

View File

@@ -0,0 +1,16 @@
---
- name: Install context dependencies
ansible.builtin.include_tasks: install.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
tags:
- config
- name: Configure contexts
ansible.builtin.include_tasks: config.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
tags:
- config

View File

@@ -0,0 +1,12 @@
---
_desktop_casks:
- 1password
- 1password-cli
- kitty
- font-fira-code
- font-fira-mono-nerd-font
- obsidian
- rectangle
- spotify
- vlc
- localsend

View File

@@ -0,0 +1,4 @@
---
desktop_pkgs: []
desktop_casks: []
desktop_flatpaks: []

View File

@@ -0,0 +1,6 @@
---
desktop_casks:
- jellyfin-media-player
- signal
- firefox
- tea

View File

@@ -0,0 +1,5 @@
---
desktop_casks:
- slack
- notion
- aws-vpn-client

View File

@@ -0,0 +1,4 @@
---
dependencies:
- role: info
- role: system

View File

@@ -0,0 +1,7 @@
---
- name: Install colima
tags:
- install
when: desktop_pkgs
ansible.builtin.package:
name: colima

View File

@@ -0,0 +1,6 @@
---
- name: Install on MacOS
when: mac_os
tags:
- install
ansible.builtin.include_tasks: macos.yml

View File

@@ -0,0 +1,92 @@
---
# https://medium.com/@GarisSpace/how-to-install-docker-using-ansible-01a674086f8c
- name: Setting host facts
ansible.builtin.set_fact:
arch_mapping: # Map ansible architecture {{ ansible_architecture }} names to Docker's architecture names
x86_64: amd64
aarch64: arm64
tags:
- always
- name: Install required packages
tags:
- install
ansible.builtin.apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- software-properties-common
- name: Create directory for Docker's GPG key
tags:
- install
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
mode: "0755"
- name: Add Docker's official GPG key
tags:
- install
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
keyring: /etc/apt/keyrings/docker.gpg
state: present
- name: Print architecture variables
tags:
- install
ansible.builtin.debug:
msg: "Architecture: {{ ansible_architecture }}, Codename: {{ ansible_lsb.codename }}"
- name: Add Docker repository
tags:
- install
ansible.builtin.apt_repository:
repo: >-
deb [arch={{ arch_mapping[ansible_architecture] | default(ansible_architecture) }}
signed-by=/etc/apt/keyrings/docker.gpg]
https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable
filename: docker
state: present
- name: Install Docker and related packages
tags:
- install
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
update_cache: true
- name: Add Docker group
tags:
- install
ansible.builtin.group:
name: docker
state: present
- name: Add user to Docker group
tags:
- install
ansible.builtin.user:
name: "{{ username }}"
groups: docker
append: true
- name: Enable and start Docker services
tags:
- install
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
loop:
- docker.service
- containerd.service

View File

@@ -0,0 +1,8 @@
- name: Setting host facts
tags: always
ansible.builtin.set_fact:
username: alice
home: /Users/alice
use_become: true
mac_os: "{{ ansible_distribution == 'MacOSX' }}"
contexts: "{{ ['default'] + (contexts | default([])) }}"

View File

@@ -0,0 +1,2 @@
dependencies:
- role: info

View File

@@ -0,0 +1,22 @@
- name: Install core dependencies
tags: always
ansible.builtin.package:
name:
- zsh
- name: Create group
when: not mac_os
tags: always
ansible.builtin.group:
name: "{{ username }}"
state: present
- name: Create user
when: not mac_os
tags: always
ansible.builtin.user:
name: "{{ username }}"
update_password: "on_create"
create_home: yes
shell: /usr/bin/zsh
group: "{{ username }}"

View File

@@ -0,0 +1,33 @@
#
unset GITHUB_TOKEN
# Extract type and description from commit message
type=$1; shift
description="$@"
commit_message="$type: $description"
# Check if a commit message was provided
if [ -z "$1" ] || [ -z "$description" ]; then
echo "Usage: rollout <type> <...description>"
exit 1
fi
# Create branch name following Conventional Commit syntax
branch_name="${type}/$(echo "$description" | tr ' ' '-' | tr '[:upper:]' '[:lower:]')"
echo "Creating and checking out branch: $branch_name"
git checkout -b "$branch_name" || exit 1
# Add all changes
git add . || exit 1
echo "Committing with message: \"$commit_message\""
git commit -m "$commit_message" || exit 1
echo "Pushing branch to origin..."
git push --set-upstream origin HEAD || exit 1
echo "Creating a Pull Request..."
gh pr create --fill
echo "Rollout complete."

View File

@@ -0,0 +1,6 @@
alias ls=eza
alias cat=bat
alias grep=rg
alias diff=delta
alias less=bat
alias gr='if [ "`git rev-parse --show-cdup`" != "" ]; then cd `git rev-parse --show-cdup`; fi'

View File

@@ -0,0 +1 @@
export TMPDIR="${TMPDIR:-/tmp}"

View File

@@ -0,0 +1,3 @@
export EDITOR=nvim
alias vim=nvim

View File

@@ -0,0 +1,2 @@
export PATH="$PATH:$HOME/.scripts"

View File

@@ -0,0 +1,4 @@
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

View File

@@ -0,0 +1,5 @@
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
gpg-connect-agent updatestartuptty /bye > /dev/null

View File

@@ -0,0 +1,3 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKDbZITpz5QrVIxPn9gKVWMPK+3W3YZZGszFOQvO/h7M
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCj8wspkAnOpEmipwB/xd8vpEx9aqNbyjD2xzv0msDJvYMn26ZO3cbtbWbMI9Uns55aHcL0bStdbaJQIcL8ZVzvQtKq+spdZYQpN4cFlN16HXKR/UjBYtJEdHVxb2cwb2DM04aLDuAlCAJGChEAqpIQFpvlByyAaxSPwor5Cy5JHmm5fMkvcJEvPtxQOo4yovY8qW9scWlOCrzNSAYtBwTGG8REcRuTaEW9EJlmn8QZA+T+cE7nFdZOlmm752jW9wBCAIKlg6W5gX0rysSxy+MkKB/2ohpLI+0SeWAM8+CEtZjO7GP6xRPXZgrZJssytzQsJoiMTs6rJM5ovHUMVNPGDLCB6+8lWM7Jk4hh0lIQTOC5AMucH2jRJSyQb2AA3kbPuWOwHDDIlSUnNFsI/xUVs1lfx3ikIZEb9oZcKwWBB2PeL/KT6ca7dsI3PyFL+hC5Wi7ll0Aj5w+dBZOxwW1agSo4ujPKO9oIVwqEA+PqoK/GZtIHAx6t/m3DK8T4HAo2GZMqyzRgcqk1bttaCFzX2h074yW1du8+l4yIqWrooqD474V3MT05HUxkA1+9S5ldEwK4J50WfKlhNuZn5YeiHLngisu8WyIGREYDGlkM+1qxwHiJGohigS20kpmTUkKvyLRXItAcvQYBknCV3qb8B1Kj1bvbN3sCaqQAeVWxDw==
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFaIAP/ZJ7+7jeR44e1yIJjfQAB6MN351LDKJAXVF62P

View File

@@ -0,0 +1,10 @@
Include /Users/alice/.colima/ssh_config
Include ~/.ssh/config.d/*
Host *
Controlmaster auto
Controlpath ${TMPDIR}/ssh-%r@%h:%p
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
ForwardAgent yes

View File

@@ -0,0 +1,4 @@
host github.com
hostname ssh.github.com
user git
port 443

View File

@@ -0,0 +1,107 @@
set -g mouse on
set -g default-terminal "screen-256color-bce"
#set -g status-justify centre
#set -ga terminal-overrides ',xterm-256color:Tc'
set -ag terminal-overrides ",xterm-256color:RGB"
set -g base-index 1
set -g renumber-windows on
bind q lock-client
unbind '"'
unbind %
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10
bind o attach -c "#{pane_current_path}"
# don't rename windows automatically
set-option -g allow-rename off
set -g @plugin 'tmux-plugins/tpm'
run -b '~/.tmux/plugins/tpm/tpm'
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# set -g @plugin "arcticicestudio/nord-tmux"
# set -g @plugin 'dracula/tmux'
# set -g @dracula-show-powerline true
# set -g @plugin 'wfxr/tmux-power'
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @treemux-tree-nvim-init-file '~/.tmux/plugins/treemux/configs/treemux_init.lua'
set -g @plugin 'kiyoon/treemux'
# open pane in vim
bind-key / capture-pane -S -102400 -J \; new-window 'vim -c ":read !tmux save-buffer - ; tmux delete-buffer;" -c ":normal gg" -c ":set buftype=nofile" -c ":silent! ChompWhitespace"'
set -g @catppuccin_date_time "%Y-%m-%d %H:%M"
set -g @catppuccin_window_tabs_enabled "on"
# clear history
# bind k send-keys -R \; clear-history
# copy mode
setw -g mode-keys vi
bind Escape copy-mode
unbind [
unbind p
bind p paste-buffer
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi y send -X copy-selection
bind -Tcopy-mode-vi Escape send -X cancel
# panes
bind - split-window -v -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"
bind C-z resize-pane -Z
bind g swap-pane -U
bind æ swap-pane -D
# panes
#set -g window-active-style 'bg=colour236'
#set -g window-style 'bg=black'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# Utils
bind -r g display-popup -d '#{pane_current_path}' -w80% -h80% -E lazygit

View File

@@ -0,0 +1,73 @@
export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-$HOME/.cache}
export LANG=en_US.UTF-8
# Load all files from .shell/rc.d directory
if [ -d $HOME/.shellrc/rc.d ]; then
for file in $HOME/.shellrc/rc.d/*.sh; do
source $file
done
fi
# Load all files from .shell/zshrc.d directory
if [ -d $HOME/.shellrc/zshrc.d ]; then
for file in $HOME/.shellrc/zshrc.d/*.zsh; do
source $file
done
fi
export GPG_TTY=$(tty)
if [[ -n "$SSH_CONNECTION" ]] ;then
export PINENTRY_USER_DATA="USE_CURSES=1"
fi
[ -f ~/.env ] && source ~/.env
if [ `tput cols` -gt "70" ]; then
function PRINT_CENTER {
COLS=`tput cols`
OFFSET=$(( ($COLS - $1) / 2 ))
PRE=""
for i in `seq $OFFSET`; do
PRE="$PRE "
done
while IFS= read -r line; do
echo "$PRE$line"
done <<< "$2"
}
PRINT_CENTER 60 "
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█░▄▄▀█▀▄▄▀█░▄▄░█▄░▄█▀▄▀██░▄░██░██░█░▄▄█░▄▄░█
█░▀▀▄█░██░█░▀▄░██░██░█▀█░▀▀░▀█░██░█▄▄▀███▄██
█▄█▄▄██▄▄██░▀▀░██▄███▄█████░███▄▄▄█▄▄▄█░▀▀░█
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆
⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦
⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄
⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄
⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀
⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄
⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄
⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄
⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄
⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆
⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃
▄▄▄ . ▌ ▐·▪ ▄▄▌ ▄▄▌ ▐ ▄▌▪ ▄▄▄▄▄ ▄ .▄ ▄• ▄▌▄▄▄▄▄
▀▄.▀·▪█·█▌██ ██• ██· █▌▐███ •██ ██▪▐█ ▄█▀▄ █▪██▌•██
▐▀▀▪▄▐█▐█•▐█·██ ▪ ██▪▐█▐▐▌▐█· ▐█.▪██▀▀█▐█▌.▐▌█▌▐█▌ ▐█.▪
▐█▄▄▌ ███ ▐█▌▐█▌ ▄ ▐█▌██▐█▌▐█▌ ▐█▌·██▌▐▀▐█▌.▐▌▐█▄█▌ ▐█▌·
▀▀▀ . ▀ ▀▀▀.▀▀▀ ▀▀▀▀ ▀▪▀▀▀ ▀▀▀ ▀▀▀ · ▀█▄▀▪ ▀▀▀ ▀▀▀
> welcome x_x
"
fi
export FZF_DEFAULT_OPTS=" \
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8"
which atuin &> /dev/null && eval "$(atuin init zsh)"
which direnv &> /dev/null && eval "$(direnv hook zsh)"
which starship &> /dev/null && eval "$(starship init zsh)"
which zoxide &> /dev/null && eval "$(zoxide init zsh)"

View File

@@ -0,0 +1,6 @@
host github-private
hostname ssh.github.com
user git
port 443
IdentityFile ~/.ssh/keys/github-private.pub
IdentitiesOnly yes

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFaIAP/ZJ7+7jeR44e1yIJjfQAB6MN351LDKJAXVF62P

View File

@@ -0,0 +1,4 @@
export NPM_GITHUB_TOKEN="op://jpksggxxmcuwnbwkooktr3iqcy/ut3yag6r7y4bsfrztahp7pcc6q/password"
export NODE_AUTH_TOKEN=$NPM_GITHUB_TOKEN
export GITHUB_TOKEN=$NPM_GITHUB_TOKEN

View File

@@ -0,0 +1,10 @@
[user]
email = morten@olsen.pro
name = Morten Olsen
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFaIAP/ZJ7+7jeR44e1yIJjfQAB6MN351LDKJAXVF62P
[url "git@github-private:morten-olsen/"]
insteadOf = https://github.com/morten-olsen/
[url "ssh://git@giteaa.olsen.cloud:2202/"]
insteadOf = ssh://git@gitea.olsen.cloud:2202/

View File

@@ -0,0 +1,3 @@
@morten-olsen:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

View File

@@ -0,0 +1,6 @@
host github-zeronorth
hostname ssh.github.com
user git
port 443
IdentityFile ~/.ssh/keys/github-zeronorth.pub
IdentitiesOnly yes

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKDbZITpz5QrVIxPn9gKVWMPK+3W3YZZGszFOQvO/h7M

View File

@@ -0,0 +1,4 @@
export NPM_GITHUB_TOKEN="op://jpksggxxmcuwnbwkooktr3iqcy/ut3yag6r7y4bsfrztahp7pcc6q/password"
export NODE_AUTH_TOKEN=$NPM_GITHUB_TOKEN
export GITHUB_TOKEN="op://Employee/lobazchngpvla4opw4rwzjwnoi/credential"
export AWS_PROFILE="zeronorth"

View File

@@ -0,0 +1,7 @@
[user]
email = morten.olsen@zeronorth.com
name = Morten Olsen
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKDbZITpz5QrVIxPn9gKVWMPK+3W3YZZGszFOQvO/h7M
[url "git@github-zeronorth:"]
insteadOf = https://github.com/

View File

@@ -0,0 +1,2 @@
@0north:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

View File

@@ -0,0 +1,4 @@
---
dependencies:
- role: info
- role: system

View File

@@ -0,0 +1,26 @@
---
- name: "Copy templates : {{ context }}"
tags:
- config
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path | regex_replace('\\.j2$', '') }}"
mode: "{{ item.mode }}"
with_community.general.filetree:
- ../templates/{{ context }}
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'
- name: Copy config {{ context }}
tags:
- config
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"
mode: "{{ item.mode }}"
with_community.general.filetree:
- ../files/{{ context }}
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'

View File

@@ -0,0 +1,33 @@
---
- name: "Unload vars : {{ context }}"
ansible.builtin.include_vars: ../vars/empty.yml
tags:
- install
- name: "Load vars : {{ context }}"
ansible.builtin.include_vars: "{{ item }}"
tags:
- install
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- default.yml
paths: ../vars/{{ context }}
skip: true
- name: "Install dependencies : {{ context }}"
tags:
- install
when: terminal_pkgs
ansible.builtin.package:
name: "{{ terminal_pkgs }}"
- name: "Install casks : {{ context }}"
tags:
- install
when: terminal_casks
community.general.homebrew_cask:
name: "{{ terminal_casks }}"
state: installed

View File

@@ -0,0 +1,35 @@
---
- name: Install context dependencies
ansible.builtin.include_tasks: install.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
tags:
- config
- name: Configure contexts
ansible.builtin.include_tasks: config.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
tags:
- config
- name: Install node and set version
tags:
- config
register: nodeinstall
ansible.builtin.shell: source {{ home }}/.nvm/nvm.sh && nvm install 22
changed_when: "'is already installed' not in nodeinstall.stderr"
args:
executable: /bin/bash
- name: Configure neovim
tags:
- config
ansible.builtin.git:
repo: https://github.com/morten-olsen/nvim
dest: "{{ home }}/.config/nvim"
accept_newhostkey: true
clone: true
update: true

View File

@@ -0,0 +1,53 @@
[gpg]
format = ssh
[gpg "ssh"]
program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
[alias]
graph = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n"
ll = log --oneline
st = status -sb
cm = commit -m
append = commit --amend --no-edit
sobmodules = submodule update --init --recursive
df = difftool -t nvimdiff -y
last = log -1 --stat
br = branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate
brr = branch --remote --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate
undo = reset HEAD~1 --mixed
unstage = reset HEAD --
[difftool "nvimdiff"]
cmd = "nvim -d \"$LOCAL\" \"$REMOTE\""
[commit]
gpgsign = true
[url "https://"]
insteadOf = git://
[core]
pager = delta
hooksPath = /dev/null
[interactive]
diffFilter = delta --color-only
[pull]
ff = only
[init]
defaultBranch = main
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[includeIf "gitdir:~/Projects/zeronorth/"]
path = ~/Projects/zeronorth/.gitconfig
[includeIf "gitdir:~/Projects/private/"]
path = ~/Projects/private/.gitconfig
[push]
autoSetupRemote = true

View File

@@ -0,0 +1,17 @@
---
terminal_pkgs:
- atuin
- bat
- eza
- direnv
- fzf
- gnupg
- jq
- ripgrep
- neovim
- gh
- starship
- tmux
- zoxide
- git
- git-delta

View File

@@ -0,0 +1,4 @@
---
terminal_pkgs: []
terminal_casks: []
terminal_flatpaks: []

View File

@@ -0,0 +1,5 @@
---
terminal_pkgs:
- terraform
- awscli
- copier

7
playbooks/setup.yml Normal file
View File

@@ -0,0 +1,7 @@
---
- name: Setup host
hosts: all
roles:
- role: terminal
- role: desktop
- role: docker

71
requirements.txt Normal file
View File

@@ -0,0 +1,71 @@
ansible==10.4.0
ansible-builder==3.1.0
ansible-compat==24.9.1
ansible-core==2.17.4
ansible-creator==24.9.0
ansible-dev-environment==24.9.0
ansible-dev-tools==24.9.0
ansible-lint==24.9.2
ansible-navigator==24.9.0
ansible-runner==2.4.0
ansible-sign==0.1.1
attrs==24.2.0
bindep==2.11.0
black==24.8.0
bracex==2.5.post1
cachetools==5.5.0
cffi==1.17.1
chardet==5.2.0
click==8.1.7
click-help-colors==0.9.4
colorama==0.4.6
cryptography==43.0.1
distlib==0.3.8
distro==1.9.0
docutils==0.21.2
enrich==1.2.7
execnet==2.1.1
filelock==3.16.1
importlib_metadata==8.5.0
iniconfig==2.0.0
Jinja2==3.1.4
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
lockfile==0.12.2
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
molecule==24.9.0
mypy-extensions==1.0.0
onigurumacffi==1.3.0
packaging==24.1
Parsley==1.3
pathspec==0.12.1
pbr==6.1.0
pexpect==4.9.0
platformdirs==4.3.6
pluggy==1.5.0
ptyprocess==0.7.0
pycparser==2.22
Pygments==2.18.0
pyproject-api==1.8.0
pytest==8.3.3
pytest-ansible==24.9.0
pytest-xdist==3.6.1
python-daemon==3.0.1
python-gnupg==0.5.3
PyYAML==6.0.2
referencing==0.35.1
resolvelib==1.0.1
rich==13.9.2
rpds-py==0.20.0
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
subprocess-tee==0.4.2
tox==4.21.2
tox-ansible==24.9.0
tzdata==2024.2
virtualenv==20.26.6
wcmatch==10.0
yamllint==1.35.1
zipp==3.20.2

20
scripts/setup-local.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
export ROOT="`dirname "$0"`/.."
MACHINE_NAME="$1"; shift
. $ROOT/scripts/with-env.sh
if [ -z "$MACHINE_NAME" ]; then
echo "Usage: $0 <machine-name>"
exit 1
fi
echo "Setting up $MACHINE_NAME"
ansible-playbook -i inventory.yml playbooks/setup.yml \
--connection=local \
--extra-vars "ansible_python_interpreter=$(which python)" \
--inventory "$MACHINE_NAME," \
--limit "$MACHINE_NAME" \
$@ \
--ask-become-pass

9
scripts/with-env.sh Normal file
View File

@@ -0,0 +1,9 @@
if [ ! -d "$ROOT/.venv" ]; then
echo "Creating virtual environment..."
python3 -m venv $ROOT/.venv
source $ROOT/.venv/bin/activate
pip install -r $ROOT/requirements.txt
touch .venv/touchfile
else
source $ROOT/.venv/bin/activate
fi