├── roles ├── git │ ├── defaults │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── packer │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── main.yml │ │ └── linux.yml ├── terraform │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── main.yml │ │ └── linux.yml ├── vagrant │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── main.yml │ │ ├── ubuntu.yml │ │ └── arch.yml ├── docker │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── main.yml │ │ ├── ubuntu.yml │ │ └── linux.yml ├── hid_apple │ ├── files │ │ └── hid_apple.conf │ └── tasks │ │ ├── main.yml │ │ └── ubuntu.yml ├── zsh │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── font_osx.yml │ │ ├── pywal.yml │ │ ├── font_linux.yml │ │ └── main.yml ├── trivy │ └── tasks │ │ ├── main.yml │ │ └── ubuntu.yml ├── k8s │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── main.yml │ │ ├── kube-cleaner.yml │ │ ├── osx.yml │ │ ├── helm_ubuntu.yml │ │ ├── gcloud_ubuntu.yml │ │ ├── kubectx.yml │ │ ├── helm_arch.yml │ │ ├── gcloud_arch.yml │ │ ├── draft.yml │ │ ├── k9s.yml │ │ ├── velero.yml │ │ └── linux.yml ├── cli-tools │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── cfssl.yml │ │ ├── aliases.yml │ │ ├── ctop.yml │ │ ├── gotop.yml │ │ ├── gopass.yml │ │ ├── bat.yml │ │ ├── vegeta.yml │ │ └── main.yml ├── recording │ └── tasks │ │ ├── osx.yml │ │ ├── ubuntu.yml │ │ ├── main.yml │ │ └── arch.yml ├── backup │ └── tasks │ │ └── main.yml ├── idea │ └── tasks │ │ ├── main.yml │ │ └── linux.yml ├── java │ └── tasks │ │ ├── osx.yml │ │ └── main.yml ├── virtualbox │ └── tasks │ │ ├── main.yml │ │ └── ubuntu.yml ├── vscode │ └── tasks │ │ ├── ubuntu.yml │ │ └── main.yml ├── snap │ └── tasks │ │ └── main.yml ├── mercurial │ └── tasks │ │ └── main.yml ├── node │ └── tasks │ │ └── main.yml ├── gpg │ └── tasks │ │ └── main.yml ├── vim │ └── tasks │ │ └── main.yml ├── golang │ └── tasks │ │ └── main.yml └── tmux │ └── tasks │ └── main.yml ├── config ├── bat-config ├── gorc ├── 90-idea.conf ├── README.md ├── gpg-agent.conf.j2 ├── vimrc ├── oh-my-zsh-plugins │ ├── scm.plugin.zsh │ ├── editorconfig.plugin.zsh │ ├── vegeta.plugin.zsh │ └── java-env.plugin.zsh ├── gitconfig.j2 ├── gpgrc ├── gpg.conf.j2 ├── hgrc.j2 ├── tmux.conf.local ├── zshrc └── tmux.conf ├── .editorconfig ├── devbox ├── .gitignore ├── README.md └── playbook.yml /roles/git/defaults/main.yml: -------------------------------------------------------------------------------- 1 | gh_version: 1.7.0 2 | -------------------------------------------------------------------------------- /config/bat-config: -------------------------------------------------------------------------------- 1 | # Set Nord theme 2 | --theme="Nord" 3 | -------------------------------------------------------------------------------- /roles/packer/defaults/main.yml: -------------------------------------------------------------------------------- 1 | packer_version: 1.7.0 2 | -------------------------------------------------------------------------------- /roles/terraform/defaults/main.yml: -------------------------------------------------------------------------------- 1 | terraform_version: 0.14.9 2 | -------------------------------------------------------------------------------- /roles/vagrant/defaults/main.yml: -------------------------------------------------------------------------------- 1 | vagrant_version: 2.2.14 2 | -------------------------------------------------------------------------------- /config/gorc: -------------------------------------------------------------------------------- 1 | export GOPATH=~/Projects/go 2 | export PATH=$PATH:${GOPATH}/bin 3 | -------------------------------------------------------------------------------- /roles/docker/defaults/main.yml: -------------------------------------------------------------------------------- 1 | compose_version: 1.28.6 2 | machine_version: 0.16.2 3 | -------------------------------------------------------------------------------- /roles/hid_apple/files/hid_apple.conf: -------------------------------------------------------------------------------- 1 | options hid_apple iso_layout=0 2 | options hid_apple fnmode=2 3 | -------------------------------------------------------------------------------- /roles/zsh/defaults/main.yml: -------------------------------------------------------------------------------- 1 | custom_omz_plugins: 2 | - editorconfig 3 | - java-env 4 | - vegeta 5 | - scm 6 | -------------------------------------------------------------------------------- /roles/trivy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install trivy (Ubuntu) 2 | include: ubuntu.yml 3 | when: ansible_distribution == "Ubuntu" 4 | -------------------------------------------------------------------------------- /roles/hid_apple/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Configure apple keyboard (Ubuntu) 2 | include: ubuntu.yml 3 | when: ansible_distribution == "Ubuntu" 4 | -------------------------------------------------------------------------------- /roles/k8s/defaults/main.yml: -------------------------------------------------------------------------------- 1 | helm_version: 3.5.2 2 | draft_version: 0.16.0 3 | kustomize_version: 4.0.5 4 | k9s_version: 0.24.5 5 | velero_version: 1.5.3 6 | -------------------------------------------------------------------------------- /roles/cli-tools/defaults/main.yml: -------------------------------------------------------------------------------- 1 | bat_version: 0.18.0 2 | gotop_version: 4.1.1 3 | ctop_version: 0.7.5 4 | vegeta_version: 12.8.4 5 | docker_aliases_version: 0.4.0 6 | -------------------------------------------------------------------------------- /roles/recording/tasks/osx.yml: -------------------------------------------------------------------------------- 1 | - name: Install kap 2 | homebrew_cask: 3 | name: kap 4 | 5 | - name: Install gifsicle 6 | homebrew: 7 | name: gifsicle 8 | -------------------------------------------------------------------------------- /roles/backup/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install restic 2 | become: yes 3 | apt: 4 | name: 5 | - restic 6 | - nfs-common 7 | when: ansible_distribution == "Ubuntu" 8 | -------------------------------------------------------------------------------- /config/90-idea.conf: -------------------------------------------------------------------------------- 1 | # increase inotify watch limit for intellij 2 | # https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit 3 | fs.inotify.max_user_watches = 524288 4 | -------------------------------------------------------------------------------- /roles/packer/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install packer (Linux) 2 | include: linux.yml 3 | when: ansible_system == "Linux" 4 | 5 | - name: Install packer (MacOSX) 6 | homebrew: 7 | name: packer 8 | when: ansible_distribution == "MacOSX" 9 | -------------------------------------------------------------------------------- /roles/docker/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install docker (Linux) 2 | include: linux.yml 3 | when: ansible_system == "Linux" 4 | 5 | - name: Install docker (MacOSX) 6 | homebrew_cask: 7 | name: docker-edge 8 | when: ansible_distribution == "MacOSX" 9 | -------------------------------------------------------------------------------- /roles/terraform/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install terraform (Linux) 2 | include: linux.yml 3 | when: ansible_system == "Linux" 4 | 5 | - name: Install terraform (MacOSX) 6 | homebrew: 7 | name: terraform 8 | when: ansible_distribution == "MacOSX" 9 | -------------------------------------------------------------------------------- /config/README.md: -------------------------------------------------------------------------------- 1 | # Configurations 2 | 3 | The most of the files in this directory are linked to your home directory. 4 | Changes to them should be visible immediately. 5 | Only changes to files which with the `.j2` are only applied after another run of `devbox`. 6 | -------------------------------------------------------------------------------- /config/gpg-agent.conf.j2: -------------------------------------------------------------------------------- 1 | enable-ssh-support 2 | {% if ansible_distribution == "MacOSX" %} 3 | pinentry-program /usr/local/bin/pinentry-mac 4 | {% else %} 5 | pinentry-program /usr/bin/pinentry-gnome3 6 | {% endif %} 7 | default-cache-ttl 60 8 | max-cache-ttl 120 9 | write-env-file 10 | -------------------------------------------------------------------------------- /roles/k8s/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install k8s tools (Linux) 2 | include: linux.yml 3 | when: ansible_system == "Linux" 4 | 5 | - name: Install k8s tools (MacOSX) 6 | include: osx.yml 7 | when: ansible_distribution == "MacOSX" 8 | 9 | - name: Install kube-cleaner 10 | include: kube-cleaner.yml 11 | -------------------------------------------------------------------------------- /roles/idea/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install Intellij Idea Ultimate on Linux 2 | include: linux.yml 3 | become: yes 4 | when: ansible_system == "Linux" 5 | 6 | - name: Install Intellij Idea Ultimate (MacOSX) 7 | homebrew_cask: 8 | name: intellij-idea 9 | when: ansible_distribution == "MacOSX" 10 | -------------------------------------------------------------------------------- /roles/k8s/tasks/kube-cleaner.yml: -------------------------------------------------------------------------------- 1 | - name: Check if npm is installed 2 | shell: which npm 3 | register: npm 4 | failed_when: False 5 | changed_when: False 6 | 7 | - name: Install kube-cleaner npm packages 8 | become: yes 9 | npm: 10 | name: kube-cleaner 11 | global: yes 12 | when: npm.rc == 0 13 | -------------------------------------------------------------------------------- /roles/k8s/tasks/osx.yml: -------------------------------------------------------------------------------- 1 | - name: Install k8s tools 2 | homebrew: 3 | name: 4 | - kubernetes-helm 5 | - draft 6 | - kubectx 7 | - kustomize 8 | - kubectl 9 | - derailed/k9s/k9s 10 | - velero 11 | 12 | - name: Install google-cloud-sdk 13 | homebrew_cask: 14 | name: google-cloud-sdk 15 | -------------------------------------------------------------------------------- /roles/recording/tasks/ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Install screen recording packages (Ubuntu) 2 | become: yes 3 | apt: 4 | name: 5 | # gif image optimization 6 | - gifsicle 7 | # gif screen recording 8 | - peek 9 | # video screen recording 10 | - kazam 11 | when: ansible_distribution == "Ubuntu" 12 | -------------------------------------------------------------------------------- /roles/java/tasks/osx.yml: -------------------------------------------------------------------------------- 1 | - name: Install cask-versions tap 2 | homebrew_tap: 3 | name: 4 | - homebrew/cask-versions 5 | 6 | - name: Install java 8 & 11 7 | homebrew_cask: 8 | name: 9 | - homebrew/cask-versions/adoptopenjdk8 10 | - java11 11 | 12 | - name: Install maven 13 | homebrew: 14 | name: 15 | - maven 16 | -------------------------------------------------------------------------------- /config/vimrc: -------------------------------------------------------------------------------- 1 | set runtimepath+=~/.vim_runtime 2 | 3 | source ~/.vim_runtime/vimrcs/basic.vim 4 | source ~/.vim_runtime/vimrcs/filetypes.vim 5 | source ~/.vim_runtime/vimrcs/plugins_config.vim 6 | source ~/.vim_runtime/vimrcs/extended.vim 7 | 8 | try 9 | source ~/.vim_runtime/my_configs.vim 10 | catch 11 | endtry 12 | 13 | colorscheme nord 14 | set number 15 | -------------------------------------------------------------------------------- /roles/vagrant/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install vagrant (Ubuntu) 2 | include: ubuntu.yml 3 | when: ansible_distribution == "Ubuntu" 4 | 5 | - name: Install vagrant (Arch) 6 | include: arch.yml 7 | when: ansible_distribution == "Archlinux" 8 | 9 | - name: Install vagrant (MacOSX) 10 | homebrew_cask: 11 | name: vagrant 12 | when: ansible_distribution == "MacOSX" 13 | -------------------------------------------------------------------------------- /roles/hid_apple/tasks/ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Copy keyboard configuration 2 | become: yes 3 | copy: 4 | src: files/hid_apple.conf 5 | dest: /etc/modprobe.d/hid_apple.conf 6 | owner: root 7 | group: root 8 | mode: '0644' 9 | register: conf 10 | 11 | - name: Regenerate initramfs 12 | become: yes 13 | shell: update-initramfs -u -k all 14 | when: conf.changed 15 | 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | insert_final_newline = true 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # Tab indentation (no size specified) 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /roles/vagrant/tasks/ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Get installed version 2 | shell: dpkg -s vagrant | grep Version | awk -F':' '{print $3}' 3 | register: vagrant 4 | changed_when: False 5 | 6 | - name: Install vagrant 7 | become: yes 8 | apt: 9 | deb: https://releases.hashicorp.com/vagrant/{{ vagrant_version }}/vagrant_{{ vagrant_version }}_x86_64.deb 10 | when: vagrant.stdout != vagrant_version 11 | -------------------------------------------------------------------------------- /roles/zsh/tasks/font_osx.yml: -------------------------------------------------------------------------------- 1 | - name: Create fonts directory 2 | file: 3 | path: ~/Library/Fonts 4 | state: directory 5 | 6 | - name: Install fira nerd-font 7 | unarchive: 8 | src: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/FiraCode.zip 9 | dest: ~/Library/Fonts 10 | remote_src: yes 11 | creates: ~/Library/Fonts/Fura Code Medium Nerd Font Complete.ttf 12 | -------------------------------------------------------------------------------- /roles/k8s/tasks/helm_ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Install helm gpg key (Ubuntu) 2 | become: yes 3 | apt_key: 4 | url: https://baltocdn.com/helm/signing.asc 5 | 6 | - name: Install helm apt repository (Ubuntu) 7 | become: yes 8 | apt_repository: 9 | repo: deb https://baltocdn.com/helm/stable/debian/ all main 10 | 11 | - name: Install helm package (Ubuntu) 12 | become: yes 13 | apt: 14 | name: helm 15 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/cfssl.yml: -------------------------------------------------------------------------------- 1 | - name: Install cfssl tools 2 | become: yes 3 | get_url: 4 | url: https://pkg.cfssl.org/R1.2/{{ item }}_linux-amd64 5 | dest: /usr/local/bin/{{ item }} 6 | mode: 0755 7 | owner: root 8 | group: root 9 | with_items: 10 | - cfssl-bundle 11 | - cfssl-certinfo 12 | - cfssl-newkey 13 | - cfssl-scan 14 | - cfssl 15 | - cfssljson 16 | - mkbundle 17 | - multirootca 18 | -------------------------------------------------------------------------------- /config/oh-my-zsh-plugins/scm.plugin.zsh: -------------------------------------------------------------------------------- 1 | scm-root () { 2 | ROOT=$(git rev-parse --show-toplevel 2>/dev/null) 3 | if [ "$?" != 0 ]; then 4 | ROOT=$(hg root 2>/dev/null) 5 | if [ "$?" != 0 ]; then 6 | ROOT=$(svn info . --show-item wc-root --no-newline 2>/dev/null) 7 | fi 8 | fi 9 | if [ -z "${ROOT}" ]; then 10 | echo "no repository root found" 11 | return 1 12 | else 13 | cd "${ROOT}" 14 | fi 15 | } 16 | -------------------------------------------------------------------------------- /config/gitconfig.j2: -------------------------------------------------------------------------------- 1 | [user] 2 | email = {{mail}} 3 | name = {{displayName}} 4 | signingkey = {{gpgKey}} 5 | [alias] 6 | outgoing = log --pretty=oneline --abbrev-commit --graph @{u}.. 7 | incoming = !git fetch && git log --pretty=oneline --abbrev-commit --graph ..@{u} 8 | ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi" 9 | [credential] 10 | helper = cache 11 | [pull] 12 | rebase = true 13 | [init] 14 | defaultBranch = main 15 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/aliases.yml: -------------------------------------------------------------------------------- 1 | - name: Download kubectl_aliases 2 | get_url: 3 | url: https://raw.githubusercontent.com/ahmetb/kubectl-alias/master/.kubectl_aliases 4 | dest: ~/.kubectl_aliases 5 | mode: '0440' 6 | 7 | - name: Download docker_aliases 8 | get_url: 9 | url: "https://github.com/schnatterer/docker-aliases/releases/download/{{ docker_aliases_version }}/default.docker-aliases" 10 | dest: ~/.docker_aliases 11 | mode: '0440' 12 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/ctop.yml: -------------------------------------------------------------------------------- 1 | - name: Capture ctop version 2 | shell: ctop -v | awk '{print $3}' | sed 's/,//g' 3 | register: ctop 4 | changed_when: False 5 | 6 | - name: Install ctop 7 | become: yes 8 | get_url: 9 | url: https://github.com/bcicen/ctop/releases/download/v{{ ctop_version }}/ctop-{{ ctop_version }}-linux-amd64 10 | dest: /usr/local/bin/ctop 11 | owner: root 12 | group: root 13 | mode: 755 14 | when: ctop.stdout != ctop_version 15 | -------------------------------------------------------------------------------- /roles/virtualbox/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install virtualbox (Ubuntu) 2 | include: ubuntu.yml 3 | when: ansible_distribution == "Ubuntu" 4 | 5 | - name: Install virtualbox (Arch) 6 | become: yes 7 | pacman: 8 | name: virtualbox 9 | when: ansible_distribution == "Archlinux" 10 | 11 | - name: Install virtualbox (MacOSX) 12 | homebrew_cask: 13 | name: 14 | - virtualbox 15 | - virtualbox-extension-pack 16 | when: ansible_distribution == "MacOSX" 17 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/gotop.yml: -------------------------------------------------------------------------------- 1 | - name: Capture gotop version 2 | shell: gotop --version || echo unknown 3 | register: gotop 4 | changed_when: False 5 | 6 | - name: Install gotop (Arch) 7 | become: yes 8 | unarchive: 9 | src: https://github.com/xxxserxxx/gotop/releases/download/v{{ gotop_version }}/gotop_v{{ gotop_version }}_linux_amd64.tgz 10 | dest: /usr/local/bin 11 | remote_src: yes 12 | when: gotop.stdout != gotop_version and ansible_system == "Linux" 13 | -------------------------------------------------------------------------------- /config/oh-my-zsh-plugins/editorconfig.plugin.zsh: -------------------------------------------------------------------------------- 1 | function editorconfig() { 2 | cat << EOF 3 | # EditorConfig is awesome: https://EditorConfig.org 4 | 5 | # top-most EditorConfig file 6 | root = true 7 | 8 | # Unix-style newlines with a newline ending every file 9 | [*] 10 | charset = utf-8 11 | end_of_line = lf 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | # Tab indentation (no size specified) 17 | [Makefile] 18 | indent_style = tab 19 | EOF 20 | } 21 | -------------------------------------------------------------------------------- /roles/idea/tasks/linux.yml: -------------------------------------------------------------------------------- 1 | - name: Install Intellij Idea Ultimate 2 | snap: 3 | classic: yes 4 | name: intellij-idea-ultimate 5 | 6 | - name: Increase file descriptor limit 7 | copy: 8 | src: "{{ playbook_dir }}/config/90-idea.conf" 9 | dest: /etc/sysctl.d/90-idea.conf 10 | owner: root 11 | group: root 12 | mode: 0644 13 | register: inotifylimit 14 | 15 | - name: apply new file descriptor limit 16 | command: sysctl -p --system 17 | when: inotifylimit.changed 18 | 19 | -------------------------------------------------------------------------------- /roles/vscode/tasks/ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Remove old snap installation (Ubuntu) 2 | snap: 3 | name: code 4 | state: absent 5 | 6 | - name: Install vscode gpg key (Ubuntu) 7 | apt_key: 8 | url: https://packages.microsoft.com/keys/microsoft.asc 9 | 10 | - name: Install vscode apt repository (Ubuntu) 11 | apt_repository: 12 | repo: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main 13 | 14 | - name: Install vscode package (Ubuntu) 15 | apt: 16 | name: code 17 | 18 | -------------------------------------------------------------------------------- /config/gpgrc: -------------------------------------------------------------------------------- 1 | # ssh over gpg 2 | # Launch gpg-agent 3 | gpg-connect-agent /bye 4 | 5 | # When using SSH support, use the current TTY for passphrase prompts 6 | gpg-connect-agent updatestartuptty /bye > /dev/null 7 | 8 | # Point the SSH_AUTH_SOCK to the one handled by gpg-agent 9 | if [ -S $(gpgconf --list-dirs agent-ssh-socket) ]; then 10 | export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) 11 | else 12 | echo "$(gpgconf --list-dirs agent-ssh-socket) doesn't exist. Is gpg-agent running ?" 13 | fi 14 | -------------------------------------------------------------------------------- /roles/snap/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install snapd package 2 | become: yes 3 | pacman: 4 | name: snapd 5 | when: ansible_distribution == "Archlinux" 6 | 7 | - name: Start snapd 8 | become: yes 9 | systemd: 10 | name: snapd.socket 11 | enabled: yes 12 | state: started 13 | when: ansible_system == "Linux" 14 | 15 | - name: Enable support for classic snaps 16 | become: yes 17 | file: 18 | dest: /snap 19 | src: /var/lib/snapd/snap 20 | state: link 21 | when: ansible_distribution == "Archlinux" 22 | -------------------------------------------------------------------------------- /roles/mercurial/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install mercurial (Arch) 2 | become: yes 3 | pacman: 4 | name: mercurial 5 | when: ansible_distribution == "Archlinux" 6 | 7 | - name: Install mercurial (Ubuntu) 8 | become: yes 9 | apt: 10 | name: mercurial 11 | when: ansible_distribution == "Ubuntu" 12 | 13 | - name: Install mercurial (MacOSX) 14 | homebrew: 15 | name: mercurial 16 | when: ansible_distribution == "MacOSX" 17 | 18 | - name: Render mercurial configuration 19 | template: 20 | src: "{{ playbook_dir }}/config/hgrc.j2" 21 | dest: ~/.hgrc 22 | mode: 0600 23 | -------------------------------------------------------------------------------- /roles/trivy/tasks/ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Install aquasecurity gpg key (Ubuntu) 2 | become: yes 3 | apt_key: 4 | url: https://aquasecurity.github.io/trivy-repo/deb/public.key 5 | 6 | - name: Capture lsb release (Ubuntu) 7 | shell: lsb_release -cs 8 | register: lsbrelease 9 | changed_when: False 10 | 11 | - name: Install aquasecurity trivy repository (Ubuntu) 12 | become: yes 13 | apt_repository: 14 | repo: deb [arch=amd64] https://aquasecurity.github.io/trivy-repo/deb {{ lsbrelease.stdout }} main 15 | 16 | - name: Install trivy package (Ubuntu) 17 | become: yes 18 | apt: 19 | name: trivy 20 | -------------------------------------------------------------------------------- /roles/k8s/tasks/gcloud_ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Install gcloud gpg key (Ubuntu) 2 | become: yes 3 | apt_key: 4 | url: https://packages.cloud.google.com/apt/doc/apt-key.gpg 5 | keyring: /usr/share/keyrings/cloud.google.gpg 6 | 7 | - name: Capture lsb release (Ubuntu) 8 | shell: lsb_release -cs 9 | register: lsbrelease 10 | changed_when: False 11 | 12 | - name: Install docker apt repository (Ubuntu) 13 | become: yes 14 | apt_repository: 15 | repo: deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main 16 | 17 | - name: Install google-cloud-sdk package (Ubuntu) 18 | become: yes 19 | apt: 20 | name: google-cloud-sdk 21 | -------------------------------------------------------------------------------- /config/oh-my-zsh-plugins/vegeta.plugin.zsh: -------------------------------------------------------------------------------- 1 | # vegeta quick 2 | vq () { 3 | TARGET="${1}" 4 | DURATION="${2}" 5 | RATE="${3}" 6 | 7 | SHOW_HELP=false 8 | for arg in "$@"; do 9 | if [ "${arg}" = "-h" ] || [ "${arg}" = "--help" ]; then 10 | SHOW_HELP=true 11 | fi 12 | done 13 | 14 | if [ "${TARGET}" = "" ] || ${SHOW_HELP}; then 15 | echo "usage vq target [duration rate]" 16 | echo "for example:" 17 | echo " vq https://example.org 5s 10" 18 | echo "" 19 | else 20 | echo "start vegeta with a rate of ${RATE}/1s for ${DURATION}" 21 | echo "---" 22 | echo "GET ${TARGET}" | vegeta attack -duration=${DURATION} -rate=${RATE} | vegeta report 23 | fi 24 | } 25 | -------------------------------------------------------------------------------- /roles/packer/tasks/linux.yml: -------------------------------------------------------------------------------- 1 | - name: Register file 2 | stat: 3 | path: /usr/local/bin/packer 4 | register: packer 5 | changed_when: False 6 | 7 | - name: Download packer 8 | get_url: 9 | url: https://releases.hashicorp.com/packer/{{ packer_version }}/packer_{{ packer_version }}_linux_amd64.zip 10 | dest: /tmp/packer.zip 11 | when: packer.stat.exists == False 12 | 13 | - name: Unarchive packer 14 | become: yes 15 | unarchive: 16 | src: /tmp/packer.zip 17 | dest: /usr/local/bin 18 | remote_src: yes 19 | when: packer.stat.exists == False 20 | 21 | - name: Remove downloaded archive 22 | file: 23 | path: /tmp/packer.zip 24 | state: absent 25 | when: packer.stat.exists == False 26 | -------------------------------------------------------------------------------- /roles/recording/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Check if npm is installed 2 | shell: which npm 3 | register: npm 4 | failed_when: False 5 | changed_when: False 6 | 7 | # beautiful gif terminal recording 8 | - name: Install terminalizer 9 | become: yes 10 | npm: 11 | name: terminalizer 12 | global: yes 13 | unsafe_perm: yes 14 | when: npm.rc == 0 15 | 16 | - name: Install recording tools (Arch) 17 | include: arch.yml 18 | when: ansible_distribution == "Archlinux" 19 | 20 | - name: Install recording tools (Ubuntu) 21 | include: ubuntu.yml 22 | when: ansible_distribution == "Ubuntu" 23 | 24 | - name: Install recording tools (MacOSX) 25 | include: osx.yml 26 | when: ansible_distribution == "MacOSX" 27 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/gopass.yml: -------------------------------------------------------------------------------- 1 | - name: Install gopass (Arch) 2 | become: yes 3 | pacman: 4 | name: gopass 5 | when: ansible_distribution == "Archlinux" 6 | 7 | - name: Install gopass apt key (Ubuntu) 8 | become: yes 9 | apt_key: 10 | url: https://api.bintray.com/orgs/gopasspw/keys/gpg/public.key 11 | when: ansible_distribution == "Ubuntu" 12 | 13 | - name: Install gopass apt repository (Ubuntu) 14 | become: yes 15 | apt_repository: 16 | repo: deb https://dl.bintray.com/gopasspw/gopass trusty main 17 | when: ansible_distribution == "Ubuntu" 18 | 19 | - name: Install gopass (Ubuntu) 20 | become: yes 21 | apt: 22 | name: 23 | - gopass 24 | - xclip 25 | when: ansible_distribution == "Ubuntu" 26 | -------------------------------------------------------------------------------- /roles/k8s/tasks/kubectx.yml: -------------------------------------------------------------------------------- 1 | - name: Clone kubectx repository 2 | become: yes 3 | git: 4 | repo: https://github.com/ahmetb/kubectx 5 | dest: /opt/kubectx 6 | 7 | - name: Link kubectx scripts 8 | become: yes 9 | file: 10 | src: /opt/kubectx/{{ item }} 11 | dest: /usr/local/bin/{{ item }} 12 | state: link 13 | with_items: 14 | - kubectx 15 | - kubens 16 | 17 | - name: Create completions directory 18 | file: 19 | path: ~/.oh-my-zsh/completions 20 | state: directory 21 | 22 | - name: Link kubectx completions 23 | file: 24 | src: /opt/kubectx/completion/{{ item }}.zsh 25 | dest: ~/.oh-my-zsh/completions/_{{ item }}.zsh 26 | state: link 27 | with_items: 28 | - kubectx 29 | - kubens 30 | -------------------------------------------------------------------------------- /roles/terraform/tasks/linux.yml: -------------------------------------------------------------------------------- 1 | - name: Register file 2 | stat: 3 | path: /usr/local/bin/terraform 4 | register: terraform 5 | changed_when: False 6 | 7 | - name: Download terraform 8 | get_url: 9 | url: https://releases.hashicorp.com/terraform/{{ terraform_version }}/terraform_{{ terraform_version }}_linux_amd64.zip 10 | dest: /tmp/terraform.zip 11 | when: terraform.stat.exists == False 12 | 13 | - name: Unarchive terraform 14 | become: yes 15 | unarchive: 16 | src: /tmp/terraform.zip 17 | dest: /usr/local/bin 18 | remote_src: yes 19 | when: terraform.stat.exists == False 20 | 21 | - name: Remove downloaded archive 22 | file: 23 | path: /tmp/terraform.zip 24 | state: absent 25 | when: terraform.stat.exists == False 26 | -------------------------------------------------------------------------------- /config/gpg.conf.j2: -------------------------------------------------------------------------------- 1 | auto-key-locate keyserver 2 | keyserver hkps://keys.openpgp.org 3 | keyserver-options no-honor-keyserver-url 4 | keyserver-options no-honor-keyserver-url 5 | personal-cipher-preferences AES256 AES192 AES CAST5 6 | personal-digest-preferences SHA512 SHA384 SHA256 SHA224 7 | default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed 8 | cert-digest-algo SHA512 9 | s2k-cipher-algo AES256 10 | s2k-digest-algo SHA512 11 | charset utf-8 12 | fixed-list-mode 13 | no-comments 14 | no-emit-version 15 | keyid-format 0xlong 16 | list-options show-uid-validity 17 | verify-options show-uid-validity 18 | with-fingerprint 19 | use-agent 20 | require-cross-certification 21 | ignore-time-conflict 22 | allow-freeform-uid 23 | default-key {{ gpgKey }} 24 | -------------------------------------------------------------------------------- /roles/k8s/tasks/helm_arch.yml: -------------------------------------------------------------------------------- 1 | - name: capture installed helm version 2 | shell: helm version -c --short | awk '{print $2}' | awk -F'+' '{print $1}' | sed 's/v//g' 3 | register: helm 4 | changed_when: False 5 | 6 | - name: download and unarchive 7 | unarchive: 8 | src: https://get.helm.sh/helm-v{{ helm_version }}-linux-amd64.tar.gz 9 | dest: /tmp 10 | remote_src: yes 11 | when: helm.stdout != helm_version 12 | 13 | - name: install helm 14 | become: yes 15 | copy: 16 | src: /tmp/linux-amd64/helm 17 | dest: /usr/local/bin/helm 18 | owner: root 19 | group: root 20 | mode: 0755 21 | when: helm.stdout != helm_version 22 | 23 | - name: remove temporary files 24 | file: 25 | path: /tmp/linux-amd64 26 | state: absent 27 | when: helm.stdout != helm_version 28 | -------------------------------------------------------------------------------- /roles/k8s/tasks/gcloud_arch.yml: -------------------------------------------------------------------------------- 1 | - name: Check directory (Arch) 2 | stat: 3 | path: /usr/local/google-cloud-sdk 4 | register: gcloud 5 | changed_when: False 6 | 7 | - name: Download gcloud package (Arch) 8 | get_url: 9 | url: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-249.0.0-linux-x86_64.tar.gz 10 | dest: /tmp/google-cloud-sdk.tar.gz 11 | when: gcloud.stat.exists == False 12 | 13 | - name: Unarchive gcloud package (Arch) 14 | become: yes 15 | unarchive: 16 | src: /tmp/google-cloud-sdk.tar.gz 17 | dest: /usr/local 18 | remote_src: yes 19 | when: gcloud.stat.exists == False 20 | 21 | - name: Remove downloaded package (Arch) 22 | file: 23 | path: /tmp/google-cloud-sdk.tar.gz 24 | state: absent 25 | when: gcloud.stat.exists == False 26 | -------------------------------------------------------------------------------- /roles/k8s/tasks/draft.yml: -------------------------------------------------------------------------------- 1 | - name: capture installed draft version 2 | shell: draft version --short | awk -F'+' '{print $1}' | sed 's/v//g' 3 | register: draft 4 | changed_when: False 5 | 6 | - name: download and unarchive 7 | unarchive: 8 | src: https://azuredraft.blob.core.windows.net/draft/draft-v{{ draft_version }}-linux-amd64.tar.gz 9 | dest: /tmp 10 | remote_src: yes 11 | when: draft.stdout != draft_version 12 | 13 | - name: install draft 14 | become: yes 15 | copy: 16 | src: /tmp/linux-amd64/draft 17 | dest: /usr/local/bin/draft 18 | owner: root 19 | group: root 20 | mode: 0755 21 | when: draft.stdout != draft_version 22 | 23 | - name: remove temporary files 24 | file: 25 | path: /tmp/linux-amd64 26 | state: absent 27 | when: draft.stdout != draft_version 28 | -------------------------------------------------------------------------------- /roles/docker/tasks/ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Install docker gpg key (Ubuntu) 2 | become: yes 3 | apt_key: 4 | url: https://download.docker.com/linux/ubuntu/gpg 5 | 6 | - name: Capture lsb release (Ubuntu) 7 | shell: lsb_release -cs 8 | register: lsbrelease 9 | changed_when: False 10 | 11 | - name: Remove docker test apt repository (Ubuntu) 12 | become: yes 13 | apt_repository: 14 | repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ lsbrelease.stdout }} test 15 | state: absent 16 | 17 | - name: Install docker stable apt repository (Ubuntu) 18 | become: yes 19 | apt_repository: 20 | repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ lsbrelease.stdout }} stable 21 | 22 | - name: Install docker-ce package (Ubuntu) 23 | become: yes 24 | apt: 25 | name: docker-ce 26 | -------------------------------------------------------------------------------- /roles/node/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install node (Linux) 2 | become: yes 3 | snap: 4 | name: node 5 | classic: yes 6 | channel: 14/stable 7 | when: ansible_system == "Linux" 8 | 9 | - name: Remove node 10 (MacOSX) 10 | homebrew: 11 | name: node@10 12 | state: absent 13 | when: ansible_distribution == "MacOSX" 14 | 15 | - name: Install node and yarn (MacOSX) 16 | homebrew: 17 | name: 18 | - node 19 | - yarn 20 | when: ansible_distribution == "MacOSX" 21 | 22 | - name: Install yarn 23 | become: yes 24 | npm: 25 | name: yarn 26 | global: yes 27 | when: ansible_system == "Linux" 28 | 29 | - name: Install global npm packages 30 | become: yes 31 | npm: 32 | name: "{{ item }}" 33 | global: yes 34 | with_items: 35 | - colortest 36 | - prettier 37 | - create-react-app 38 | - tldr 39 | -------------------------------------------------------------------------------- /roles/zsh/tasks/pywal.yml: -------------------------------------------------------------------------------- 1 | 2 | - name: Install pywal (Linux) 3 | become: yes 4 | pip: 5 | name: pywal 6 | executable: pip3 7 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 8 | 9 | # pywal requires imagemagick as backend 10 | - name: Install imagemagick (Linux) 11 | become: yes 12 | apt: 13 | name: imagemagick 14 | when: ansible_distribution == "Ubuntu" 15 | 16 | # we need to use the version from master for MacOSX, because of a bug in pywal 3.3.0 17 | # https://github.com/dylanaraps/pywal/issues/382 18 | 19 | - name: Capture if pywal is installed (MacOSX) 20 | stat: 21 | path: /usr/local/bin/wal 22 | register: wal 23 | 24 | - name: Install pywal (MacOSX) 25 | pip: 26 | name: https://github.com/dylanaraps/pywal/archive/master.zip 27 | executable: pip3 28 | when: not wal.stat.exists and ansible_distribution == "MacOSX" 29 | -------------------------------------------------------------------------------- /roles/k8s/tasks/k9s.yml: -------------------------------------------------------------------------------- 1 | - name: capture installed k9s version 2 | shell: k9s version -s | grep Version | awk '{print $NF}' 3 | register: k9s 4 | changed_when: False 5 | 6 | - name: Create temporary directory 7 | file: 8 | path: /tmp/k9s.temp 9 | state: directory 10 | when: k9s.stdout != k9s_version 11 | 12 | - name: Download and unarchive 13 | unarchive: 14 | src: https://github.com/derailed/k9s/releases/download/v{{k9s_version}}/k9s_Linux_x86_64.tar.gz 15 | dest: /tmp/k9s.temp 16 | remote_src: yes 17 | when: k9s.stdout != k9s_version 18 | 19 | - name: install k9s 20 | become: yes 21 | copy: 22 | src: /tmp/k9s.temp/k9s 23 | dest: /usr/local/bin/k9s 24 | owner: root 25 | group: root 26 | mode: 0755 27 | when: k9s.stdout != k9s_version 28 | 29 | - name: remove temporary files 30 | file: 31 | path: /tmp/k9s.temp 32 | state: absent 33 | when: k9s.stdout != k9s_version 34 | -------------------------------------------------------------------------------- /roles/java/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install java and maven (Arch) 2 | become: yes 3 | pacman: 4 | name: 5 | - jdk8-openjdk 6 | - jdk11-openjdk 7 | - maven 8 | when: ansible_distribution == "Archlinux" 9 | 10 | - name: Install java and maven (Ubuntu) 11 | become: yes 12 | apt: 13 | name: 14 | - openjdk-11-jdk 15 | - openjdk-11-source 16 | - openjdk-8-jdk 17 | - openjdk-8-source 18 | - maven 19 | when: ansible_distribution == "Ubuntu" 20 | 21 | - name: Install java and maven (MacOSX) 22 | include: osx.yml 23 | when: ansible_distribution == "MacOSX" 24 | 25 | - name: Create java-env plugin directory 26 | file: 27 | path: ~/.oh-my-zsh/custom/plugins/java-env 28 | state: directory 29 | 30 | - name: Link java-env plugin 31 | file: 32 | src: "{{ playbook_dir }}/config/oh-my-zsh-plugins/java-env.plugin.zsh" 33 | dest: ~/.oh-my-zsh/custom/plugins/java-env/java-env.plugin.zsh 34 | state: link 35 | -------------------------------------------------------------------------------- /roles/k8s/tasks/velero.yml: -------------------------------------------------------------------------------- 1 | - name: capture installed velero version 2 | shell: velero version --client-only | grep 'Version' | awk -F':' '{print $NF}' | sed -e 's/^\s*v//g' 3 | register: velero 4 | changed_when: False 5 | 6 | - name: download and unarchive velero 7 | unarchive: 8 | src: https://github.com/vmware-tanzu/velero/releases/download/v{{ velero_version }}/velero-v{{ velero_version }}-linux-amd64.tar.gz 9 | dest: /tmp 10 | remote_src: yes 11 | when: velero.stdout != velero_version 12 | 13 | - name: install velero 14 | become: yes 15 | copy: 16 | src: /tmp/velero-v{{ velero_version }}-linux-amd64/velero 17 | dest: /usr/local/bin/velero 18 | owner: root 19 | group: root 20 | mode: 0755 21 | when: velero.stdout != velero_version 22 | 23 | - name: remove temporary files 24 | file: 25 | path: /tmp/velero-v{{ velero_version }}-linux-amd64 26 | state: absent 27 | when: velero.stdout != velero_version 28 | -------------------------------------------------------------------------------- /roles/gpg/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install gpg (Arch) 2 | become: yes 3 | pacman: 4 | name: gnupg 5 | when: ansible_distribution == "Archlinux" 6 | 7 | - name: Install gpg (Ubuntu) 8 | become: yes 9 | apt: 10 | name: 11 | - gnupg 12 | - pcscd 13 | - scdaemon 14 | when: ansible_distribution == "Ubuntu" 15 | 16 | - name: Install gpg (MacOSX) 17 | homebrew: 18 | name: 19 | - gnupg 20 | - pinentry-mac 21 | when: ansible_distribution == "MacOSX" 22 | 23 | - name: Create gpg configuration directory 24 | file: 25 | path: ~/.gnupg 26 | mode: 0700 27 | state: directory 28 | 29 | - name: Link gpgrc script 30 | file: 31 | src: "{{ playbook_dir }}/config/gpgrc" 32 | dest: ~/.gnupg/gpgrc 33 | state: link 34 | 35 | - name: Render gpg configurations 36 | template: 37 | src: "{{ playbook_dir }}/config/{{item}}.j2" 38 | dest: ~/.gnupg/{{item}} 39 | mode: 0600 40 | with_items: 41 | - gpg.conf 42 | - gpg-agent.conf 43 | -------------------------------------------------------------------------------- /roles/vagrant/tasks/arch.yml: -------------------------------------------------------------------------------- 1 | - name: Get installed version 2 | shell: pacman -Q --info hashicorp-vagrant | grep Version | awk -F':' '{print $NF}' | awk -F'-' '{print $1}' 3 | register: vagrant 4 | changed_when: False 5 | 6 | - name: Download vagrant package 7 | get_url: 8 | url: https://releases.hashicorp.com/vagrant/{{ vagrant_version }}/vagrant_{{ vagrant_version }}_x86_64.tar.xz 9 | dest: /tmp/vagrant_{{ vagrant_version }}_x86_64.tar.xz 10 | when: vagrant.stdout | trim != vagrant_version 11 | 12 | - name: Install vagrant 13 | become: yes 14 | # code below should work, but it does not 15 | # pacman: 16 | # name: /tmp/vagrant_{{ vagrant_version }}_x86_64.tar.xz 17 | # state: present 18 | shell: pacman -U --noconfirm /tmp/vagrant_{{ vagrant_version }}_x86_64.tar.xz 19 | when: vagrant.stdout | trim != vagrant_version 20 | 21 | - name: Remove downloaded package 22 | file: 23 | path: /tmp/vagrant_{{ vagrant_version }}_x86_64.tar.xz 24 | state: absent 25 | -------------------------------------------------------------------------------- /roles/virtualbox/tasks/ubuntu.yml: -------------------------------------------------------------------------------- 1 | - name: Install virtualbox gpg key (Ubuntu) 2 | become: yes 3 | apt_key: 4 | url: "{{ item }}" 5 | with_items: 6 | - https://www.virtualbox.org/download/oracle_vbox.asc 7 | - https://www.virtualbox.org/download/oracle_vbox_2016.asc 8 | 9 | - name: Capture lsb release (Ubuntu) 10 | shell: lsb_release -cs 11 | register: lsbrelease 12 | changed_when: False 13 | 14 | - name: Remove wrong configured virtualbox apt repository (Ubuntu) 15 | become: yes 16 | apt_repository: 17 | repo: deb https://download.virtualbox.org/virtualbox/debian {{ lsbrelease.stdout }} contrib 18 | state: absent 19 | 20 | - name: Install virtualbox apt repository (Ubuntu) 21 | become: yes 22 | apt_repository: 23 | repo: deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian {{ lsbrelease.stdout }} contrib 24 | state: present 25 | 26 | - name: Install virtualbox package (Ubuntu) 27 | become: yes 28 | apt: 29 | name: virtualbox-6.1 30 | -------------------------------------------------------------------------------- /devbox: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | if ! which ansible-playbook > /dev/null 2>&1; then 6 | echo "Could not find ansible. Please install ansible first" 7 | exit 1 8 | fi 9 | 10 | BASEDIR=$(dirname "$0") 11 | 12 | if [ ! -f "${BASEDIR}/vars.yml" ]; then 13 | echo -n "mail: " 14 | read MAIL 15 | 16 | echo -n "displayName: " 17 | read DISPLAY_NAME 18 | 19 | echo -n "gpg key (KeyId): " 20 | read GPG_KEY 21 | 22 | cat > "${BASEDIR}/vars.yml" < /dev/null 2>&1; then 30 | PYTHON=$(which python3) 31 | else 32 | PYTHON=$(which python) 33 | fi 34 | 35 | echo "starting ansible ..." 36 | echo "====================" 37 | 38 | ansible-playbook \ 39 | -e ansible_python_interpreter="${PYTHON}" \ 40 | --extra-vars="@${BASEDIR}/vars.yml" \ 41 | "${BASEDIR}/playbook.yml" \ 42 | --connection local \ 43 | -i localhost, \ 44 | -K $@ 45 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/bat.yml: -------------------------------------------------------------------------------- 1 | - name: Capture bat version (Ubuntu) 2 | shell: bat --version | awk '{print $2}' 3 | register: bat 4 | changed_when: False 5 | when: ansible_distribution == "Ubuntu" 6 | 7 | - name: Install bat (Ubuntu) 8 | become: yes 9 | apt: 10 | deb: https://github.com/sharkdp/bat/releases/download/v{{ bat_version }}/bat_{{ bat_version }}_amd64.deb 11 | when: ansible_distribution == "Ubuntu" and bat.stdout != bat_version 12 | 13 | - name: Install bat (Arch) 14 | become: yes 15 | pacman: 16 | name: bat 17 | when: ansible_distribution == "Archlinux" 18 | 19 | - name: Install bat (MacOSX) 20 | homebrew: 21 | name: 22 | - bat 23 | when: ansible_distribution == "MacOSX" 24 | 25 | - name: Create bat configuration directory 26 | file: 27 | path: ~/.config/bat 28 | state: directory 29 | 30 | - name: Link bat configuration 31 | file: 32 | src: "{{ playbook_dir }}/config/bat-config" 33 | dest: ~/.config/bat/config 34 | state: link 35 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/vegeta.yml: -------------------------------------------------------------------------------- 1 | - name: Capture vegeta version 2 | shell: vegeta --version | grep '^Version' | awk '{print $2}' 3 | register: vegeta 4 | changed_when: False 5 | 6 | - name: Create temporary download location 7 | file: 8 | path: /tmp/vegeta 9 | state: directory 10 | when: vegeta.stdout != vegeta_version 11 | 12 | - name: Download vegeta 13 | unarchive: 14 | src: https://github.com/tsenart/vegeta/releases/download/v{{vegeta_version}}/vegeta_{{vegeta_version}}_linux_amd64.tar.gz 15 | dest: /tmp/vegeta 16 | remote_src: yes 17 | when: vegeta.stdout != vegeta_version 18 | 19 | - name: Copy vegeta binary 20 | become: yes 21 | copy: 22 | src: /tmp/vegeta/vegeta 23 | dest: /usr/local/bin/vegeta 24 | mode: 0755 25 | owner: root 26 | group: root 27 | when: vegeta.stdout != vegeta_version 28 | 29 | - name: Remove temporary download location 30 | file: 31 | path: /tmp/vegeta 32 | state: absent 33 | when: vegeta.stdout != vegeta_version 34 | -------------------------------------------------------------------------------- /roles/vim/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install vim (Arch) 2 | become: yes 3 | pacman: 4 | name: vim 5 | when: ansible_distribution == "Archlinux" 6 | 7 | - name: Install vim (Ubuntu) 8 | become: yes 9 | apt: 10 | name: vim 11 | when: ansible_distribution == "Ubuntu" 12 | 13 | - name: Install vim (MacOSX) 14 | homebrew: 15 | name: vim 16 | when: ansible_distribution == "MacOSX" 17 | 18 | - name: install vim runtime 19 | git: 20 | repo: https://github.com/amix/vimrc 21 | dest: ~/.vim_runtime 22 | update: no 23 | 24 | - name: install wal theme for vim 25 | git: 26 | repo: https://github.com/dylanaraps/wal.vim 27 | dest: ~/.vim_runtime/my_plugins/wal.vim 28 | update: no 29 | 30 | - name: install nord theme for vim 31 | git: 32 | repo: https://github.com/arcticicestudio/nord-vim 33 | dest: ~/.vim_runtime/my_plugins/nord-vim 34 | update: no 35 | 36 | - name: Link vimrc configuration 37 | file: 38 | src: "{{ playbook_dir }}/config/{{ item }}" 39 | dest: ~/.{{ item }} 40 | state: link 41 | with_items: 42 | - vimrc 43 | -------------------------------------------------------------------------------- /roles/k8s/tasks/linux.yml: -------------------------------------------------------------------------------- 1 | - name: Install gcloud (Ubuntu) 2 | include: gcloud_ubuntu.yml 3 | when: ansible_distribution == "Ubuntu" 4 | 5 | - name: Install gcloud (Arch) 6 | include: gcloud_arch.yml 7 | when: ansible_distribution == "Archlinux" 8 | 9 | - name: Install kubectl 10 | become: yes 11 | shell: gcloud components install kubectl --quiet 12 | args: 13 | creates: /usr/local/google-cloud-sdk/bin/kubectl 14 | when: ansible_distribution != "Ubuntu" 15 | 16 | - name: Install kubectl 17 | become: yes 18 | snap: 19 | classic: yes 20 | name: kubectl 21 | when: ansible_distribution == "Ubuntu" 22 | 23 | - name: Install kubectx 24 | include: kubectx.yml 25 | 26 | - name: Install helm (Arch) 27 | include: helm_arch.yml 28 | when: ansible_distribution == "Archlinux" 29 | 30 | - name: Install helm (Ubuntu) 31 | include: helm_ubuntu.yml 32 | when: ansible_distribution == "Ubuntu" 33 | 34 | - name: Install draft 35 | include: draft.yml 36 | 37 | - name: Install k9s 38 | include: k9s.yml 39 | 40 | - name: Install velero 41 | include: velero.yml 42 | -------------------------------------------------------------------------------- /roles/vscode/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install vscode (Arch) 2 | become: yes 3 | snap: 4 | name: code 5 | classic: yes 6 | state: present 7 | when: ansible_distribution == "Archlinux" 8 | 9 | - name: Install vscode (Ubuntu) 10 | become: yes 11 | include: ubuntu.yml 12 | when: ansible_distribution == "Ubuntu" 13 | 14 | - name: Install vscode (MacOSX) 15 | homebrew_cask: 16 | name: visual-studio-code 17 | when: ansible_distribution == "MacOSX" 18 | 19 | - name: install vscode extensions 20 | command: "code --install-extension '{{ item }}'" 21 | with_items: 22 | - ms-kubernetes-tools.vscode-kubernetes-tools 23 | - ms-azuretools.vscode-docker 24 | - EditorConfig.EditorConfig 25 | - dbaeumer.vscode-eslint 26 | - esbenp.prettier-vscode 27 | - vscoss.vscode-ansible 28 | - k--kato.intellij-idea-keybindings 29 | - marcostazi.vs-code-vagrantfile 30 | - jebbs.plantuml 31 | - msjsdiag.debugger-for-chrome 32 | - ms-vsliveshare.vsliveshare 33 | - arcticicestudio.nord-visual-studio-code 34 | register: vscode_result 35 | changed_when: "'already installed' not in vscode_result.stdout" 36 | -------------------------------------------------------------------------------- /config/hgrc.j2: -------------------------------------------------------------------------------- 1 | [ui] 2 | username = {{displayName}} <{{mail}}> 3 | editor = vim 4 | merge = internal:merge3 5 | 6 | [pager] 7 | pager = LESS='FRX' less 8 | 9 | [extensions] 10 | mq = 11 | shelve = 12 | transplant = 13 | pager = 14 | # enable color extension 15 | color = 16 | # enable extdiff extension (Extended Diff) 17 | hgext.extdiff = 18 | purge = 19 | graphlog = 20 | 21 | [extdiff] 22 | # configure extended diff to use colordiff (requires colordiff installed in your system) 23 | cmd.cdiff = colordiff 24 | opts.cdiff = -uprN 25 | 26 | [color] 27 | # configure colors for each possible hg status 28 | status.modified = blue bold 29 | status.added = green bold 30 | status.removed = red bold 31 | status.deleted = cyan bold 32 | status.unknown = magenta bold 33 | status.ignored = white bold 34 | # and for hg diff output also 35 | diff.diffline = bold 36 | diff.extended = cyan bold 37 | diff.file_a = red bold 38 | diff.file_b = green bold 39 | diff.hunk = magenta 40 | diff.deleted = red 41 | diff.inserted = green 42 | diff.changed = white 43 | diff.trailingwhitespace = bold red_background 44 | 45 | [defaults] 46 | # suppress noisy extdiff header message 47 | cdiff = -q 48 | -------------------------------------------------------------------------------- /roles/golang/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install go 1.16 (Linux) 2 | become: yes 3 | snap: 4 | classic: yes 5 | channel: 1.16/stable 6 | name: go 7 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 8 | 9 | - name: Install go and required tools (MacOSX) 10 | homebrew: 11 | name: 12 | - go 13 | - dep 14 | - glide 15 | when: ansible_distribution == "MacOSX" 16 | 17 | - name: Create go path related directories 18 | file: 19 | path: "{{ item }}" 20 | state: directory 21 | with_items: 22 | - ~/Projects 23 | - ~/Projects/go 24 | - ~/Projects/go/bin 25 | - ~/Projects/go/pkg 26 | - ~/Projects/go/src 27 | 28 | - name: Link git configuration 29 | file: 30 | src: "{{ playbook_dir }}/config/gorc" 31 | dest: ~/.gorc 32 | state: link 33 | 34 | - name: Install required go tools (Arch) 35 | become: yes 36 | pacman: 37 | name: 38 | - dep 39 | - glide 40 | when: ansible_distribution == "Archlinux" 41 | 42 | - name: Install required go tools (Ubuntu) 43 | become: yes 44 | apt: 45 | name: 46 | - go-dep 47 | - golang-glide 48 | when: ansible_distribution == "Ubuntu" 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/ansible,linux,osx 3 | # Edit at https://www.gitignore.io/?templates=ansible,linux,osx 4 | 5 | ### Ansible ### 6 | *.retry 7 | 8 | ### Linux ### 9 | *~ 10 | 11 | # temporary files which can be created if a process still has a handle open of a deleted file 12 | .fuse_hidden* 13 | 14 | # KDE directory preferences 15 | .directory 16 | 17 | # Linux trash folder which might appear on any partition or disk 18 | .Trash-* 19 | 20 | # .nfs files are created when an open file is removed but is still being accessed 21 | .nfs* 22 | 23 | ### OSX ### 24 | # General 25 | .DS_Store 26 | .AppleDouble 27 | .LSOverride 28 | 29 | # Icon must end with two \r 30 | Icon 31 | 32 | # Thumbnails 33 | ._* 34 | 35 | # Files that might appear in the root of a volume 36 | .DocumentRevisions-V100 37 | .fseventsd 38 | .Spotlight-V100 39 | .TemporaryItems 40 | .Trashes 41 | .VolumeIcon.icns 42 | .com.apple.timemachine.donotpresent 43 | 44 | # Directories potentially created on remote AFP share 45 | .AppleDB 46 | .AppleDesktop 47 | Network Trash Folder 48 | Temporary Items 49 | .apdisk 50 | 51 | # End of https://www.gitignore.io/api/ansible,linux,osx 52 | 53 | vars.yml 54 | -------------------------------------------------------------------------------- /roles/tmux/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install tmux and required dependencies (Arch) 2 | become: yes 3 | pacman: 4 | name: tmux 5 | when: ansible_distribution == "Archlinux" 6 | 7 | - name: Install tmux and required dependencies (Ubuntu) 8 | become: yes 9 | apt: 10 | name: tmux 11 | when: ansible_distribution == "Ubuntu" 12 | 13 | - name: Install tmux and required dependencies (MacOSX) 14 | homebrew: 15 | name: tmux 16 | when: ansible_distribution == "MacOSX" 17 | 18 | - name: Install tmux plugin manager 19 | git: 20 | repo: https://github.com/tmux-plugins/tpm 21 | dest: ~/.tmux/plugins/tpm 22 | 23 | - name: Link tmux configuration 24 | file: 25 | src: "{{ playbook_dir }}/config/{{ item }}" 26 | dest: ~/.{{ item }} 27 | state: link 28 | with_items: 29 | - tmux.conf 30 | - tmux.conf.local 31 | register: tmuxconf 32 | 33 | - name: Install tmux plugins 34 | shell: | 35 | # start a server but don't attach to it 36 | tmux start-server 37 | # create a new session but don't attach to it either 38 | tmux new-session -d 39 | # install the plugins 40 | ~/.tmux/plugins/tpm/scripts/install_plugins.sh 41 | # killing the server is not required, I guess 42 | tmux kill-server 43 | when: tmuxconf.changed 44 | -------------------------------------------------------------------------------- /roles/git/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install git (Arch) 2 | become: yes 3 | pacman: 4 | name: 5 | - git 6 | - git-crypt 7 | when: ansible_distribution == "Archlinux" 8 | 9 | - name: Install git related tools (Ubuntu) 10 | become: yes 11 | apt: 12 | name: 13 | - git 14 | - git-crypt 15 | when: ansible_distribution == "Ubuntu" 16 | 17 | - name: Install git (MacOSX) 18 | homebrew: 19 | name: 20 | - git 21 | - git-crypt 22 | - gh 23 | when: ansible_distribution == "MacOSX" 24 | 25 | - name: Check gh client version (Ubuntu) 26 | shell: gh --version | head -1 | awk '{print $3}' 27 | register: gh 28 | changed_when: False 29 | when: ansible_distribution == "Ubuntu" 30 | 31 | - name: Install GitHub Client (Ubuntu) 32 | become: yes 33 | apt: 34 | deb: https://github.com/cli/cli/releases/download/v{{ gh_version }}/gh_{{ gh_version }}_linux_amd64.deb 35 | when: ansible_distribution == "Ubuntu" and gh.stdout != gh_version 36 | 37 | - name: Check if diff-so-fancy is installed 38 | stat: 39 | path: /usr/local/bin/diff-so-fancy 40 | register: diffsofancy 41 | 42 | - name: Render git configuration 43 | template: 44 | src: "{{ playbook_dir }}/config/gitconfig.j2" 45 | dest: ~/.gitconfig 46 | mode: 0600 47 | 48 | 49 | -------------------------------------------------------------------------------- /roles/zsh/tasks/font_linux.yml: -------------------------------------------------------------------------------- 1 | - name: Create fonts directory 2 | file: 3 | path: ~/.fonts 4 | state: directory 5 | 6 | - name: Install fira nerd-font 7 | unarchive: 8 | src: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/FiraCode.zip 9 | dest: ~/.fonts 10 | remote_src: yes 11 | creates: ~/.fonts/Fura Code Medium Nerd Font Complete.ttf 12 | register: font 13 | 14 | - name: Rebuild font cache 15 | shell: fc-cache -f -v 16 | when: font.changed 17 | 18 | - name: Capture default terminal profile 19 | shell: gsettings get org.gnome.Terminal.ProfilesList default | sed "s/'//g" 20 | register: profile 21 | when: font.changed 22 | changed_when: False 23 | 24 | - name: Set nerd-font for current terminal profile 25 | shell: gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:{{ profile.stdout }}/" font "FuraCode Nerd Font Medium 11" 26 | when: font.changed 27 | 28 | - name: Install powerline font (Ubuntu) 29 | become: yes 30 | apt: 31 | name: 32 | - powerline 33 | - fonts-powerline 34 | when: ansible_distribution == "Ubuntu" 35 | 36 | - name: Install powerline font (Arch) 37 | become: yes 38 | pacman: 39 | name: 40 | - powerline 41 | - powerline-fonts 42 | when: ansible_distribution == "Archlinux" 43 | -------------------------------------------------------------------------------- /roles/docker/tasks/linux.yml: -------------------------------------------------------------------------------- 1 | - name: Install docker (Arch) 2 | become: yes 3 | pacman: 4 | name: docker 5 | when: ansible_distribution == "Archlinux" 6 | 7 | - name: Install docker (Ubuntu) 8 | include: ubuntu.yml 9 | when: ansible_distribution == "Ubuntu" 10 | 11 | - name: Start and enable docker daemon 12 | become: yes 13 | systemd: 14 | name: docker.service 15 | enabled: yes 16 | state: started 17 | 18 | - name: Add user to docker group 19 | become: yes 20 | user: 21 | name: "{{ lookup('env','USER') }}" 22 | groups: docker 23 | append: yes 24 | 25 | - name: Get kernel name 26 | shell: uname -s 27 | register: kernel 28 | changed_when: False 29 | 30 | - name: Get machine hardware name 31 | shell: uname -m 32 | register: machine 33 | changed_when: False 34 | 35 | - name: Install docker-compose 36 | become: yes 37 | get_url: 38 | url: https://github.com/docker/compose/releases/download/{{ compose_version }}/docker-compose-{{ kernel.stdout }}-{{ machine.stdout }} 39 | dest: /usr/local/bin/docker-compose 40 | mode: '0755' 41 | 42 | - name: Install docker-machine 43 | become: yes 44 | get_url: 45 | url: https://github.com/docker/machine/releases/download/v{{ machine_version }}/docker-machine-{{ kernel.stdout }}-{{ machine.stdout }} 46 | dest: /usr/local/bin/docker-machine 47 | mode: '0755' 48 | -------------------------------------------------------------------------------- /config/oh-my-zsh-plugins/java-env.plugin.zsh: -------------------------------------------------------------------------------- 1 | switch-java() { 2 | VERSION="${1}" 3 | if [ -n "${VERSION}" ]; then 4 | NEW_HOME="" 5 | if [ -f "/usr/libexec/java_home" ]; then 6 | NEW_HOME=$(osx_java_home "${VERSION}") 7 | else 8 | NEW_HOME=$(linux_java_home "${VERSION}") 9 | fi 10 | if [ $? != 0 ]; then 11 | echo "java version ${VERSION} is not installed" 12 | elif [ ! -n "${NEW_HOME}" ]; then 13 | echo "java version ${VERSION} is not installed" 14 | else 15 | echo "switching to java ${NEW_HOME}" 16 | PATH=$(create_path "${NEW_HOME}") 17 | JAVA_HOME="${NEW_HOME}" 18 | java -version 19 | fi 20 | else 21 | echo "usage switch-java version" 22 | fi 23 | } 24 | 25 | create_path() { 26 | echo -n "${1}/bin" 27 | segments=("${(@s/:/)PATH}") 28 | for segment in "${segments[@]}"; do 29 | if [ "${segment}" != "${JAVA_HOME}/bin" ]; then 30 | echo -n ":${segment}" 31 | fi 32 | done 33 | } 34 | 35 | osx_java_home() { 36 | VERSION="${1}" 37 | if (( $VERSION > 2 && $VERSION < 9)); then 38 | VERSION="1.${1}" 39 | fi 40 | /usr/libexec/java_home -v "${VERSION}" 41 | } 42 | 43 | linux_java_home() { 44 | VERSION="${1}" 45 | DIRECTORIES=( 46 | "/usr/lib/jvm/java-1.${VERSION}.0-openjdk-amd64" 47 | "/usr/lib/jvm/java-${VERSION}-openjdk" 48 | ) 49 | for DIRECTORY in ${DIRECTORIES}; do 50 | if [ -d "${DIRECTORY}" ]; then 51 | echo "${DIRECTORY}" 52 | break 53 | fi 54 | done 55 | } 56 | -------------------------------------------------------------------------------- /roles/recording/tasks/arch.yml: -------------------------------------------------------------------------------- 1 | - name: Install screen recording packages (Arch) 2 | become: yes 3 | pacman: 4 | name: 5 | # gif image optimization 6 | - gifsicle 7 | # gif screen recording 8 | - peek 9 | when: ansible_distribution == "Archlinux" 10 | 11 | # install kazam 12 | 13 | - name: Install build-tools 14 | become: yes 15 | pacman: 16 | name: 17 | - file 18 | - base-devel 19 | 20 | - name: Check if kazam is installed 21 | shell: which kazam 22 | register: kazam 23 | failed_when: False 24 | changed_when: False 25 | 26 | - name: Download kazam aur package 27 | get_url: 28 | url: https://aur.archlinux.org/cgit/aur.git/snapshot/kazam.tar.gz 29 | dest: /tmp/kazam.tar.gz 30 | when: kazam.rc != 0 31 | 32 | - name: Extract tarball 33 | unarchive: 34 | src: /tmp/kazam.tar.gz 35 | dest: /tmp 36 | when: kazam.rc != 0 37 | 38 | - name: Install missing dependencies 39 | become: yes 40 | shell: source PKGBUILD && pacman -Syu --noconfirm --needed --asdeps "${makedepends[@]}" "${depends[@]}" 41 | args: 42 | chdir: /tmp/kazam 43 | executable: /bin/bash 44 | when: kazam.rc != 0 45 | 46 | - name: build package 47 | shell: makepkg --noconfirm --noprogressbar -mfs 48 | args: 49 | chdir: /tmp/kazam 50 | when: kazam.rc != 0 51 | 52 | - name: capture package name 53 | shell: ls -1 /tmp/kazam | grep pkg.tar 54 | register: kazam_pkg 55 | changed_when: False 56 | when: kazam.rc != 0 57 | 58 | - name: install compiled kazam package 59 | become: yes 60 | pacman: 61 | name: "/tmp/kazam/{{ kazam_pkg.stdout }}" 62 | when: kazam.rc != 0 63 | 64 | - name: remove temporary files 65 | file: 66 | path: "/tmp/{{ item }}" 67 | state: absent 68 | with_items: 69 | - kazam 70 | - kazam.tar.gz 71 | -------------------------------------------------------------------------------- /roles/cli-tools/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install cli tools from repository (Ubuntu) 2 | become: yes 3 | apt: 4 | name: 5 | - htop 6 | - iftop 7 | - make 8 | - openssl 9 | - wget 10 | - curl 11 | - subversion 12 | - jq 13 | - ncdu 14 | when: ansible_distribution == "Ubuntu" 15 | 16 | - name: Install cli tools from repository (Arch) 17 | become: yes 18 | pacman: 19 | name: 20 | - htop 21 | - iftop 22 | - make 23 | - openssl 24 | - wget 25 | - curl 26 | - subversion 27 | - jq 28 | - ncdu 29 | when: ansible_distribution == "Archlinux" 30 | 31 | - name: Install cli tools from repository (MacOSX) 32 | homebrew: 33 | name: 34 | - htop 35 | - iftop 36 | - make 37 | - openssl 38 | - wget 39 | - curl 40 | - subversion 41 | - jq 42 | - gotop 43 | - ctop 44 | - cfssl 45 | - gopass 46 | - vegeta 47 | - ncdu 48 | when: ansible_distribution == "MacOSX" 49 | 50 | - name: Install bat 51 | include: bat.yml 52 | 53 | - name: Install gotop 54 | include: gotop.yml 55 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 56 | 57 | - name: Install ctop 58 | include: ctop.yml 59 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 60 | 61 | - name: Install cfssl 62 | include: cfssl.yml 63 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 64 | 65 | - name: Install gopass 66 | include: gopass.yml 67 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 68 | 69 | - name: Install vegeta 70 | include: vegeta.yml 71 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 72 | 73 | - name: Install aliases 74 | include: aliases.yml 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Devboxes 2 | 3 | This repository contains ansible roles to setup my development machines and helps to keep them in sync. 4 | The ansible playbook will install software which i need for my day to day work as developer. 5 | It will also install my set of configuration for those tools. 6 | The playbook will install and configure the following tools: 7 | 8 | * zsh (configured with [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)) 9 | * tmux (inspired from [.tmux](https://github.com/gpakosz/.tmux)) 10 | * vim (configured with [vimrc](https://github.com/amix/vimrc)) 11 | * docker 12 | * vagrant 13 | * virtual box 14 | * packer 15 | * terraform 16 | * gcloud, kubectl and kubectx 17 | * gpg 18 | * git 19 | * mercurial 20 | * java and maven 21 | * node.js 22 | * golang 23 | * vscode 24 | * Intellij 25 | * and many more 26 | 27 | ## Supported Operating Systems 28 | 29 | * Ubuntu (tested on 19.04) 30 | * Manjaro Linux 31 | * Mac OS X 32 | 33 | ## Prerequisites 34 | 35 | * Ansible >= 2.6 36 | 37 | ### MacOSX 38 | 39 | * Install [homebrew](https://brew.sh/) 40 | * Install ansible `brew install ansible` 41 | 42 | ### Ubuntu 43 | 44 | Install ansible 45 | 46 | ```bash 47 | sudo add-apt-repository ppa:ansible/ansible 48 | sudo apt-get update 49 | sudo apt-get install ansible 50 | ``` 51 | 52 | ### Manjaro 53 | 54 | Install ansible `sudo pacman -S ansible` 55 | 56 | ## Getting started 57 | 58 | Just run the `devbox` script, on the first run it will ask some question to personalize the installed configurations. 59 | After that it will ask for your sudo password and then apply the ansible playbook. 60 | 61 | ## Tags 62 | 63 | Its also possible to only apply certain tags, e.g. 64 | 65 | `devbox --tags zsh` 66 | 67 | See [playbook](playbook.yml) for existing tags. 68 | 69 | ## Todo 70 | 71 | - [ ] Automatically Git Updates 72 | - [ ] Role chooser 73 | -------------------------------------------------------------------------------- /playbook.yml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | roles: 3 | - role: git 4 | tags: 5 | - shell 6 | - git 7 | - scm 8 | - vcs 9 | - role: zsh 10 | tags: 11 | - zsh 12 | - shell 13 | - role: tmux 14 | tags: 15 | - shell 16 | - tmux 17 | - role: vim 18 | tags: 19 | - shell 20 | - vim 21 | - role: gpg 22 | tags: 23 | - shell 24 | - gpg 25 | - gnupg 26 | - role: mercurial 27 | tags: 28 | - shell 29 | - mercurial 30 | - hg 31 | - role: cli-tools 32 | tags: 33 | - shell 34 | - tools 35 | - cli-tools 36 | - role: docker 37 | tags: 38 | - docker 39 | - docker-compose 40 | - docker-machine 41 | - ops 42 | - container 43 | - role: packer 44 | tags: 45 | - ops 46 | - tools 47 | - packer 48 | - role: terraform 49 | tags: 50 | - ops 51 | - tools 52 | - terraform 53 | - role: virtualbox 54 | tags: 55 | - ops 56 | - tools 57 | - virtualbox 58 | - vms 59 | - vbox 60 | - role: vagrant 61 | tags: 62 | - ops 63 | - tools 64 | - vagrant 65 | - role: snap 66 | tags: 67 | - snap 68 | - role: java 69 | tags: 70 | - dev 71 | - java 72 | - jdk 73 | - role: golang 74 | tags: 75 | - dev 76 | - go 77 | - golang 78 | - role: node 79 | tags: 80 | - dev 81 | - node 82 | - nodejs 83 | - js 84 | - javascript 85 | - role: k8s 86 | tags: 87 | - ops 88 | - k8s 89 | - kubernetes 90 | - helm 91 | - draft 92 | - gcloud 93 | - gke 94 | - role: vscode 95 | tags: 96 | - dev 97 | - vscode 98 | - role: idea 99 | tags: 100 | - dev 101 | - idea 102 | - role: recording 103 | tags: 104 | - recording 105 | - role: trivy 106 | tags: 107 | - trivy 108 | - role: backup 109 | tags: 110 | - backup 111 | - restic 112 | - role: hid_apple 113 | tags: 114 | - apple 115 | - keyboard 116 | - hid_apple 117 | -------------------------------------------------------------------------------- /config/tmux.conf.local: -------------------------------------------------------------------------------- 1 | # https://github.com/gpakosz/.tmux 2 | # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, 3 | # without any warranty. 4 | # Copyright 2012— Gregory Pakosz (@gpakosz). 5 | 6 | 7 | # -- navigation ---------------------------------------------------------------- 8 | 9 | # if you're running tmux within iTerm2 10 | # - and tmux is 1.9 or 1.9a 11 | # - and iTerm2 is configured to let option key act as +Esc 12 | # - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys 13 | # then uncomment the following line to make Meta + arrow keys mapping work 14 | #set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D" 15 | 16 | 17 | # -- windows & pane creation --------------------------------------------------- 18 | 19 | # new window retains current path, possible values are: 20 | # - true 21 | # - false (default) 22 | tmux_conf_new_window_retain_current_path=false 23 | 24 | # new pane retains current path, possible values are: 25 | # - true (default) 26 | # - false 27 | tmux_conf_new_pane_retain_current_path=true 28 | 29 | # new pane tries to reconnect ssh sessions (experimental), possible values are: 30 | # - true 31 | # - false (default) 32 | tmux_conf_new_pane_reconnect_ssh=false 33 | 34 | # prompt for session name when creating a new session, possible values are: 35 | # - true 36 | # - false (default) 37 | tmux_conf_new_session_prompt=false 38 | 39 | 40 | # Initialize TMUX plugin manager 41 | run '~/.tmux/plugins/tpm/tpm' 42 | 43 | 44 | # -- clipboard ----------------------------------------------------------------- 45 | 46 | # in copy mode, copying selection also copies to the OS clipboard 47 | # - true 48 | # - false (default) 49 | # on macOS, this requires installing reattach-to-user-namespace, see README.md 50 | # on Linux, this requires xsel or xclip 51 | tmux_conf_copy_to_os_clipboard=true 52 | 53 | 54 | # -- user customizations ------------------------------------------------------- 55 | # this is the place to override or undo settings 56 | 57 | # increase history size 58 | #set -g history-limit 10000 59 | 60 | # start with mouse mode enabled 61 | set -g mouse on 62 | 63 | # force Vi mode 64 | # really you should export VISUAL or EDITOR environment variable, see manual 65 | #set -g status-keys vi 66 | #set -g mode-keys vi 67 | 68 | # replace C-b by C-a instead of using both prefixes 69 | # set -gu prefix2 70 | # unbind C-a 71 | # unbind C-b 72 | # set -g prefix C-a 73 | # bind C-a send-prefix 74 | 75 | # move status line to top 76 | #set -g status-position top 77 | -------------------------------------------------------------------------------- /roles/zsh/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Install zsh and required dependencies (Arch) 2 | become: yes 3 | pacman: 4 | name: 5 | - zsh 6 | - python3 7 | - python-pip 8 | - fzf 9 | when: ansible_distribution == "Archlinux" 10 | 11 | - name: Install zsh and required dependencies (Ubuntu) 12 | become: yes 13 | apt: 14 | name: 15 | - zsh 16 | - python3 17 | - python3-pip 18 | when: ansible_distribution == "Ubuntu" 19 | 20 | - name: Install zsh and required dependencies (MacOSX) 21 | homebrew: 22 | name: 23 | - zsh 24 | - python3 25 | # - python3-pip is installed with python3 26 | - fzf 27 | when: ansible_distribution == "MacOSX" 28 | 29 | - name: Clone fzf repository (Ubuntu) 30 | git: 31 | repo: https://github.com/junegunn/fzf 32 | dest: ~/.fzf 33 | update: no 34 | when: ansible_distribution == "Ubuntu" 35 | 36 | - name: Install fzf (Ubuntu) 37 | shell: ~/.fzf/install --no-update-rc 38 | args: 39 | creates: ~/.fzf.zsh 40 | when: ansible_distribution == "Ubuntu" 41 | 42 | - name: Link zsh configuration 43 | file: 44 | src: "{{ playbook_dir }}/config/{{ item }}" 45 | dest: ~/.{{ item }} 46 | state: link 47 | with_items: 48 | - zshrc 49 | 50 | - name: Find path of zsh 51 | shell: which zsh 52 | register: whichzsh 53 | changed_when: False 54 | 55 | - name: Change default shell to zsh 56 | become: yes 57 | user: 58 | name: "{{ lookup('env','USER') }}" 59 | shell: "{{ whichzsh.stdout }}" 60 | when: not ansible_check_mode 61 | 62 | - name: Install terminal font (Linux) 63 | include: font_linux.yml 64 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 65 | 66 | - name: Install terminal font (MacOSX) 67 | include: font_osx.yml 68 | when: ansible_distribution == "MacOSX" 69 | 70 | - name: Install oh-my-zsh 71 | git: 72 | repo: https://github.com/robbyrussell/oh-my-zsh 73 | dest: ~/.oh-my-zsh 74 | update: no 75 | 76 | - name: Install zsh-autosuggestions 77 | git: 78 | repo: https://github.com/zsh-users/zsh-autosuggestions.git 79 | dest: ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions 80 | update: no 81 | 82 | - name: Install zsh-syntax-highlighting 83 | git: 84 | repo: https://github.com/zsh-users/zsh-syntax-highlighting.git 85 | dest: ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting 86 | update: no 87 | 88 | - name: Install powerlevel10k theme 89 | git: 90 | repo: https://github.com/romkatv/powerlevel10k 91 | dest: ~/.oh-my-zsh/custom/themes/powerlevel10k 92 | update: no 93 | 94 | - name: create custom oh-my-zsh plugin directories 95 | file: 96 | path: "~/.oh-my-zsh/custom/plugins/{{ item }}" 97 | state: directory 98 | with_items: "{{ custom_omz_plugins }}" 99 | 100 | - name: Install custom oh-my-zsh plugins 101 | file: 102 | src: "{{ playbook_dir }}/config/oh-my-zsh-plugins/{{item}}.plugin.zsh" 103 | dest: "~/.oh-my-zsh/custom/plugins/{{ item }}/{{item}}.plugin.zsh" 104 | state: link 105 | with_items: "{{ custom_omz_plugins }}" 106 | 107 | - name: Install pywal (Linux) 108 | become: yes 109 | pip: 110 | name: pywal 111 | executable: pip3 112 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Archlinux" 113 | 114 | # we need to use the version from master for MacOSX, because of a bug in pywal 3.3.0 115 | # https://github.com/dylanaraps/pywal/issues/382 116 | 117 | - name: Capture if pywal is installed (MacOSX) 118 | stat: 119 | path: /usr/local/bin/wal 120 | register: wal 121 | 122 | - name: Install pywal (MacOSX) 123 | pip: 124 | name: https://github.com/dylanaraps/pywal/archive/master.zip 125 | executable: pip3 126 | when: not wal.stat.exists and ansible_distribution == "MacOSX" 127 | -------------------------------------------------------------------------------- /config/zshrc: -------------------------------------------------------------------------------- 1 | # we use xterm as default, 2 | # but we use screen for tmux. 3 | # This is required to support home+end keys 4 | if [ -n "${TMUX}" ]; then 5 | export TERM="screen-256color" 6 | else 7 | export TERM="xterm-256color" 8 | fi 9 | 10 | # If you come from bash you might have to change your $PATH. 11 | # export PATH=$HOME/bin:/usr/local/bin:$PATH 12 | export PATH="/snap/bin:${PATH}" 13 | 14 | # add gcloud and kubectl to path 15 | if [ -f '/usr/local/google-cloud-sdk/path.zsh.inc' ]; then 16 | source '/usr/local/google-cloud-sdk/path.zsh.inc' 17 | fi 18 | 19 | # Path to your oh-my-zsh installation. 20 | export ZSH="$HOME/.oh-my-zsh" 21 | 22 | # Set name of the theme to load --- if set to "random", it will 23 | # load a random theme each time oh-my-zsh is loaded, in which case, 24 | # to know which specific one was loaded, run: echo $RANDOM_THEME 25 | # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 26 | # ZSH_THEME="powerlevel9k/powerlevel9k" 27 | ZSH_THEME=${ZSH_THEME:=powerlevel10k/powerlevel10k} 28 | #ZSH_THEME="robbyrussell" 29 | 30 | # powerlevel9k configuration 31 | # https://github.com/bhilburn/powerlevel9k 32 | POWERLEVEL9K_MODE="nerdfont-complete" 33 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs time) 34 | POWERLEVEL9K_PROMPT_ON_NEWLINE=true 35 | POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="▶ " 36 | POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="" 37 | POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 38 | POWERLEVEL9K_SHORTEN_STRATEGY="Default" 39 | 40 | # Set list of themes to pick from when loading at random 41 | # Setting this variable when ZSH_THEME=random will cause zsh to load 42 | # a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ 43 | # If set to an empty array, this variable will have no effect. 44 | # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 45 | 46 | # Uncomment the following line to use case-sensitive completion. 47 | # CASE_SENSITIVE="true" 48 | 49 | # Uncomment the following line to use hyphen-insensitive completion. 50 | # Case-sensitive completion must be off. _ and - will be interchangeable. 51 | # HYPHEN_INSENSITIVE="true" 52 | 53 | # Uncomment the following line to disable bi-weekly auto-update checks. 54 | # DISABLE_AUTO_UPDATE="true" 55 | 56 | # Uncomment the following line to automatically update without prompting. 57 | # DISABLE_UPDATE_PROMPT="true" 58 | 59 | # Uncomment the following line to change how often to auto-update (in days). 60 | # export UPDATE_ZSH_DAYS=13 61 | 62 | # Uncomment the following line if pasting URLs and other text is messed up. 63 | # DISABLE_MAGIC_FUNCTIONS=true 64 | 65 | # Uncomment the following line to disable colors in ls. 66 | # DISABLE_LS_COLORS="true" 67 | 68 | # Uncomment the following line to disable auto-setting terminal title. 69 | # DISABLE_AUTO_TITLE="true" 70 | 71 | # Uncomment the following line to enable command auto-correction. 72 | # ENABLE_CORRECTION="true" 73 | 74 | # Uncomment the following line to display red dots whilst waiting for completion. 75 | COMPLETION_WAITING_DOTS="true" 76 | 77 | # Uncomment the following line if you want to disable marking untracked files 78 | # under VCS as dirty. This makes repository status check for large repositories 79 | # much, much faster. 80 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 81 | 82 | # Uncomment the following line if you want to change the command execution time 83 | # stamp shown in the history command output. 84 | # You can set one of the optional three formats: 85 | # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 86 | # or set a custom format using the strftime function format specifications, 87 | # see 'man strftime' for details. 88 | # HIST_STAMPS="mm/dd/yyyy" 89 | 90 | # Would you like to use another custom folder than $ZSH/custom? 91 | # ZSH_CUSTOM=/path/to/new-custom-folder 92 | 93 | # Which plugins would you like to load? 94 | # Standard plugins can be found in ~/.oh-my-zsh/plugins/* 95 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 96 | # Example format: plugins=(rails git textmate ruby lighthouse) 97 | # Add wisely, as too many plugins slow down shell startup. 98 | plugins=( 99 | # zsh 100 | zsh-autosuggestions 101 | zsh-syntax-highlighting 102 | 103 | # scm 104 | git 105 | git-flow 106 | mercurial 107 | svn 108 | scm 109 | 110 | # javascript 111 | npm 112 | yarn 113 | gulp 114 | 115 | # golang 116 | golang 117 | 118 | # java 119 | mvn 120 | gradle 121 | 122 | # containers 123 | docker 124 | docker-compose 125 | kubectl 126 | 127 | # virtual machines 128 | vagrant 129 | 130 | # utils 131 | wd 132 | vegeta 133 | editorconfig 134 | ) 135 | 136 | # load java-env plugin, if is installed 137 | [ -d ~/.oh-my-zsh/custom/plugins/java-env ] && plugins+=(java-env) 138 | 139 | source $ZSH/oh-my-zsh.sh 140 | 141 | # User configuration 142 | 143 | # export MANPATH="/usr/local/man:$MANPATH" 144 | 145 | # You may need to manually set your language environment 146 | export LANG=en_US.UTF-8 147 | 148 | # Preferred editor for local and remote sessions 149 | # if [[ -n $SSH_CONNECTION ]]; then 150 | # export EDITOR='vim' 151 | # else 152 | # export EDITOR='mvim' 153 | # fi 154 | export EDITOR='vim' 155 | 156 | # Compilation flags 157 | # export ARCHFLAGS="-arch x86_64" 158 | 159 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 160 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 161 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 162 | # For a full list of active aliases, run `alias`. 163 | # 164 | # Example aliases 165 | # alias zshconfig="mate ~/.zshrc" 166 | # alias ohmyzsh="mate ~/.oh-my-zsh" 167 | alias igit="git -c http.sslVerify=false" 168 | alias dev_mode="export POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs)" 169 | alias kube_mode="export POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir kubecontext)" 170 | alias ops_mode=kube_mode 171 | alias yaml="bat --language='yaml'" 172 | alias preview="fzf --preview 'bat --color \"always\" {}'" 173 | alias ncdu="ncdu --color dark -rr -x --exclude .git --exclude node_modules" 174 | alias tldr="tldr --theme=base16" 175 | alias help="tldr" 176 | alias peek="peek -b ffmpeg" 177 | 178 | # fzf 179 | # add support for ctrl+o to open selected file in VS Code 180 | export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(code {})+abort'" 181 | 182 | # pywal 183 | # https://github.com/dylanaraps/pywal/wiki/Getting-Started#making-the-colorscheme-persist-on-reboot 184 | [ -f ~/.cache/wal/sequences ] && (cat ~/.cache/wal/sequences &) 185 | [ -f ~/.cache/wal/colors-tty.sh ] && source ~/.cache/wal/colors-tty.sh 186 | 187 | # enable gpg ssh agent 188 | [ -f ~/.gnupg/gpgrc ] && source ~/.gnupg/gpgrc 189 | 190 | # read fzf configuration, if available 191 | [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 192 | 193 | # configure go dev environment 194 | [ -f ~/.gorc ] && source ~/.gorc 195 | 196 | # load iTerm integration for osx 197 | test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" 198 | 199 | # load aliases if available 200 | [ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases 201 | [ -f ~/.docker_aliases ] && source ~/.docker_aliases 202 | -------------------------------------------------------------------------------- /config/tmux.conf: -------------------------------------------------------------------------------- 1 | # cat << EOF > /dev/null 2 | # https://github.com/gpakosz/.tmux 3 | # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, 4 | # without any warranty. 5 | # Copyright 2012— Gregory Pakosz (@gpakosz). 6 | # /!\ do not edit this file 7 | # instead, override settings in ~/.tmux.conf.local, see README.md 8 | 9 | 10 | # -- display ------------------------------------------------------------------- 11 | 12 | # Start windows and panes at 1, not 0 13 | set -g base-index 1 14 | set -g pane-base-index 1 15 | 16 | set-option -g status-position top 17 | 18 | set-option -g repeat-time 0 19 | 20 | # Removes ESC delay 21 | set -sg escape-time 0 22 | 23 | # List of plugins 24 | set -g @tpm_plugins ' \ 25 | caiogondim/maglev \ 26 | tmux-plugins/tpm \ 27 | tmux-plugins/tmux-sensible \ 28 | tmux-plugins/tmux-resurrect \ 29 | tmux-plugins/tmux-continuum \ 30 | tmux-plugins/tmux-yank \ 31 | tmux-plugins/tmux-pain-control \ 32 | tmux-plugins/tmux-copycat \ 33 | tmux-plugins/tmux-open \ 34 | tmux-plugins/tmux-battery \ 35 | tmux-plugins/tmux-cpu \ 36 | tmux-plugins/tmux-prefix-highlight \ 37 | ' 38 | # -- general ------------------------------------------------------------------- 39 | 40 | #set -g default-terminal "screen-256color" # colors! 41 | setw -g xterm-keys on 42 | set -s escape-time 10 # faster command sequences 43 | set -sg repeat-time 600 # increase repeat timeout 44 | set -s focus-events on 45 | 46 | set -g prefix2 C-a # GNU-Screen compatible prefix 47 | bind C-a send-prefix -2 48 | 49 | set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) 50 | setw -q -g utf8 on 51 | 52 | set -g history-limit 5000 # boost history 53 | 54 | # edit configuration 55 | bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'" 56 | 57 | # reload configuration 58 | bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' 59 | 60 | 61 | # -- display ------------------------------------------------------------------- 62 | 63 | set -g base-index 1 # start windows numbering at 1 64 | setw -g pane-base-index 1 # make pane numbering consistent with windows 65 | 66 | setw -g automatic-rename on # rename window to reflect current program 67 | set -g renumber-windows on # renumber windows when a window is closed 68 | 69 | set -g set-titles on # set terminal title 70 | 71 | set -g display-panes-time 800 # slightly longer pane indicators display time 72 | set -g display-time 1000 # slightly longer status messages display time 73 | 74 | set -g status-interval 10 # redraw status line every 10 seconds 75 | 76 | # clear both screen and history 77 | bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history 78 | 79 | # activity 80 | set -g monitor-activity on 81 | set -g visual-activity off 82 | 83 | 84 | # -- navigation ---------------------------------------------------------------- 85 | 86 | # create session 87 | bind C-c new-session 88 | 89 | # find session 90 | bind C-f command-prompt -p find-session 'switch-client -t %%' 91 | 92 | # split current window horizontally 93 | bind - split-window -v 94 | # split current window vertically 95 | bind _ split-window -h 96 | 97 | # pane navigation 98 | bind -r h select-pane -L # move left 99 | bind -r j select-pane -D # move down 100 | bind -r k select-pane -U # move up 101 | bind -r l select-pane -R # move right 102 | bind > swap-pane -D # swap current pane with the next one 103 | bind < swap-pane -U # swap current pane with the previous one 104 | 105 | # maximize current pane 106 | bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D' 107 | 108 | # pane resizing 109 | bind -r H resize-pane -L 2 110 | bind -r J resize-pane -D 2 111 | bind -r K resize-pane -U 2 112 | bind -r L resize-pane -R 2 113 | 114 | # window navigation 115 | unbind n 116 | unbind p 117 | bind -r C-h previous-window # select previous window 118 | bind -r C-l next-window # select next window 119 | bind Tab last-window # move to last active window 120 | 121 | # toggle mouse 122 | bind m run "cut -c3- ~/.tmux.conf | sh -s _toggle_mouse" 123 | 124 | 125 | # -- urlview ------------------------------------------------------------------- 126 | 127 | bind U run "cut -c3- ~/.tmux.conf | sh -s _urlview #{pane_id}" 128 | 129 | 130 | # -- facebook pathpicker ------------------------------------------------------- 131 | 132 | bind F run "cut -c3- ~/.tmux.conf | sh -s _fpp #{pane_id}" 133 | 134 | 135 | # -- list choice (tmux < 2.4) -------------------------------------------------- 136 | 137 | # vi-choice is gone in tmux >= 2.4 138 | run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true' 139 | run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true' 140 | run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true' 141 | run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true' 142 | run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true' 143 | run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true' 144 | run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true' 145 | 146 | 147 | # -- edit mode (tmux < 2.4) ---------------------------------------------------- 148 | 149 | # vi-edit is gone in tmux >= 2.4 150 | run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true' 151 | run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true' 152 | run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true' 153 | run -b 'tmux bind -ct vi-edit Escape cancel 2> /dev/null || true' 154 | 155 | 156 | # -- copy mode ----------------------------------------------------------------- 157 | 158 | bind Enter copy-mode # enter copy mode 159 | 160 | run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true' 161 | run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true' 162 | run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true' 163 | run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true' 164 | run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true' 165 | run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true' 166 | run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true' 167 | run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true' 168 | run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true' 169 | run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true' 170 | run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true' 171 | run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true' 172 | 173 | # copy to Mac OSX clipboard 174 | if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' 175 | # copy to X11 clipboard 176 | if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' 177 | if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' 178 | # copy to Windows clipboard 179 | if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' 180 | if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' 181 | 182 | 183 | # -- buffers ------------------------------------------------------------------- 184 | 185 | bind b list-buffers # list paste buffers 186 | bind p paste-buffer # paste from the top paste buffer 187 | bind P choose-buffer # choose which buffer to paste from 188 | 189 | 190 | # -- user defined overrides ---------------------------------------------------- 191 | 192 | if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' 193 | 194 | # Initialize TMUX plugin manager 195 | run '~/.tmux/plugins/tpm/tpm' 196 | --------------------------------------------------------------------------------