Install ansible via pip, adjust PATH on Linux zsh

Prior to this, Homebrew paths came before system ones and overrode
access to system python on Linux. The DEB version of Ansible also has a
bug preventing collections from being installed from Galaxy.
This commit is contained in:
Gene Liverman 2022-06-27 09:38:46 -04:00
parent 3462e96c1e
commit 99d5e66a25
No known key found for this signature in database
GPG key ID: 3AF83985B6C857C6
2 changed files with 26 additions and 6 deletions

View file

@ -99,7 +99,6 @@
state: latest
pkg:
- 1password
- ansible-lint
- bat
- boinc-manager
- boinctui
@ -231,7 +230,10 @@
- name: Python packages via pip
ansible.builtin.pip:
state: latest
name:
- ansible
- ansible-lint
- flake8
- name: Install packages from Homebrew
@ -273,8 +275,21 @@
dest: "{{ lookup('env', 'HOME') }}/.zshrc"
state: link
- name: Set shell to zsh
- name: Set shell to zsh and add to groups
become: true
ansible.builtin.user:
name: "{{ lookup('env', 'USER') }}"
shell: /usr/bin/zsh
append: true
groups:
- dialout
- name: Add passwordless sudo entries
become: true
jonellis.sudoers.sudoers:
name: "{{ lookup('env', 'USER') }}-no-password"
user: "{{ lookup('env', 'USER') }}"
nopassword: true
command:
- /usr/bin/systemctl restart pcscd
- /usr/bin/pkill -9 gpg-agent

View file

@ -24,7 +24,14 @@ if [[ $(uname) == 'Darwin' ]]; then
fi
elif [[ $(uname) == 'Linux' ]]; then
if [[ -e /home/linuxbrew/.linuxbrew/bin/brew ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Don't use the eval so that it doesn't override system python
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar"
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew"
export PATH="${PATH}:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}"
fi
fi
@ -237,9 +244,7 @@ if [[ `uname` == 'Darwin' ]]; then
export RUBYOPT='-W:no-deprecated -W:no-experimental'
fi
elif [[ `uname` == 'Linux' ]]; then
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
PATH="$HOME/.local/bin:$PATH"
if [ -d "$HOME/.local/share/gem/ruby/3.0.0/bin" ] ; then
PATH="$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH"