Working on frand deployement

This commit is contained in:
2026-08-30 10:37:09 +00:00
parent 35a3bb9ad2
commit 612e2243c0
18 changed files with 261 additions and 308 deletions
+76
View File
@@ -0,0 +1,76 @@
---
- name: Install ZSH and required packages
ansible.builtin.package:
name:
- zsh
- tmux
- powerline
- git
- git-gui
state: present
update_cache: true
- name: Change default shell to ZSH
ansible.builtin.user:
name: "{{ user }}"
shell: /bin/zsh
- name: Check if oh-my-zsh is already installed
ansible.builtin.stat:
path: "/home/{{ user }}/.oh-my-zsh"
register: oh_my_zsh_stat
- name: Install oh-my-zsh
ansible.builtin.git:
repo: https://github.com/robbyrussell/oh-my-zsh.git
dest: "/home/{{ user }}/.oh-my-zsh"
depth: 1
when: not oh_my_zsh_stat.stat.exists
become: true
become_user: "{{ user }}"
- name: Install zsh-autosuggestions plugin
ansible.builtin.git:
repo: https://github.com/zsh-users/zsh-autosuggestions
dest: "/home/{{ user }}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
depth: 1
become: true
become_user: "{{ user }}"
- name: Install zsh-syntax-highlighting plugin
ansible.builtin.git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: "/home/{{ user }}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
depth: 1
become: true
become_user: "{{ user }}"
- name: Ensure .zshrc exists (copy template if needed)
ansible.builtin.copy:
src: "/home/{{ user }}/.oh-my-zsh/templates/zshrc.zsh-template"
dest: "/home/{{ user }}/.zshrc"
remote_src: true
force: false
owner: "{{ user }}"
group: "{{ user }}"
mode: "0644"
- name: Set ZSH theme to agnoster
ansible.builtin.replace:
path: "/home/{{ user }}/.zshrc"
regexp: 'ZSH_THEME="robbyrussell"'
replace: 'ZSH_THEME="agnoster"'
- name: Enable ZSH plugins
ansible.builtin.replace:
path: "/home/{{ user }}/.zshrc"
regexp: 'plugins=\(git\)'
replace: 'plugins=(git zsh-autosuggestions zsh-syntax-highlighting)'
- name: Add custom aliases to .zshrc
ansible.builtin.lineinfile:
path: "/home/{{ user }}/.zshrc"
line: "alias ls='ls --color=auto --indicator-style=slash --human-readable --format=long'"
create: true
owner: "{{ user }}"
group: "{{ user }}"