diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2022-09-04 17:02:35 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2022-09-04 17:02:35 -0400 |
| commit | 9cbca7991457b05bcfcc5017060437dd3af489a5 (patch) | |
| tree | cebeeaebd4ad613bea739db8fadc1d630f43724f /roles | |
| parent | Add bsd updates (diff) | |
| download | dotfiles-9cbca7991457b05bcfcc5017060437dd3af489a5.zip | |
Convert from src/ to roles structure
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/1password/tasks/main.yaml | 24 | ||||
| -rw-r--r-- | roles/fonts/tasks/main.yaml | 13 | ||||
| -rw-r--r-- | roles/pyenv/tasks/main.yaml | 46 | ||||
| -rw-r--r-- | roles/pyenv/vars/main.yaml | 2 | ||||
| -rw-r--r-- | roles/user/files/.gdbinit | 1 | ||||
| -rw-r--r-- | roles/user/files/.gitconfig | 20 | ||||
| -rw-r--r-- | roles/user/files/.tmux.conf | 1 | ||||
| -rw-r--r-- | roles/user/files/wallpaper.jpg | bin | 0 -> 26719295 bytes | |||
| -rw-r--r-- | roles/user/tasks/main.yaml | 43 | ||||
| -rw-r--r-- | roles/vim/files/init.vim | 78 | ||||
| -rw-r--r-- | roles/vim/tasks/main.yaml | 35 | ||||
| -rw-r--r-- | roles/vscode/tasks/main.yaml | 24 | ||||
| -rw-r--r-- | roles/zsh/files/.zshrc | 82 | ||||
| -rw-r--r-- | roles/zsh/tasks/main.yaml | 38 |
14 files changed, 407 insertions, 0 deletions
diff --git a/roles/1password/tasks/main.yaml b/roles/1password/tasks/main.yaml new file mode 100644 index 0000000..88fe964 --- /dev/null +++ b/roles/1password/tasks/main.yaml @@ -0,0 +1,24 @@ +--- +- name: Import 1Password key + become: yes + ansible.builtin.rpm_key: + state: present + key: https://downloads.1password.com/linux/keys/1password.asc + +- name: Add 1Password YUM Repo + become: yes + yum_repository: + name: 1password + description: 1Password Stable Channel + baseurl: https://downloads.1password.com/linux/rpm/stable/$basearch + enabled: yes + gpgcheck: yes + repo_gpgcheck: yes + gpgkey: https://downloads.1password.com/linux/keys/1password.asc + state: present + +- name: Install + become: yes + dnf: + name: 1password + state: present diff --git a/roles/fonts/tasks/main.yaml b/roles/fonts/tasks/main.yaml new file mode 100644 index 0000000..f042c5d --- /dev/null +++ b/roles/fonts/tasks/main.yaml @@ -0,0 +1,13 @@ +--- +- name: Add Hack font COPR repo + become: yes + community.general.copr: + host: copr.fedorainfracloud.org + state: enabled + name: zawertun/hack-fonts + +- name: Install + become: yes + dnf: + name: hack-fonts + state: present diff --git a/roles/pyenv/tasks/main.yaml b/roles/pyenv/tasks/main.yaml new file mode 100644 index 0000000..7a20c78 --- /dev/null +++ b/roles/pyenv/tasks/main.yaml @@ -0,0 +1,46 @@ +--- +- name: Install build requirements + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{dnf}}" + vars: + dnf: + make: + gcc: + zlib-devel: + bzip2: + bzip2-devel: + readline-devel: + sqlite: + sqlite-devel: + openssl-devel: + tk-devel: + libffi-devel: + xz-devel: + +- name: Download + ansible.builtin.git: + repo: https://github.com/pyenv/pyenv.git + dest: "{{ lookup('env', 'HOME') }}/.pyenv" + version: v2.3.4 + +- name: "Ensure shell startup file sets up correct environment" + lineinfile: + path: "{{ shell_startup_file_path }}" + line: "{{ item.value.line }}" + state: present + + with_dict: "{{lines}}" + vars: + # Assumption: This will only work for certain shells (like zsh, bash, etc.) + lines: + pyenv_root: + line: export PYENV_ROOT="$HOME/.pyenv" + export_pyenv_bin: + line: command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" + pyenv_init: + line: eval "$(pyenv init -)" diff --git a/roles/pyenv/vars/main.yaml b/roles/pyenv/vars/main.yaml new file mode 100644 index 0000000..1b89247 --- /dev/null +++ b/roles/pyenv/vars/main.yaml @@ -0,0 +1,2 @@ +--- +shell_startup_file_path: "{{ lookup('env', 'HOME') }}/.zshrc" diff --git a/roles/user/files/.gdbinit b/roles/user/files/.gdbinit new file mode 100644 index 0000000..9422460 --- /dev/null +++ b/roles/user/files/.gdbinit @@ -0,0 +1 @@ +set disassembly-flavor intel diff --git a/roles/user/files/.gitconfig b/roles/user/files/.gitconfig new file mode 100644 index 0000000..1086dfa --- /dev/null +++ b/roles/user/files/.gitconfig @@ -0,0 +1,20 @@ +[user] + name = Eugene Triguba + email = eugenetriguba@gmail.com + signingkey = E2C90ACA3CC16B98 +[core] + editor = vim + whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol + excludesfile = ~/.gitignore +[alias] + undo = reset HEAD~ +[pull] + ff = only +[fetch] + prune = true +[diff] + colorMoved = zebra +[init] + defaultBranch = main +[commit] + gpgsign = true diff --git a/roles/user/files/.tmux.conf b/roles/user/files/.tmux.conf new file mode 100644 index 0000000..207d7e8 --- /dev/null +++ b/roles/user/files/.tmux.conf @@ -0,0 +1 @@ +set -g mouse on diff --git a/roles/user/files/wallpaper.jpg b/roles/user/files/wallpaper.jpg Binary files differnew file mode 100644 index 0000000..94ae4cf --- /dev/null +++ b/roles/user/files/wallpaper.jpg diff --git a/roles/user/tasks/main.yaml b/roles/user/tasks/main.yaml new file mode 100644 index 0000000..802d8c6 --- /dev/null +++ b/roles/user/tasks/main.yaml @@ -0,0 +1,43 @@ +--- +- name: Link dotfiles + file: + src: "{{ item.value.src }}" + dest: "{{ item.value.dest }}" + state: link + with_dict: "{{dotfiles}}" + vars: + dotfiles: + gitconfig: + src: "{{ role_path }}/files/.gitconfig" + dest: "{{ lookup('env', 'HOME') }}/.gitconfig" + gdbinit: + src: "{{ role_path }}/files/.gdbinit" + dest: "{{ lookup('env', 'HOME') }}/.gdbinit" + tmux: + src: "{{ role_path }}/files/.tmux.conf" + dest: "{{ lookup('env', 'HOME') }}/.tmux.conf" + +- name: Link wallpaper + file: + src: "{{ role_path }}/files/wallpaper.jpg" + dest: "$HOME/Pictures/wallpaper.jpg" + state: link + +- name: Install general packages + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{dnf}}" + vars: + dnf: + "@Development tools": + curl: + firefox: + git: + openssl: + ripgrep: + rsync: + wget: diff --git a/roles/vim/files/init.vim b/roles/vim/files/init.vim new file mode 100644 index 0000000..0c98b73 --- /dev/null +++ b/roles/vim/files/init.vim @@ -0,0 +1,78 @@ +" Flash screen instead of beep sound +set visualbell + +" Change how vim represents characters on the screen +set encoding=utf-8 + +" Set the encoding of files written +set fileencoding=utf-8 + +" Set line numbers +set number + +" don't break up words at end of window width +set linebreak + +" Specify different areas of the screen where splits should occur +set splitbelow +set splitright + +" Python-specific whitespace file settings +autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 +" ts - show existing tab with 4 spaces width +" sw - when indenting with '>', use 4 spaces width +" sts - control <tab> and <bs> keys to match tabstop + +" General whitespace settings +set shiftwidth=4 +filetype plugin indent on + +" Allow backspace to delete indentation and inserted text +" i.e. how it works in most programs +set backspace=indent,eol,start +" indent allow backspacing over autoindent +" eol allow backspacing over line breaks (join lines) +" start allow backspacing over the start of insert; CTRL-W and CTRL-U +" stop once at the start of insert. +call plug#begin("$HOME/.config/nvim/plugged") + +" Auto complete +Plug 'Valloric/YouCompleteMe' + +" Fuzzy finder +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + +" Git gutter +Plug 'airblade/vim-gitgutter' + +" Status bar +Plug 'vim-airline/vim-airline' + +" Git wrapper with :G +Plug 'tpope/vim-fugitive' + +" Editorconfig file support +Plug 'editorconfig/editorconfig-vim' + +" Theme +Plug 'sainnhe/everforest' + +" Terraform +Plug 'hashivim/vim-terraform' + +call plug#end() + +if has('termguicolors') + set termguicolors +endif + +set background=dark + +let g:everforest_background = 'soft' +let g:everforest_better_performance = 1 +let g:everforest_disable_italic_comment = 1 +let g:airline_theme = 'everforest' + +syntax on +colorscheme everforest + diff --git a/roles/vim/tasks/main.yaml b/roles/vim/tasks/main.yaml new file mode 100644 index 0000000..0609f9b --- /dev/null +++ b/roles/vim/tasks/main.yaml @@ -0,0 +1,35 @@ +--- +- name: Create folders + file: + path: "{{ lookup('env', 'HOME') }}/.config/nvim/autoload" + state: directory + +- name: Link configuration + file: + src: "{{ role_path }}/files/init.vim" + dest: "{{ lookup('env', 'HOME') }}/.config/nvim/init.vim" + state: link + +- name: Install packages + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{packages}}" + vars: + packages: + python: + python-devel: + python-neovim: + vim: + neovim: + +- name: Install vim-plug + get_url: + url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + dest: "$HOME/.config/nvim/autoload/plug.vim" + +- name: Install vim-plug plugins + shell: nvim +PlugInstall +qall --headless diff --git a/roles/vscode/tasks/main.yaml b/roles/vscode/tasks/main.yaml new file mode 100644 index 0000000..476ccc9 --- /dev/null +++ b/roles/vscode/tasks/main.yaml @@ -0,0 +1,24 @@ +--- +- name: Import Microsoft Key + become: yes + ansible.builtin.rpm_key: + state: present + key: https://packages.microsoft.com/keys/microsoft.asc + +- name: Add YUM Repo + become: yes + yum_repository: + name: vscode + description: Visual Studio Code + baseurl: https://packages.microsoft.com/yumrepos/vscode + enabled: yes + gpgcheck: yes + repo_gpgcheck: yes + gpgkey: https://packages.microsoft.com/keys/microsoft.asc + state: present + +- name: Install + become: yes + dnf: + name: code + state: present diff --git a/roles/zsh/files/.zshrc b/roles/zsh/files/.zshrc new file mode 100644 index 0000000..fdc75f0 --- /dev/null +++ b/roles/zsh/files/.zshrc @@ -0,0 +1,82 @@ +autoload -Uz vcs_info +zstyle ":vcs_info:*" enable git svn +zstyle ':vcs_info:git:*' formats '%F{green}(%b)%f ' +precmd() { + vcs_info +} +setopt prompt_subst +NEWLINE=$'\n' +PROMPT=' %2~ ${vcs_info_msg_0_}%# ' + +export EDITOR="nvim" +export BROWSER="firefox" +export PAGER="less" + +export GPG_TTY=$(tty) + +export SRC_DIR="$HOME/src" +export BIN_DIR="$HOME/bin" + +export PATH="$HOME/.poetry/bin:$PATH" +export PATH=$PATH:$GOPATH/bin +export PATH=$PATH:$GOROOT/bin +export PATH="$PATH:$HOME/.local/bin" +export PATH="$BIN_DIR:$PATH" + +export GOPATH=$SRC_DIR/go +export GOBIN=$SRC_DIR/go/bin + +export PYENV_ROOT="$HOME/.pyenv" +command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init -)" + +alias gs="git status" +alias gc="git commit" +alias ga="git add" +alias gd="git diff" +alias gds="git diff --staged" +alias gp="git push" +alias gpo='git push origin' +alias gplrb='git pull --rebase' +alias gpl="git pull" +alias gl='git log' +alias gch="git checkout" +alias gcb='git checkout -b' +alias gv='git log --graph --decorate --oneline' + +alias h="history 25" +alias j="jobs -l" +alias l="ls -alG" +alias o="xdg-open ." +alias open="xdg-open" + +alias vi="nvim" +alias vim="nvim" + +# "Compile C Program" +# +# $1: Program Name +# $2: Output File (default: a.out) +# $3: C Standard (default: c11) +# +# Example: ccp main.c main c99 +ccp() { + local prog_name=$1 + local output_file=${2:a.out} + local std=${3:c11} + + cc -Wall -W -pedantic -ansi -std=$std -o $output_file $prog_name +} + +memcheck() { + G_DEBUG=always-malloc valgrind --tool=memcheck --leak-check=full --show-reachable=yes -s $1 +} + +gocover() { + t="/tmp/go-cover.$$.tmp" + go test -coverprofile=$t $@ && go tool cover -html=$t && unlink $t +} + +ip() { + ifconfig | jc --ifconfig | jq '.[] | select(.name=="wlo1") | {ipv4_addr, ipv6_addr}' +} diff --git a/roles/zsh/tasks/main.yaml b/roles/zsh/tasks/main.yaml new file mode 100644 index 0000000..fe0c039 --- /dev/null +++ b/roles/zsh/tasks/main.yaml @@ -0,0 +1,38 @@ +--- +- name: Install packages + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{dnf}}" + vars: + dnf: + fzf: + git: + jq: + jc: + zsh: + +- name: Ensure shell is default for user + vars: + current_user: "{{ ansible_user_id }}" + become: yes + user: + name: "{{ current_user }}" + shell: /usr/bin/zsh + +- name: Link configuration + file: + src: "{{ role_path }}/files/.zshrc" + dest: "{{ lookup('env', 'HOME') }}/.zshrc" + state: link + +- name: Create folders + file: + path: "{{item}}" + state: directory + loop: + - "{{ lookup('env', 'HOME') }}/src" + - "{{ lookup('env', 'HOME') }}/bin" |