56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
---
|
|
- name: Set target user variable
|
|
ansible.builtin.set_fact:
|
|
shell_target_user: "{{ ansible_user | default(ansible_user_id) }}"
|
|
|
|
- name: Install shell packages
|
|
ansible.builtin.apt:
|
|
name:
|
|
- zsh
|
|
- tmux
|
|
- fzf
|
|
state: present
|
|
|
|
- name: Install zsh plugins
|
|
ansible.builtin.git:
|
|
repo: "{{ item.repo }}"
|
|
dest: "/home/{{ shell_target_user }}/.oh-my-zsh/custom/plugins/{{ item.name }}"
|
|
version: master
|
|
depth: 1
|
|
update: false
|
|
become: true
|
|
become_user: "{{ shell_target_user }}"
|
|
loop:
|
|
- { name: "zsh-syntax-highlighting", repo: "https://github.com/zsh-users/zsh-syntax-highlighting.git" }
|
|
- { name: "zsh-autosuggestions", repo: "https://github.com/zsh-users/zsh-autosuggestions.git" }
|
|
|
|
- name: Set zsh as default shell for user
|
|
ansible.builtin.user:
|
|
name: "{{ shell_target_user }}"
|
|
shell: /usr/bin/zsh
|
|
|
|
- name: Install Oh My Zsh for user
|
|
become: true
|
|
become_user: "{{ shell_target_user }}"
|
|
ansible.builtin.shell: sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" "" --unattended
|
|
args:
|
|
creates: "/home/{{ shell_target_user }}/.oh-my-zsh"
|
|
|
|
- name: Clone Powerlevel10k theme
|
|
ansible.builtin.git:
|
|
repo: https://github.com/romkatv/powerlevel10k.git
|
|
dest: "/home/{{ shell_target_user }}/.oh-my-zsh/custom/themes/powerlevel10k"
|
|
version: master
|
|
depth: 1
|
|
update: false
|
|
become: true
|
|
become_user: "{{ shell_target_user }}"
|
|
|
|
- name: Deploy .zshrc for user
|
|
ansible.builtin.copy:
|
|
src: files/.zshrc
|
|
dest: "/home/{{ shell_target_user }}/.zshrc"
|
|
owner: "{{ shell_target_user }}"
|
|
group: "{{ shell_target_user }}"
|
|
mode: '0644'
|