Merge pull request #283 from genebean/macos

Macos
This commit is contained in:
Gene Liverman 2023-08-25 14:18:36 -04:00 committed by GitHub
commit 15c92e683e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 179 additions and 58 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
/.vagrant/
/.vscode/
/vendor/
.dccache

View file

@ -3,7 +3,7 @@ all:
hosts:
bigboy-wsl:
ansible_connection: local
carbonbean:
blue-rock:
ansible_connection: local
children:
servers:

127
ansible/blue-rock.yaml Normal file
View file

@ -0,0 +1,127 @@
---
- name: Install packages
hosts: blue-rock
vars:
ansible_python_interpreter: '/usr/local/bin/python3'
tasks:
- name: Install packages from Homebrew
community.general.homebrew:
state: latest
name:
- adr-tools
# - cdktf
- chart-testing
- coreutils
- dog
- dust
- gh
- gotop
- helm
- hub
- jq
- k9s
- kubectl
- kubectx
- mas
- neovim
- npm
- python
- subversion
- tree
- wget
- yq
# - name: Install casks from Homebrew
# community.general.homebrew:
# state: present
# name:
# - homebrew/cask/1password
# - homebrew/cask/cakebrew
# - homebrew/cask/elgato-stream-deck
# - homebrew/cask/firefox
# - homebrew/cask/google-drive
# - homebrew/cask/iterm2
# - homebrew/cask/keepingyouawake
# - homebrew/cask/logseq
# - homebrew/cask/meld
# - homebrew/cask/obs
# - homebrew/cask/signal
# - homebrew/cask/slack
# - homebrew/cask/thunderbird
# - homebrew/cask/visual-studio-code
# - homebrew/cask/vivaldi
# - homebrew/cask/whatsapp
# - homebrew/cask/zoom
# - homebrew/cask-fonts/font-hack-nerd-font
# - homebrew/cask-fonts/font-inconsolata-g-for-powerline
# - homebrew/cask-fonts/font-source-code-pro-for-powerline
# - puppetlabs/puppet/pdk
# - name: Install apps from App Store
# community.general.mas:
# state: present
# id:
# - 1569813296 # 1Password for Safari
# - 417375580 # BetterSnapTool
# - 1532419400 # MeetingBar for Meet, Zoom & Co
# - 1451685025 # WireGuard
- name: Install packages with pip
ansible.builtin.pip:
name:
- ansible
- ansible-lint
# - powerline-status # repalced with airline
# - psutil
- name: Download Hack Nerd Font
ansible.builtin.unarchive:
src: https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Hack.zip
dest: "{{ lookup('env', 'HOME') }}/Library/Fonts/"
remote_src: true
# Vim setup
- name: Symlink .vimrc
ansible.builtin.file:
src: "{{ lookup('env', 'HOME') }}/repos/dots/link/nix/vimrc"
dest: "{{ lookup('env', 'HOME') }}/.vimrc"
state: link
force: true
# - name: Symlink .vimrc_os_specific
# ansible.builtin.file:
# src: "{{ lookup('env', 'HOME') }}/repos/dots/link/mac/vimrc_os_specific"
# dest: "{{ lookup('env', 'HOME') }}/.vimrc_os_specific"
# state: link
# force: true
- name: Install Vundle
ansible.builtin.git:
repo: 'https://github.com/VundleVim/Vundle.vim'
dest: "{{ lookup('env', 'HOME') }}/.vim/bundle/Vundle.vim"
- name: Install Vundle Plugins
shell: "echo -ne '\n' | vim +PluginInstall! +qall"
# ZSH setup
- name: Clone my oh-my-zsh plugins
ansible.builtin.git:
repo: 'https://github.com/genebean/my-oh-zsh-plugins'
dest: "{{ lookup('env', 'HOME') }}/repos/customized-oh-my-zsh/plugins"
- name: Clone zsh-autosuggestions
ansible.builtin.git:
repo: 'https://github.com/zsh-users/zsh-autosuggestions'
dest: "{{ lookup('env', 'HOME') }}/repos/customized-oh-my-zsh/plugins/zsh-autosuggestions"
- name: Clone my oh-my-zsh themes
ansible.builtin.git:
repo: 'https://github.com/genebean/my-oh-zsh-themes'
dest: "{{ lookup('env', 'HOME') }}/repos/customized-oh-my-zsh/themes"
- name: Symlink .zshrc
ansible.builtin.file:
src: "{{ lookup('env', 'HOME') }}/repos/dots/link/nix/zshrc"
dest: "{{ lookup('env', 'HOME') }}/.zshrc"
state: link
force: true

View file

