generalize zsh role to support darwin
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
---
|
||||
- name: Install zsh
|
||||
- name: Install zsh (Linux)
|
||||
ansible.builtin.package:
|
||||
name: zsh
|
||||
state: present
|
||||
when: not (zsh_os_darwin | bool)
|
||||
|
||||
- name: Install eza (better ls)
|
||||
- name: Install eza (Linux)
|
||||
ansible.builtin.package:
|
||||
name: eza
|
||||
state: present
|
||||
when: not (zsh_os_darwin | bool)
|
||||
|
||||
- name: Install eza (macOS)
|
||||
community.general.homebrew:
|
||||
name: eza
|
||||
state: present
|
||||
become: false
|
||||
when: zsh_os_darwin | bool
|
||||
|
||||
- name: Install alacritty terminfo
|
||||
ansible.builtin.include_tasks: alacritty-terminfo.yml
|
||||
when: not (zsh_os_darwin | bool)
|
||||
|
||||
- name: Install zsh plugins
|
||||
ansible.builtin.include_tasks: plugins.yml
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
ansible.builtin.file:
|
||||
path: "{{ zsh_plugins_path }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: users
|
||||
owner: "{{ zsh_plugins_owner }}"
|
||||
group: "{{ zsh_plugins_group }}"
|
||||
mode: "0755"
|
||||
|
||||
- name: Add a readme file to advice from where this comes
|
||||
@@ -14,8 +14,8 @@
|
||||
# zsh plugins
|
||||
Managed by Ansible
|
||||
mode: "0644"
|
||||
group: users
|
||||
owner: root
|
||||
group: "{{ zsh_plugins_group }}"
|
||||
owner: "{{ zsh_plugins_owner }}"
|
||||
|
||||
- name: "Git clone plugins"
|
||||
ansible.builtin.git:
|
||||
@@ -36,16 +36,24 @@
|
||||
dest: "{{ zsh_plugins_path }}/fzf-tab"
|
||||
version: master
|
||||
|
||||
- name: Install fzf package
|
||||
- name: Install fzf package (Linux)
|
||||
ansible.builtin.package:
|
||||
name: fzf
|
||||
state: present
|
||||
when: not (zsh_os_darwin | bool)
|
||||
|
||||
- name: Install fzf package (macOS)
|
||||
community.general.homebrew:
|
||||
name: fzf
|
||||
state: present
|
||||
become: false
|
||||
when: zsh_os_darwin | bool
|
||||
|
||||
- name: Assert plugins are available for any user
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
owner: root
|
||||
group: users
|
||||
owner: "{{ zsh_plugins_owner }}"
|
||||
group: "{{ zsh_plugins_group }}"
|
||||
mode: "0755"
|
||||
state: directory
|
||||
loop:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
src: zshenv.j2
|
||||
dest: "{{ zsh_home }}/.zshenv"
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Setup .zprofile (login banner)
|
||||
@@ -12,7 +12,7 @@
|
||||
src: zprofile.j2
|
||||
dest: "{{ zsh_home }}/.zprofile"
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Setup zsh base config
|
||||
@@ -20,7 +20,7 @@
|
||||
src: main.zshrc.j2
|
||||
dest: "{{ zsh_base_config }}"
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Setup .config/zsh directory
|
||||
@@ -28,7 +28,7 @@
|
||||
path: "{{ zsh_config_path }}"
|
||||
state: directory
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0700"
|
||||
|
||||
- name: Configure zsh config
|
||||
@@ -36,15 +36,15 @@
|
||||
src: zshrc.j2
|
||||
dest: "{{ zsh_config_file }}"
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Copy aliases
|
||||
ansible.builtin.copy:
|
||||
src: ./templates/aliases
|
||||
ansible.builtin.template:
|
||||
src: aliases.j2
|
||||
dest: "{{ zsh_config_path }}/aliases"
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Configure fzf-tab plugin
|
||||
@@ -56,18 +56,19 @@
|
||||
zstyle ':fzf-tab:*' group-colors ''
|
||||
zstyle ':fzf-tab:*' preview-contained-categories true
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Change default shell to zsh
|
||||
ansible.builtin.user:
|
||||
name: "{{ zsh_user }}"
|
||||
shell: /bin/zsh
|
||||
when: not (zsh_os_darwin | bool)
|
||||
|
||||
- name: Configure powerlevel10k theme
|
||||
ansible.builtin.copy:
|
||||
src: "./templates/{{ 'root.p10k.zsh' if zsh_user == 'root' else 'user.p10k.zsh' }}"
|
||||
dest: "{{ zsh_p10k_theme_config }}"
|
||||
owner: "{{ zsh_user }}"
|
||||
group: "{{ zsh_user }}"
|
||||
group: "{{ zsh_group }}"
|
||||
mode: "0600"
|
||||
|
||||
Reference in New Issue
Block a user