From 358012ca1957675cb6467619260e12a38ad1ef03 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Wed, 5 Jul 2023 12:06:57 -0700 Subject: [PATCH] Arch didn't need env vars for root bashrc. Add sudo editor for work. --- README.md | 5 +++++ tasks/main.yml | 27 +++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e453578..7445ae2 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,8 @@ None. ## Resources * [GNU Readline Init File Syntax](http://www.gnu.org/software/bash/manual/html_node/Readline-Init-File-Syntax.html) + +## Troubleshooting + +* current vim runtime path with `:set runtimepath?` +* Check vim `:version` diff --git a/tasks/main.yml b/tasks/main.yml index ce1ddfd..5e7a2dd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -21,6 +21,13 @@ - /etc/skel - /root +- name: Add root bashrc shell history configuration + lineinfile: + path: /root/.bashrc + regexp: '^(export )?HISTCONTROL=' + line: 'HISTCONTROL=ignoreboth' + state: present + - name: Add root bashrc and vim configuration. lineinfile: path: /root/.bashrc @@ -28,25 +35,25 @@ line: "{{ item.line }}" state: present with_items: - - regexp: '^(export )?EDITOR=' - line: 'export EDITOR=vim.basic' - regexp: '^(export )?VISUAL=' line: 'export VISUAL=vim.basic' - - regexp: '^(export )?HISTCONTROL=' - line: 'HISTCONTROL=ignoreboth' - when: ansible_os_family != 'RedHat' + - 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 7.9. +- name: Add root bashrc and vim configuration for RedHat lineinfile: path: /root/.bashrc regexp: "{{ item.regexp }}" line: "{{ item.line }}" state: present with_items: - - regexp: '^(export )?EDITOR=' - line: 'export EDITOR=vim' - regexp: '^(export )?VISUAL=' line: 'export VISUAL=vim' - - regexp: '^(export )?HISTCONTROL=' - line: 'HISTCONTROL=ignoreboth' + - regexp: '^(export )?EDITOR=' + line: 'export EDITOR=vim' + - regexp: '^(export )?SUDO_EDITOR=' + line: 'export SUDO_EDITOR=vim' when: ansible_os_family == 'RedHat'