ansible-zsh-chic/tasks/main.yml

72 lines
1.9 KiB
YAML

---
- name: Ensure zsh is present
apt:
name:
- zsh
- tmux
- fzf
- curl
- git
- fasd
- ripgrep
state: present
- name: Obtain bat .deb package
get_url:
url: "https://github.com/sharkdp/bat/releases/download/v{{ zsh_chic_bat_version }}/bat_{{ zsh_chic_bat_version }}_{{ zsh_chic_arch }}.deb"
dest: "/tmp/bat_{{ zsh_chic_bat_version }}_amd64.deb"
owner: root
group: root
mode: 0755
register: new_bat_deb
- name: Install bat
shell: "dpkg -i /tmp/bat_{{ zsh_chic_bat_version }}_amd64.deb"
when: new_bat_deb is defined and new_bat_deb.changed
- include_tasks: antibody.yml
- include_tasks: starship_x64.yml
when: zsh_chic_arch == 'amd64'
- include_tasks: starship_arm.yml
when: false # There is no binary for arm
- include_tasks: powerline.yml
- name: Clone fzf repo to get completion and keybindings
git:
repo: 'https://github.com/junegunn/fzf'
dest: /opt/fzf
- name: Install zshrc template for each provided user
template:
src: templates/zshrc.j2
dest: "{{ item.home }}/.zshrc"
owner: "{{ item.username }}"
group: "{{ item.group|default(item.username) }}"
mode: 0644
vars:
antibody: "{{ item.antibody|default(false) }}"
starship: "{{ item.starship|default(false) }}"
powerline: "{{ item.powerline|default(false) }}"
locale: "{{ item.locale|default('en_US.UTF-8') }}"
term: "{{ item.term|default(None) }}"
with_items: "{{ zsh_chic.users }}"
- name: Set zsh as default shell for each provided user
user:
name: "{{ item.username }}"
shell: /bin/zsh
with_items: "{{ zsh_chic.users }}"
- name: Copy starship config for use who use it
copy:
src: files/starship.toml
dest: "{{ item.home }}/.starship.toml"
owner: "{{ item.username }}"
group: "{{ item.group|default(item.username) }}"
mode: 0644
when: item.starship is defined and item.starship
with_items: "{{ zsh_chic.users }}"