dotfiles/manjaro/arch_custom/roles (1)/manage_zsh/tasks/main.yml

100 lines
2.9 KiB
YAML

- name: Manage_zsh | Install required packages
community.general.pacman:
name:
- git
- zsh
- powerline
- fastfetch
- zsh-autosuggestions
- zsh-syntax-highlighting
- zsh-completions
# - zsh-transient-prompt
- fzf
state: present
- name: Clone zsh-transient-prompt
ansible.builtin.git:
repo: https://github.com/olets/zsh-transient-prompt.git
dest: "{{ ansible_env.HOME }}/.zsh/zsh-transient-prompt"
version: main
depth: 1
- name: Manage_zsh | Set ZSH as default shell
ansible.builtin.user:
name: "{{ user }}"
shell: /bin/zsh
# - name: Manage_zsh | Setup ZSH
# block:
# - name: Manage_zsh | Copy zsh setting file
# ansible.builtin.copy:
# src: .zshrc
# dest: "/home/{{ user }}/.zshrc"
# mode: '0644'
- name: Manage_zsh | Configure fastfetch motd
block:
- name: Manage_zsh | Become user for fastfetch script
become: true
become_user: "{{ user }}"
block:
- name: Manage_zsh | Create fastfetch script
ansible.builtin.copy:
dest: "/home/{{ user }}/.fastfetch.sh"
mode: '0755'
content: |
#!/bin/bash
if [[ $- == *i* && $TERM_PROGRAM != "vscode" && -z "$FASTFETCH_DISPLAYED" ]]; then
fastfetch
export FASTFETCH_DISPLAYED=1
fi
- name: Copy fastfetch configuration
ansible.builtin.copy:
src: config.jsonc
dest: "{{ ansible_env.HOME }}/.config/fastfetch/config.jsonc"
mode: '0644'
- name: Manage_zsh | Source fastfetch script in .zshrc
ansible.builtin.blockinfile:
path: "/home/{{ user }}/.zshrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK - Fastfetch"
block: |
# Run fastfetch
source ~/.fastfetch.sh
insertafter: "# {mark} ANSIBLE MANAGED BLOCK - Powerlevel10k instant prompt"
- name: Manage_zsh | Source fastfetch script in .zprofile
ansible.builtin.lineinfile:
path: "/home/{{ user }}/.zprofile"
line: 'source ~/.fastfetch.sh'
create: true
mode: '0664'
- name: Manage_zsh | Disable default MOTD
ansible.builtin.file:
path: /etc/motd
state: absent
- name: Manage_zsh | Disable login information in /etc/issue
ansible.builtin.copy:
content: ""
dest: /etc/issue
force: true
mode: '0644'
- name: Manage_zsh | Disable login information in /etc/issue.net
ansible.builtin.copy:
content: ""
dest: /etc/issue.net
force: true
mode: '0644'
- name: Include plugins tasks
ansible.builtin.include_tasks:
file: zsh-plugin.yml
- name: Include p10k tasks
ansible.builtin.include_tasks:
file: zsh-p10k.yml
when: USE_P10K