This commit is contained in:
36
playbooks/software/vim/deploy_vim.yml
Normal file
36
playbooks/software/vim/deploy_vim.yml
Normal file
@@ -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]
|
||||
87
playbooks/software/vim/user_tasks.yml
Normal file
87
playbooks/software/vim/user_tasks.yml
Normal file
@@ -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]
|
||||
@@ -1,2 +0,0 @@
|
||||
---
|
||||
- name: get it
|
||||
Reference in New Issue
Block a user