From e7ef71b49aa27770d3dbfa0c380260cb103231b9 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 27 Dec 2019 22:33:12 +0000 Subject: [PATCH] Install Ansible via pip instead of Homebrew When installed via Homebrew, it seemed not possible to make molecule work correctly. So instead we install both ansible and molecule via pip, and everything works. --- Brewfile | 2 -- zsh/aliases.zsh | 4 ---- zsh/python.zsh | 25 +++++++++++++++++++++++++ zshrc.zsh | 1 + 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 zsh/python.zsh diff --git a/Brewfile b/Brewfile index ad3cc61..818d0e5 100644 --- a/Brewfile +++ b/Brewfile @@ -15,7 +15,6 @@ tap 'homebrew/cask-versions' # brew 'ack' -brew 'ansible' brew 'aspell' brew 'bash' brew 'bazaar' @@ -42,7 +41,6 @@ brew 'node' brew 'peco' brew 'pgformatter' brew 'postgresql' -brew 'pyenv' brew 'rbenv' brew 'rclone' brew 'readline' diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 9c9eed2..658cc2f 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -27,10 +27,6 @@ alias di="colordiff" alias devnullsmtp="java -jar $DOTBIN/DevNullSmtp.jar" alias open_ports="sudo lsof -i -P | grep --color=never -i \"listen\"" -# Ansible -alias ap="ansible-playbook" -alias av="ansible-vault" - # Flush DNS cache alias flush_dns="dscacheutil -flushcache" diff --git a/zsh/python.zsh b/zsh/python.zsh new file mode 100644 index 0000000..46665e8 --- /dev/null +++ b/zsh/python.zsh @@ -0,0 +1,25 @@ +# +# Python environment setup +# + +install_python_global_packages () { + local packages=( + 'ansible' + 'molecule[docker]' + ) + + if (( $+commands[brew] )); then + brew list python >/dev/null || brew install python + fi + + local pipcmd="pip" + if (( $+commands[pip3] )); then; pipcmd="pip3"; fi + + $pipcmd install --upgrade setuptools + $pipcmd install --upgrade "${packages[@]}" +} + +# Aliases +alias ap="ansible-playbook" +alias av="ansible-vault" +alias mo="molecule" diff --git a/zshrc.zsh b/zshrc.zsh index ef7d875..8533952 100644 --- a/zshrc.zsh +++ b/zshrc.zsh @@ -124,6 +124,7 @@ source "$DOTZSH/golang.zsh" source "$DOTZSH/google-cloud.zsh" source "$DOTZSH/kubernetes.zsh" source "$DOTZSH/nodejs.zsh" +source "$DOTZSH/python.zsh" source "$DOTZSH/ruby.zsh" source "$DOTZSH/rust.zsh"