From 473f8e2d39e4265efb767f3b3a62804715558a71 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Mon, 3 Feb 2025 22:14:05 +0100 Subject: [PATCH] install and configure zsh --- group_vars/debian.yml | 3 +++ playbook.yml | 5 ++++- tasks/zsh.yml | 41 +++++++++++++++++++++++++++++++++++++++++ tasks/zsh/.aliasrc | 3 +++ tasks/zsh/.zshenv | 2 ++ tasks/zsh/.zshrc | 10 ++++++++++ 6 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tasks/zsh.yml create mode 100644 tasks/zsh/.aliasrc create mode 100644 tasks/zsh/.zshenv create mode 100644 tasks/zsh/.zshrc diff --git a/group_vars/debian.yml b/group_vars/debian.yml index c327fd7..eb2bac5 100644 --- a/group_vars/debian.yml +++ b/group_vars/debian.yml @@ -9,4 +9,7 @@ common_packages: - sudo - btop - kitty-terminfo + - zsh + - zsh-syntax-highlighting + - fzf host_packages: diff --git a/playbook.yml b/playbook.yml index 971692e..f9f0fc8 100644 --- a/playbook.yml +++ b/playbook.yml @@ -55,6 +55,8 @@ include_tasks: tasks/install_docker_debian.yml - name: Add utility scripts hosts: all +- name: Setup zsh + hosts: debian become: true remote_user: nerevar tasks: @@ -64,8 +66,9 @@ vars_files: - vault/nocturnal.yml become: true + remote_user: nerevar tasks: - - import_tasks: tasks/nocturnal_smb.yml + - import_tasks: tasks/zsh.yml - name: Install tmux hosts: all become: true diff --git a/tasks/zsh.yml b/tasks/zsh.yml new file mode 100644 index 0000000..26ef04b --- /dev/null +++ b/tasks/zsh.yml @@ -0,0 +1,41 @@ +- name: Install zsh + apt: + name: + - zsh + - zsh-syntax-highlighting + - fzf + state: present +- name: Create .config/zsh directory + file: + path: "/home/{{ item }}/.config/zsh" + state: directory + mode: "0755" + loop: "{{ users }}" + when: users is defined +- name: Copy .zshenv + copy: + src: zsh/.zshenv + dest: "/home/{{ item }}/.zshenv" + mode: "0644" + loop: "{{ users }}" + when: users is defined +- name: Copy .zshrc + copy: + src: zsh/.zshrc + dest: "/home/{{ item }}/.config/zsh/.zshrc" + mode: "0644" + loop: "{{ users }}" + when: users is defined +- name: Copy .aliasrc + copy: + src: zsh/.aliasrc + dest: "/home/{{ item }}/.config/zsh/.aliasrc" + mode: "0644" + loop: "{{ users }}" + when: users is defined +- name: Set zsh as default shell + user: + name: "{{ item }}" + shell: /bin/zsh + loop: "{{ users }}" + when: users is defined diff --git a/tasks/zsh/.aliasrc b/tasks/zsh/.aliasrc new file mode 100644 index 0000000..f62540e --- /dev/null +++ b/tasks/zsh/.aliasrc @@ -0,0 +1,3 @@ +alias s="sudo systemctl" \ + ss="sudo systemctl start" \ + pls="sudo" diff --git a/tasks/zsh/.zshenv b/tasks/zsh/.zshenv new file mode 100644 index 0000000..4d2b4ee --- /dev/null +++ b/tasks/zsh/.zshenv @@ -0,0 +1,2 @@ +ZDOTDIR=$HOME/.config/zsh +ZSH_CUSTOM=$HOME/.config/zsh/custom diff --git a/tasks/zsh/.zshrc b/tasks/zsh/.zshrc new file mode 100644 index 0000000..1adf650 --- /dev/null +++ b/tasks/zsh/.zshrc @@ -0,0 +1,10 @@ +autoload -Uz compinit promptinit +zstyle ':completion::complete:*' gain-privileges 1 +autoload -U colors && colors +compinit +promptinit + +source ~/.config/zsh/.aliasrc + +# This will set the default prompt to the walters theme +prompt walters