From 99d5e66a2596cff7d199502d5f7fc97c56be21f8 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Mon, 27 Jun 2022 09:38:46 -0400 Subject: [PATCH] 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. --- ansible/carbonbean.yaml | 19 +++++++++++++++++-- link/nix/zshrc | 13 +++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/ansible/carbonbean.yaml b/ansible/carbonbean.yaml index 457a809..bc871fb 100644 --- a/ansible/carbonbean.yaml +++ b/ansible/carbonbean.yaml @@ -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 diff --git a/link/nix/zshrc b/link/nix/zshrc index 806a4c5..2b8bbea 100644 --- a/link/nix/zshrc +++ b/link/nix/zshrc @@ -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"