Files
ansible-repo/playbooks/software/zsh/user_tasks.yml
hogweed1 9efa940586
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 0s
well,
2026-11-05 03:02:11 +10:00

155 lines
6.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
# - name: "[{{ current_user }}] Получаем домашнюю директорию"
# getent:
# database: passwd
# key: "{{ current_user }}"
# tags: [always]
- name: "[{{ current_user }}] Фиксируем переменную user_home"
set_fact:
#user_home: "{{ getent_passwd[current_user] }}"
user_home: "{{ '/root' if current_user == 'root' else '/home/' ~ current_user }}"
tags: [always]
- name: "[{{ current_user }}] Меняем дефолтный shell на /bin/zsh"
user:
name: "{{ current_user }}"
shell: /bin/zsh
tags: [deploy]
# 0e2d23940d1862ae1558476f39565cd5bb2bcd88
# ansible-stuff token gitea
# ==========================================
# БЛОК 1: ПЕРВИЧНАЯ РАСКАТКА (БЫСТРЫЙ CLONE)
# ==========================================
- name: "Первичный деплой репозиториев"
block:
- name: "[{{ current_user }}] Клонируем Oh My Zsh"
git:
#repo: 'https://github.com/ohmyzsh/ohmyzsh.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/ohmyzsh_mirror.git'
repo: "{{ repo_omz }}"
dest: "{{ user_home }}/.oh-my-zsh"
depth: 1
update: no
#become_user: "{{ current_user }}"
#tags: [deploy]
- name: "[{{ current_user }}] Клонируем плагин zsh-syntax-highlighting"
git:
#repo: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/zsh-syntax-highlighting_mirror.git'
repo: "{{ repo_syntax }}"
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
depth: 1
update: no
#become_user: "{{ current_user }}"
#tags: [deploy]
- name: "[{{ current_user }}] Клонируем плагин zsh-autosuggestions"
git:
#repo: 'https://github.com/zsh-users/zsh-autosuggestions.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/zsh-autosuggestions_mirror.git'
repo: "{{ repo_suggest }}"
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
depth: 1
update: no
#become_user: "{{ current_user }}"
#tags: [deploy]
- name: "[{{ current_user }}] Клонируем тему Powerlevel10k"
git:
#repo: 'https://github.com/romkatv/powerlevel10k.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/powerlevel10k_mirror.git'
repo: "{{ repo_p10k }}"
dest: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k"
depth: 1
update: no
become_user: "{{ current_user }}"
tags: [deploy]
# ==========================================
# БЛОК 2: ОБНОВЛЕНИЕ ДО ПОСЛЕДНИХ ВЕРСИЙ (GIT PULL)
# ==========================================
- name: "Обновление репозиториев"
block:
- name: "[{{ current_user }}] Обновляем Oh My Zsh до latest"
git:
#repo: 'https://github.com/ohmyzsh/ohmyzsh.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/ohmyzsh_mirror.git'
repo: "{{ repo_omz }}"
dest: "{{ user_home }}/.oh-my-zsh"
update: yes
#become_user: "{{ current_user }}"
#tags: [update]
- name: "[{{ current_user }}] Обновляем плагин zsh-syntax-highlighting до latest"
git:
#repo: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/zsh-syntax-highlighting_mirror.git'
repo: "{{ repo_syntax }}"
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
update: yes
#become_user: "{{ current_user }}"
#tags: [update]
- name: "[{{ current_user }}] Обновляем плагин zsh-autosuggestions до latest"
git:
#repo: 'https://github.com/zsh-users/zsh-autosuggestions.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/zsh-autosuggestions_mirror.git'
repo: "{{ repo_suggest }}"
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
update: yes
#become_user: "{{ current_user }}"
#tags: [update]
- name: "[{{ current_user }}] Обновляем тему Powerlevel10k до latest"
git:
#repo: 'https://github.com/romkatv/powerlevel10k.git'
#repo: 'https://git.guaranteedstruggle.host/hackerspace/powerlevel10k_mirror.git'
repo: "{{ repo_p10k }}"
dest: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k"
update: yes
become_user: "{{ current_user }}"
tags: [update]
# ==========================================
# БЛОК 3: НАСТРОЙКА КОНФИГУРАЦИОННЫХ ФАЙЛОВ
# ==========================================
- name: "Финализация конфигурации"
block:
- name: "[{{ current_user }}] Копируем эталонный конфиг .p10k.zsh"
copy:
src: ../../../files/.p10k.zsh
dest: "{{ user_home }}/.p10k.zsh"
owner: "{{ current_user }}"
group: "{{ current_user }}"
mode: '0644'
#tags: [deploy, update] # Обновляем конфиг p10k в обоих сценариях, если ты решишь его изменить локально
- name: "[{{ current_user }}] Генерируем итоговый .zshrc из шаблона"
template:
src: ../../../templates/.zshrc.j2
dest: "{{ user_home }}/.zshrc"
owner: "{{ current_user }}"
group: "{{ current_user }}"
mode: '0644'
#tags: [deploy, update]
- name: "[{{ current_user }}] Копируем эталонный файлик с упрощённым скачиванием"
copy:
src: ../../../files/gitstatus_install
dest: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/install"
owner: "{{ current_user }}"
group: "{{ current_user }}"
mode: '0755'
- name: "[{{ current_user }}] Предзагрузка бинарника gitstatusd (убирает тормоза при первом входе)"
command: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/install"
args:
creates: "{{ user_home }}/.cache/gitstatus/gitstatusd-linux-x86_64" # таска пропустится, если бинарник уже на месте
become_user: "{{ current_user }}"
tags: [deploy, update]