@ -1,4 +0,0 @@
" enable powerline
python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup

View file

@ -1,3 +1,4 @@
set nocompatible " be iMproved, required
filetype off " required by Vundle. filetype is reenabled after Vundle starts
" set the runtime path to include Vundle and initialize
@ -7,7 +8,6 @@ call vundle#begin()
" let Vundle manage Vundle, required for Vundle to work right
Plugin 'VundleVim/Vundle.vim'
Plugin 'altercation/vim-colors-solarized' " provides solorized color scheme
Plugin 'ekalinin/Dockerfile.vim' " provides syntax highlighting for Dockerfiles
Plugin 'elzr/vim-json' " provides syntax highlighting for JSON files
Plugin 'garbas/vim-snipmate' " provides code snippets
@ -15,8 +15,10 @@ Plugin 'godlygeek/tabular' " provides a method for lining things
Plugin 'honza/vim-snippets' " provides snippets for use with vim-snipmate
Plugin 'MarcWeber/vim-addon-mw-utils' " a utility used by vim-snipmate
Plugin 'mrk21/yaml-vim' " provides indentation and syntax highlighting for yaml
Plugin 'rbong/vim-flog' " git branch viewer built on fugitive
Plugin 'rodjek/vim-puppet' " provides several niceties for working with Puppet
Plugin 'tomtom/tlib_vim' " a utility used by vim-snipmate
Plugin 'tpope/vim-fugitive' " all things Git here in Vim
Plugin 'vim-airline/vim-airline' " status line alternative to powerline
Plugin 'vim-airline/vim-airline-themes' " themes for vim-airline
Plugin 'vim-ruby/vim-ruby' " provides syntax highlighting for ruby files
@ -38,6 +40,7 @@ syntax on " enable syntax highlighting
set encoding=utf-8
set termencoding=utf-8
set t_Co=256 " tell vim we have 256 colors to work with
set autoindent " automatically indent new lines
set background=dark " tell vim your terminal has a dark background
@ -47,15 +50,12 @@ set fillchars+=stl:\ ,stlnc:\ " fix added per powerline troubles
set laststatus=2 " Always display the status line in all windows
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the status line)
set smarttab " helps with expanding tabs to spaces (I think)
set statusline+=%{FugitiveStatusline()} " get git info via fugitive plugin
set statusline+=%#warningmsg# " recommended setting from syntastic plugin
set statusline+=%{SyntasticStatuslineFlag()} " recommended setting from syntastic plugin
set statusline+=%* " recommended setting from syntastic plugin
set t_Co=256 " tell vim we have 256 colors to work with
let g:solarized_termtrans = 1 " This gets rid of the grey background
colorscheme solarized " use the solorized set of colors
" This has to come after colorscheme to not be masked
" This has to come after colorscheme, if defined, to not be masked
highlight ColorColumn ctermbg=232 " set the color to be used for guidelines
let &colorcolumn=join(range(81,999),",") " change the background color of everything beyond 80 characters
@ -74,7 +74,6 @@ let g:syntastic_quiet_messages = {'level': 'warnings'}
let g:vim_markdown_folding_disabled = 1
" settings for vim-airline
let g:airline_theme='powerlineish'
" import settings that are OS specific
" source ~/.vimrc_os_specific
let g:airline_theme='badwolf'
let g:airline_powerline_fonts = 1

View file

