well,
This commit is contained in:
1669
files/.p10k.zsh
1669
files/.p10k.zsh
File diff suppressed because it is too large
Load Diff
24
playbooks/software/zsh/deploy_zsh.yml
Normal file
24
playbooks/software/zsh/deploy_zsh.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
- name: "Этап 2: Деплой ZSH + OMZ + P10k"
|
||||||
|
hosts: homelab
|
||||||
|
become: yes
|
||||||
|
vars:
|
||||||
|
# Укажи здесь root и своего основного пользователя
|
||||||
|
zsh_users:
|
||||||
|
- "root"
|
||||||
|
- "hogweed1"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Установка системных пакетов (zsh и git)
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- zsh
|
||||||
|
- git
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Накат ZSH и плагинов для каждого пользователя
|
||||||
|
include_tasks: user_tasks.yml
|
||||||
|
loop: "{{ zsh_users }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: current_user
|
||||||
115
playbooks/software/zsh/user_tasks.yml
Normal file
115
playbooks/software/zsh/user_tasks.yml
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
---
|
||||||
|
- name: "[{{ current_user }}] Получаем домашнюю директорию"
|
||||||
|
getent:
|
||||||
|
database: passwd
|
||||||
|
key: "{{ current_user }}"
|
||||||
|
tags: [always]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Фиксируем переменную user_home"
|
||||||
|
set_fact:
|
||||||
|
user_home: "{{ getent_passwd[current_user] }}"
|
||||||
|
tags: [always]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Меняем дефолтный shell на /bin/zsh"
|
||||||
|
user:
|
||||||
|
name: "{{ current_user }}"
|
||||||
|
shell: /bin/zsh
|
||||||
|
tags: [deploy]
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# БЛОК 1: ПЕРВИЧНАЯ РАСКАТКА (БЫСТРЫЙ CLONE)
|
||||||
|
# ==========================================
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Клонируем Oh My Zsh"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/ohmyzsh/ohmyzsh.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh"
|
||||||
|
depth: 1
|
||||||
|
state: present
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [deploy]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Клонируем плагин zsh-syntax-highlighting"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
|
||||||
|
depth: 1
|
||||||
|
state: present
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [deploy]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Клонируем плагин zsh-autosuggestions"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/zsh-users/zsh-autosuggestions.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
|
||||||
|
depth: 1
|
||||||
|
state: present
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [deploy]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Клонируем тему Powerlevel10k"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/romkatv/powerlevel10k.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k"
|
||||||
|
depth: 1
|
||||||
|
state: present
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [deploy]
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# БЛОК 2: ОБНОВЛЕНИЕ ДО ПОСЛЕДНИХ ВЕРСИЙ (GIT PULL)
|
||||||
|
# ==========================================
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Обновляем Oh My Zsh до latest"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/ohmyzsh/ohmyzsh.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh"
|
||||||
|
state: latest
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [update]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Обновляем плагин zsh-syntax-highlighting до latest"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
|
||||||
|
state: latest
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [update]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Обновляем плагин zsh-autosuggestions до latest"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/zsh-users/zsh-autosuggestions.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
|
||||||
|
state: latest
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [update]
|
||||||
|
|
||||||
|
- name: "[{{ current_user }}] Обновляем тему Powerlevel10k до latest"
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/romkatv/powerlevel10k.git'
|
||||||
|
dest: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k"
|
||||||
|
state: latest
|
||||||
|
become_user: "{{ current_user }}"
|
||||||
|
tags: [update]
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# БЛОК 3: НАСТРОЙКА КОНФИГУРАЦИОННЫХ ФАЙЛОВ
|
||||||
|
# ==========================================
|
||||||
|
|
||||||
|
- 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]
|
||||||
@@ -6,7 +6,8 @@
|
|||||||
- name: make-me
|
- name: make-me
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: hogweed1
|
name: hogweed1
|
||||||
shell: /bin/bash
|
#shell: /bin/bash
|
||||||
|
shell: /bin/zsh # алсо, накидка вынесена в software/zsh/*
|
||||||
create_home: yes
|
create_home: yes
|
||||||
# python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")'
|
# python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")'
|
||||||
password: $6$KHOI$0Dq28VBwgtNFvfbQQ.4s6koctN6e5ZWRRBhWp0lkKKiel8y2qhc89E0CY479b4EX5.CnfDhS8rlaOATk/rXLu0
|
password: $6$KHOI$0Dq28VBwgtNFvfbQQ.4s6koctN6e5ZWRRBhWp0lkKKiel8y2qhc89E0CY479b4EX5.CnfDhS8rlaOATk/rXLu0
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Настройка ZSH + Oh My Zsh + Powerlevel10k
|
|
||||||
hosts: homelab
|
|
||||||
become: yes
|
|
||||||
vars:
|
|
||||||
username: "твой_юзер" # укажи пользователя, под которым работаешь
|
|
||||||
user_home: "/home/{{ username }}"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: Установка zsh и git
|
|
||||||
apt:
|
|
||||||
name:
|
|
||||||
- zsh
|
|
||||||
- git
|
|
||||||
state: present
|
|
||||||
update_cache: yes
|
|
||||||
|
|
||||||
- name: Изменение дефолтной оболочки пользователя на ZSH
|
|
||||||
user:
|
|
||||||
name: "{{ username }}"
|
|
||||||
shell: /bin/zsh
|
|
||||||
|
|
||||||
- name: Клонирование Oh My Zsh
|
|
||||||
git:
|
|
||||||
repo: 'https://github.com'
|
|
||||||
dest: "{{ user_home }}/.oh-my-zsh"
|
|
||||||
depth: 1
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
|
|
||||||
- name: Клонирование темы Powerlevel10k
|
|
||||||
git:
|
|
||||||
repo: 'https://github.com'
|
|
||||||
dest: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k"
|
|
||||||
depth: 1
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
|
|
||||||
- name: Копирование эталонного конфига .p10k.zsh
|
|
||||||
copy:
|
|
||||||
src: files/.p10k.zsh
|
|
||||||
dest: "{{ user_home }}/.p10k.zsh"
|
|
||||||
owner: "{{ username }}"
|
|
||||||
group: "{{ username }}"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Копирование настроенного .zshrc
|
|
||||||
template:
|
|
||||||
src: templates/.zshrc.j2
|
|
||||||
dest: "{{ user_home }}/.zshrc"
|
|
||||||
owner: "{{ username }}"
|
|
||||||
group: "{{ username }}"
|
|
||||||
mode: '0644'
|
|
||||||
Reference in New Issue
Block a user