Files
skato-ansible/roles/init-server/tasks/contingent/pkg/vim.yml

56 lines
1.8 KiB
YAML

---
- name: Acquiring home of current user
when: ansible_facts["system"] == "Linux"
ansible.builtin.shell:
cmd: "echo ~{{ ansible_user }}"
register: ansible_user_home
- name: Acquiring current user
when: ansible_facts["system"] == "Linux"
ansible.builtin.shell:
cmd: "echo {{ ansible_user }}"
register: current_user
- name: Preparing to create a directory structure for ViM paths
become: true
become_user: "{{ current_user.stdout }}"
block:
- name: Creating directory structure for ViM paths
ansible.builtin.file:
path: "{{ ansible_user_home.stdout }}/.vim/{{ item }}"
recurse: true
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "755"
state: directory
loop:
- autoload
- backup
- colors
- plugged
- name: Pulling and integrating ViM plugin manager
become: true
become_user: "{{ current_user.stdout }}"
ansible.builtin.uri:
url: "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
dest: "{{ ansible_user_home.stdout }}/.vim/autoload/plug.vim"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
force: true
mode: "644"
follow_redirects: safe
- name: Configuring ViM
become: true
become_user: "{{ current_user.stdout }}"
ansible.builtin.template:
src: user/vimrc.j2
dest: "{{ ansible_user_home.stdout }}/.vimrc"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
force: true
backup: true
- name: Informing user of need to manually run PlugInstall in ViM
ansible.builtin.debug:
msg: "Make sure to run \":PlugInstall\" the first time you open/use ViM"
- name: Pausing to ensure user has read message about needed manual PlugInstall execution for ViM
ansible.builtin.pause:
seconds: 30