Skip to content

Commit

Permalink
fix: Setting correct zsh path on macos.
Browse files Browse the repository at this point in the history
  • Loading branch information
TechDufus committed Sep 13, 2024
1 parent f1401d5 commit 20f408e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
18 changes: 11 additions & 7 deletions bin/dotfiles
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set -e

# Paths
VAULT_SECRET_FILE="$HOME/.ansible-vault/vault.secret"
OP_INSTALLED=false
OP_VAULT_SECRET=""
ID=""
DOTFILES_LOG="$HOME/.dotfiles.log"
Expand Down Expand Up @@ -186,13 +187,7 @@ update_ansible_galaxy() {
function use_op_vault_if_possible() {
__task "Checking for 1Password CLI"
if op --version >/dev/null 2>&1; then
OP_VAULT_SECRET="$(op read 'op://Personal/Ansible Vault/password')"
if [[ -n $OP_VAULT_SECRET ]]; then
printf "${OVERWRITE}${LGREEN} [✓] ${LGREEN}Using vault secret from 1Password${NC}\n"
rm -f $VAULT_SECRET_FILE
else
printf "${OVERWRITE}${LRED} [X] ${LRED}No vault secret found in 1Password${NC}\n"
fi
OP_INSTALLED=true
fi
}

Expand Down Expand Up @@ -244,6 +239,15 @@ update_ansible_galaxy $ID
use_op_vault_if_possible

__task "Running playbook ☕"; _task_done
if [[ -n $OP_INSTALLED ]]; then
OP_VAULT_SECRET="$(op read 'op://Personal/Ansible Vault/password')"
if [[ -n $OP_VAULT_SECRET ]]; then
printf "${OVERWRITE}${LGREEN} [✓] ${LGREEN}Using vault secret from 1Password${NC}\n"
rm -f $VAULT_SECRET_FILE
else
printf "${OVERWRITE}${LRED} [X] ${LRED}No vault secret found in 1Password${NC}\n"
fi
fi
if [[ -f $VAULT_SECRET_FILE ]]; then
printf "${OVERWRITE}${LGREEN} [✓] ${LGREEN}Running playbook with vault secret ☕${NC}\n"
ansible-playbook --vault-password-file $VAULT_SECRET_FILE "$DOTFILES_DIR/main.yml" "$@"
Expand Down
1 change: 1 addition & 0 deletions roles/zsh/files/.zprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion roles/zsh/tasks/MacOSX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
- name: "Zsh | Set default terminal"
ansible.builtin.user:
name: "{{ host_user }}"
shell: /bin/zsh
shell: /usr/local/bin/zsh
become: true

0 comments on commit 20f408e

Please sign in to comment.