Revise vim tasks.

This commit is contained in:
Brian Lee 2023-11-09 06:41:01 -08:00
parent 6770baf7f9
commit 515728d3b7
6 changed files with 30 additions and 80 deletions

View File

@ -1,5 +1,15 @@
--- ---
- import_tasks: vim-Debian.yml - import_tasks: vim.yml
- name: Ensure vim will source a global configuration file
ansible.builtin.blockinfile:
path: /etc/vimrc
marker: '" {mark} ANSIBLE MANAGED BLOCK'
block: |
set runtimepath+=/var/lib/vim/addons
if filereadable("/etc/vimrc.local")
source /etc/vimrc.local
endif
- name: Ensure Debian sources .bash_aliases - name: Ensure Debian sources .bash_aliases
ansible.builtin.lineinfile: ansible.builtin.lineinfile:

View File

@ -1,32 +1,22 @@
--- ---
- import_tasks: vim.yml - import_tasks: vim.yml
when: ansible_os_family != 'Debian'
#- name: Ensure Arch Linux sources bash_aliases
# lineinfile:
# path: /root/.bashrc
# # regexp: '\.bash_aliases'
# line: '[ -f ~/.bash_aliases ] && source ~/.bash_aliases'
# create: yes
# when: ansible_os_family == 'Archlinux'
- name: Copy shell configuration - name: Copy shell configuration
ansible.builtin.copy: ansible.builtin.copy:
src: inputrc src: inputrc
dest: "{{ item }}/.inputrc" dest: "{{ dotfile_path }}/.inputrc"
loop_control:
loop_var: dotfile_path
loop: loop:
- /etc/skel - /etc/skel
- /root - /root
- "{{ ansible_env.HOME }}/" - "{{ ansible_env.PWD }}/"
#- name: Copy bash aliases - name: Install global bash aliases
# ansible.builtin.copy: ansible.builtin.copy:
# src: bash_aliases src: bash_aliases
# dest: "{{ item }}/.bash_aliases" dest: /etc/profile.d/zz_aliases.sh
# loop: mode: '0755'
# - /etc/skel
# - /root
# - "{{ ansible_env.HOME }}/"
#- name: Add root bashrc shell history configuration #- name: Add root bashrc shell history configuration
# lineinfile: # lineinfile:

View File

@ -1,6 +1,16 @@
--- ---
- import_tasks: vim-Debian.yml - import_tasks: vim-Debian.yml
- name: Ensure vim will source a global configuration file
ansible.builtin.blockinfile:
path: /etc/vimrc
marker: '" {mark} ANSIBLE MANAGED BLOCK'
block: |
set runtimepath+=/var/lib/vim/addons
if filereadable("/etc/vimrc.local")
source /etc/vimrc.local
endif
- name: Copy shell configuration - name: Copy shell configuration
ansible.builtin.copy: ansible.builtin.copy:
src: inputrc src: inputrc

View File

@ -1,24 +1,5 @@
--- ---
- import_tasks: vim-Debian.yml
when: ansible_os_family == 'Debian'
- import_tasks: vim.yml - import_tasks: vim.yml
when: ansible_os_family != 'Debian'
- name: Ensure Arch Linux sources bash_aliases
lineinfile:
path: /root/.bashrc
# regexp: '\.bash_aliases'
line: '[ -f ~/.bash_aliases ] && source ~/.bash_aliases'
create: yes
when: ansible_os_family == 'Archlinux'
- name: Ensure Debian sources .bash_aliases
ansible.builtin.lineinfile:
path: /root/.bashrc
# regexp: '\.bash_aliases'
line: 'source ~/.bash_aliases'
when: ansible_distribution == 'Debian' # Not Ubuntu, which should already have this
- name: Copy shell configuration - name: Copy shell configuration
ansible.builtin.copy: ansible.builtin.copy:
@ -45,21 +26,6 @@
line: 'HISTCONTROL=ignoreboth' line: 'HISTCONTROL=ignoreboth'
state: present state: present
- name: Add root bashrc and vim configuration.
lineinfile:
path: /root/.bashrc
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
with_items:
- regexp: '^(export )?VISUAL='
line: 'export VISUAL=vim.basic'
- regexp: '^(export )?EDITOR='
line: 'export EDITOR=vim.basic'
- regexp: '^(export )?SUDO_EDITOR='
line: 'export SUDO_EDITOR=vim.basic'
when: ansible_os_family == 'Debian'
- name: Add root bashrc and vim configuration for RedHat - name: Add root bashrc and vim configuration for RedHat
lineinfile: lineinfile:
path: /root/.bashrc path: /root/.bashrc
@ -73,7 +39,6 @@
line: 'export EDITOR=vim' line: 'export EDITOR=vim'
- regexp: '^(export )?SUDO_EDITOR=' - regexp: '^(export )?SUDO_EDITOR='
line: 'export SUDO_EDITOR=vim' line: 'export SUDO_EDITOR=vim'
when: ansible_os_family != 'Debian'
- name: Add functional alias to restart a service and show the log - name: Add functional alias to restart a service and show the log
blockinfile: blockinfile:

View File

@ -1,15 +0,0 @@
---
- name: Ensure addon path for colors exists.
ansible.builtin.file:
path: /var/lib/vim/addons/colors
state: directory
- name: Copy vim colorscheme to the addon path.
ansible.builtin.copy:
src: ir_black.vim
dest: /var/lib/vim/addons/colors/
- name: Apply global vim configuration
ansible.builtin.copy:
src: vimrc.local
dest: /etc/vim/

View File

@ -13,13 +13,3 @@
ansible.builtin.copy: ansible.builtin.copy:
src: vimrc.local src: vimrc.local
dest: /etc/ dest: /etc/
- name: Ensure vim will source a global configuration file
ansible.builtin.blockinfile:
path: /etc/vimrc
marker: '" {mark} ANSIBLE MANAGED BLOCK'
block: |
set runtimepath+=/var/lib/vim/addons
if filereadable("/etc/vimrc.local")
source /etc/vimrc.local
endif