@ -4,15 +4,9 @@ export ZSH=~/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
if [[ `uname` == 'Linux' ]]; then
ZSH_THEME="beanbag"
#ZSH_THEME="af-magic"
else
ZSH_THEME="beanbag"
#ZSH_THEME="robbyrussell"
#ZSH_THEME="pygmalion"
#ZSH_THEME="muse"
fi
# use oh-my-posh for theme
# Get Homebrew into the path early so that plugins and such can use
# programs installed by it
@ -84,7 +78,7 @@ ZSH_CUSTOM=~/repos/customized-oh-my-zsh
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(brew bundler gem git git-flow github history kube-aliases kube-ps1 kubectl macos pip python terraform vagrant vscode)
plugins=(bundler gem git github history kubectl macos pip terraform vagrant vscode zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
@ -100,8 +94,8 @@ if [[ $(uname) == 'Darwin' ]]; then
fi
export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
# export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
# gpgconf --launch gpg-agent
# export MANPATH="/usr/local/man:$MANPATH"
@ -122,15 +116,22 @@ alias gbc='git branch --merged | command grep -vE "^(\*|\s*(main|master|develop|
alias gitextract='git log --pretty=email --patch-with-stat --reverse --full-index --binary --'
alias gpge='gpg2 --encrypt --sign --armor -r '
alias hubpr='hub pull-request --push --browse'
alias pssh='ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i ~/.ssh/id_rsa-acceptance'
alias pssh='ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -o PubkeyAcceptedKeyTypes=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa -o KexAlgorithms=+diffie-hellman-group1-sha1 -i ~/.ssh/id_rsa-acceptance'
alias sal='ssh-add -L'
alias st='open -a SourceTree'
alias sz='source ~/.zshrc'
alias usegpg='killall ssh-agent; export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) && gpgconf --launch gpg-agent'
alias usessh='gpgconf --kill gpg-agent'
# aliases whose command changes based on OS
if [[ `uname` == 'Linux' ]]; then
alias uwgconnect='nmcli dev wifi connect SecureWest password'
alias uwgforget='nmcli connection delete SecureWest'
alias ykey='sudo systemctl restart pcscd && sudo pkill -9 gpg-agent && source ~/.zshrc; ssh-add -L'
else
alias currentwifi='networksetup -getairportnetwork en0 |cut -d ":" -f2- | cut -d " " -f2-'
alias uwgconnect='networksetup -setairportnetwork en0 SecureWest'
alias uwgforget='networksetup -removepreferredwirelessnetwork en0 SecureWest'
alias ykey='pkill -9 gpg-agent && source ~/.zshrc; ssh-add -L'
fi
@ -139,8 +140,30 @@ if [[ `uname` == 'Linux' ]]; then
alias enable-ruby-27='source ~/enable-ruby-27'
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias uwgroute='nmcli connection modify SecureWest ipv4.route-metric 20; nmcli radio wifi off; nmcli radio wifi on'
alias uwgforget='nmcli connection delete SecureWest'
function popup() {
echo 'checking for updates via apt...'
sudo apt update
sudo apt upgrade -y
echo
echo 'checking for updates via flatpak...'
flatpak update
echo
echo 'checking for updates via snap...'
sudo snap refresh
echo
echo 'checking for updates via brew...'
brew update
brew upgrade
echo
echo 'checking for updates to Zoom'
wget -O /tmp/zoom_amd64.deb https://zoom.us/client/latest/zoom_amd64.deb && sudo apt-get install -y /tmp/zoom_amd64.deb; rm -f /tmp/zoom_amd64.deb
echo
echo 'checking for firmware updates...'
sudo fwupdmgr refresh --force && sudo fwupdmgr get-updates && sudo fwupdmgr update
echo
echo 'all done :)'
}
fi
if [[ `uname` != 'Linux' ]]; then
@ -152,26 +175,6 @@ if [[ `uname` != 'Linux' ]]; then
}
fi
# helper for aws and assume-role
function awsrole() {
echo "Enter MFA token:"
read mfatoken
eval $(assume-role $1 $AWS_HELPER_USERNAME $mfatoken)
}
function aws_account_info {
[ "$AWS_ACCOUNT_NAME" ] && [ "$AWS_ACCOUNT_ROLE" ] && echo "%{$reset_color%}%{$fg[blue]%}aws:(%{$reset_color%}%{$fg[red]%}$AWS_ACCOUNT_NAME:$AWS_ACCOUNT_ROLE%{$fg[blue]%})%{$reset_color%}"
}
# )ofni_tnuocca_swa($ is $(aws_account_info) backwards
#PROMPT=`echo $PROMPT | rev | sed 's/ / )ofni_tnuocca_swa($ /'| rev`
function get_cluster_short() {
echo "$1" |rev |cut -d _ -f1 |rev
}
KUBE_PS1_CLUSTER_FUNCTION=get_cluster_short
KUBE_PS1_COLOR_CONTEXT="%{$fg[yellow]%}"
KUBE_PS1_ENABLED=false
export EDITOR='vim'
export GOPATH=$HOME/go
@ -201,9 +204,6 @@ if [[ `uname` == 'Darwin' ]]; then
GEMBIN="$(gem environment gemdir)/bin"
export PATH=$PATH:$GEMBIN
# added by travis gem
[ -f ~/.travis/travis.sh ] && source ~/.travis/travis.sh || echo 'The travis gem is missing. After installing it run "echo y|travis" to create ~/.travis'
# added to make pipx work
[ -d /Users/gene/.local/bin ] && export PATH=$PATH:/Users/gene/.local/bin
@ -265,7 +265,5 @@ if type floaty &>/dev/null; then
source $(floaty completion --shell zsh)
fi
# default kube-ps1 to off
kubeoff
eval "$(oh-my-posh init zsh --config ~/repos/my-oh-my-posh-themes/beanbag.omp.json)"