From 7329a84c27e500494799e732e5b7aab012356d71 Mon Sep 17 00:00:00 2001 From: hogweed1 Date: Fri, 6 Nov 2026 00:48:45 +1000 Subject: [PATCH] well, --- environments/proxmoxes/hosts.yml | 2 +- files/.vimrc | 53 ++++++++++++++++ playbooks/software/vim/deploy_vim.yml | 36 +++++++++++ playbooks/software/vim/user_tasks.yml | 87 +++++++++++++++++++++++++++ playbooks/vim.yml | 2 - 5 files changed, 177 insertions(+), 3 deletions(-) create mode 100644 files/.vimrc create mode 100644 playbooks/software/vim/deploy_vim.yml create mode 100644 playbooks/software/vim/user_tasks.yml delete mode 100644 playbooks/vim.yml diff --git a/environments/proxmoxes/hosts.yml b/environments/proxmoxes/hosts.yml index dd0792e..0837808 100644 --- a/environments/proxmoxes/hosts.yml +++ b/environments/proxmoxes/hosts.yml @@ -49,7 +49,7 @@ vms: #### TODO lxc: hosts: - + ## TODO :: а где ns?? 192.168.0.110: atuin.guaranteedstruggle.host: diff --git a/files/.vimrc b/files/.vimrc new file mode 100644 index 0000000..7da7271 --- /dev/null +++ b/files/.vimrc @@ -0,0 +1,53 @@ +set nocompatible +set path+=** +set wildmenu + + +set expandtab +set shiftwidth=4 + +set hlsearch +set nu +set rnu + +"Map key to comma +let mapleader = ',' + +"map F3 to toggle line-numbers +nmap :set nu! + +""map F3 to toggle line-numbers +nmap :set rnu! +nmap :set rnu! + + +"map F3 to toggle line-numbers in INSET mode +imap :set nu! i + +""map F4 to toggle line-numbers in INSERT +imap :set rnu! i + + +set t_Co=256 + +" Enable filetype detection, plugins, and custom indentation +filetype plugin indent on + +" Turn on syntax highlighting +syntax enable + + +" --- New Color Scheme Settings --- +" Enable 24-bit True Color (crucial for modern color schemes) +"if (has("termguicolors")) +" set termguicolors +"endif + +" Set the background style (dark or light) +set background=dark + +" Load the cloned theme +"let g:gruvbox_contrast_dark = 'hard' +"colorscheme gruvbox +colorscheme challenger_deep +"colorscheme dogrun \ No newline at end of file diff --git a/playbooks/software/vim/deploy_vim.yml b/playbooks/software/vim/deploy_vim.yml new file mode 100644 index 0000000..1f7fa85 --- /dev/null +++ b/playbooks/software/vim/deploy_vim.yml @@ -0,0 +1,36 @@ +--- +- name: "Этап 2: Деплой VIM plugins" + hosts: all + become: yes + vars: + # Укажи здесь root и своего основного пользователя + vim_users: + - "root" + - "hogweed1" + + # Вставь сюда сгенерированный токен из Gitea + gitea_token: "0e2d23940d1862ae1558476f39565cd5bb2bcd88" + + # Базовый адрес твоей организации/юзера в Gitea (БЕЗ http://) + gitea_base: "git.guaranteedstruggle.host/hackerspace" + + # Формируем ссылки с токеном. В таком формате Git пролетает авторизацию без вопросов + repo_rustvim: "https://{{ gitea_token }}@{{ gitea_base }}/rust.vim_mirror.git" + repo_tomlvim: "https://{{ gitea_token }}@{{ gitea_base }}/vim-toml_mirror.git" + repo_challengerdeep: "https://{{ gitea_token }}@{{ gitea_base }}/vim_theme-challenger-deep_mirror.git" + + tasks: + - name: Установка пакета vim + apt: + name: + - vim + state: present + update_cache: yes + tags: [always] + + - name: Накат ZSH и плагинов для каждого пользователя + include_tasks: user_tasks.yml + loop: "{{ vim_users }}" + loop_control: + loop_var: current_user + tags: [always] diff --git a/playbooks/software/vim/user_tasks.yml b/playbooks/software/vim/user_tasks.yml new file mode 100644 index 0000000..fe4721a --- /dev/null +++ b/playbooks/software/vim/user_tasks.yml @@ -0,0 +1,87 @@ +--- +- 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: Creates directory + ansible.builtin.file: + path: "{{ user_home }}/.vim/pack/plugins/start" + state: directory + group: "{{current_user}}" + owner: "{{current_user}}" + +# 0e2d23940d1862ae1558476f39565cd5bb2bcd88 +# ansible-stuff token gitea + + +# ========================================== +# БЛОК 3: НАСТРОЙКА КОНФИГУРАЦИОННЫХ ФАЙЛОВ +# ========================================== +- name: "Финализация конфигурации" + block: + - name: "[{{ current_user }}] Копируем эталонный файл настроек" + copy: + src: ../../../files/.vimrc + dest: "{{ user_home }}/.vimrc" + owner: "{{ current_user }}" + group: "{{ current_user }}" + mode: '0655' + become_user: "{{ current_user }}" + tags: [deploy, update] + + +# ========================================== +# БЛОК 1: ПЕРВИЧНАЯ РАСКАТКА (БЫСТРЫЙ CLONE) +# ========================================== +- name: "Первичный деплой репозиториев" + block: + - name: "[{{ current_user }}] Клонируем плагин rust-vim" + git: + repo: "{{ repo_rustvim }}" + dest: "{{ user_home }}/.vim/pack/plugins/start/rust.vim" + depth: 1 + update: no + + - name: "[{{ current_user }}] Клонируем плагин vim-toml" + git: + repo: "{{ repo_tomlvim }}" + dest: "{{ user_home }}/.vim/pack/plugins/start/vim-toml" + depth: 1 + update: no + + - name: "[{{ current_user }}] Клонируем тему challengerdeep" + git: + repo: "{{ repo_challengerdeep }}" + dest: "{{ user_home }}/.vim/pack/plugins/start/challenger-deep" + depth: 1 + update: no + become_user: "{{ current_user }}" + tags: [deploy] + +# ========================================== +# БЛОК 2: ОБНОВЛЕНИЕ ДО ПОСЛЕДНИХ ВЕРСИЙ (GIT PULL) +# ========================================== + +- name: "Обновление репозиториев" + block: + - name: "[{{ current_user }}] Обновляем плагин rust-vim до latest" + git: + repo: "{{ repo_rustvim }}" + dest: "{{ user_home }}/.vim/pack/plugins/start/rust.vim" + update: yes + + - name: "[{{ current_user }}] Обновляем плагин vim-toml до latest" + git: + repo: "{{ repo_tomlvim }}" + dest: "{{ user_home }}/.vim/pack/plugins/start/vim-toml" + update: yes + + - name: "[{{ current_user }}] Обновляем тему challengerdeep до latest" + git: + repo: "{{ repo_challengerdeep }}" + dest: "{{ user_home }}/.vim/pack/plugins/start/challenger-deep" + update: yes + become_user: "{{ current_user }}" + tags: [update] diff --git a/playbooks/vim.yml b/playbooks/vim.yml deleted file mode 100644 index d2be56f..0000000 --- a/playbooks/vim.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- name: get it \ No newline at end of file