mirror of
https://github.com/roles-ansible/ansible_collection_users.git
synced 2024-08-16 10:29:50 +02:00
Improve j2linting
This commit is contained in:
parent
48de3d601d
commit
4cc7cdfa10
7 changed files with 95 additions and 16 deletions
|
@ -41,7 +41,7 @@ l3d_users__dotfiles__aliases:
|
||||||
- {alias: "lz", command: "ls -Z", color: false}
|
- {alias: "lz", command: "ls -Z", color: false}
|
||||||
- {alias: "EDITOR", command: "/usr/bin/vim", color: false}
|
- {alias: "EDITOR", command: "/usr/bin/vim", color: false}
|
||||||
- {alias: "VISUAL", command: "/usr/bin/gedit", color: false}
|
- {alias: "VISUAL", command: "/usr/bin/gedit", color: false}
|
||||||
- {alias: "gitsubpull", command: "git submodule foreach '(git checkout \\$(git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@'); git pull)'", color: false}
|
- {alias: "gitsubpull", command: "git submodule foreach '(git checkout $(git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@'); git pull ; git submodule foreach \"(git checkout $(git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@'); git pull)\")'", color: false}
|
||||||
- {alias: "pwgen", command: "/usr/bin/pwgen --num-passwords=3000 --numerals --capitalize --secure --no-vowels --ambiguous 95 1", color: false}
|
- {alias: "pwgen", command: "/usr/bin/pwgen --num-passwords=3000 --numerals --capitalize --secure --no-vowels --ambiguous 95 1", color: false}
|
||||||
- {alias: "gdiff", command: "git diff --submodule=diff", color: false}
|
- {alias: "gdiff", command: "git diff --submodule=diff", color: false}
|
||||||
dotfiles__additional_user_bashrc_lines: []
|
dotfiles__additional_user_bashrc_lines: []
|
||||||
|
@ -57,5 +57,8 @@ l3d_users__dotfiles__history_control: 'ignoreboth'
|
||||||
l3d_users__dotfiles__history_size: '-1'
|
l3d_users__dotfiles__history_size: '-1'
|
||||||
l3d_users__dotfiles__history_file_size: '-1'
|
l3d_users__dotfiles__history_file_size: '-1'
|
||||||
|
|
||||||
|
# vim config
|
||||||
|
l3d_users__vimrc: true
|
||||||
|
|
||||||
# run simple versionscheck
|
# run simple versionscheck
|
||||||
submodules_versioncheck: false
|
submodules_versioncheck: false
|
||||||
|
|
|
@ -12,3 +12,8 @@
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'bashrc.yml'
|
file: 'bashrc.yml'
|
||||||
when: l3d_users__bashrc | bool
|
when: l3d_users__bashrc | bool
|
||||||
|
|
||||||
|
- name: Setup and configure vimrc
|
||||||
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'vimrc.yml'
|
||||||
|
when: l3d_users__vimrc | bool
|
||||||
|
|
23
roles/dotfiles/tasks/vimrc.yml
Normal file
23
roles/dotfiles/tasks/vimrc.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
- name: Create vimrc configuration for root
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: 'templates/vimrc.j2'
|
||||||
|
dest: '/root/.vimrc'
|
||||||
|
owner: 'root'
|
||||||
|
group: 'root'
|
||||||
|
mode: 'u=rw,g=r,o=r'
|
||||||
|
|
||||||
|
- name: Create global bashrc configuration
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: 'templates/dotbashrc.j2'
|
||||||
|
dest: "{{ user.home | default('/home/' + user.name) }}/.bashrc"
|
||||||
|
owner: "{{ user.name }}"
|
||||||
|
group: "{{ user.name }}"
|
||||||
|
mode: '0640'
|
||||||
|
loop: "{{ _l3d_users__merged_users }}"
|
||||||
|
loop_control:
|
||||||
|
label: "user={{ user.name }}"
|
||||||
|
loop_var: user
|
||||||
|
when: user.state | default ('present') == 'present'
|
|
@ -8,19 +8,19 @@
|
||||||
if [ -x /usr/bin/dircolors ]; then
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
{% for alias in dotfiles__aliases %}
|
{% for alias in dotfiles__aliases %}
|
||||||
{% if alias.color %}
|
{% if alias.color %}
|
||||||
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
|
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
|
||||||
{% endif%}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{% for alias in l3d_users__dotfiles__aliases %}
|
{% for alias in l3d_users__dotfiles__aliases %}
|
||||||
{% if not alias.color %}
|
{% if not alias.color %}
|
||||||
alias {{ alias.alias }}="{{ alias.command }}"
|
alias {{ alias.alias }}="{{ alias.command }}"
|
||||||
{% endif%}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{%if l3d_users__dotfiles__bash_completion_enabled %}
|
{% if l3d_users__dotfiles__bash_completion_enabled %}
|
||||||
if ! shopt -oq posix; then
|
if ! shopt -oq posix; then
|
||||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||||
. /usr/share/bash-completion/bash_completion
|
. /usr/share/bash-completion/bash_completion
|
||||||
|
@ -28,7 +28,6 @@ if ! shopt -oq posix; then
|
||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# fancy Prompt
|
# fancy Prompt
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
# Source global definitions
|
# Source global definitions
|
||||||
if [ -f /etc/bash.bashrc ]; then
|
if [ -f /etc/bash.bashrc ]; then
|
||||||
. /etc/bash.bashrc
|
source /etc/bash.bashrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# User specific environment
|
# User specific environment
|
||||||
|
@ -15,19 +15,19 @@ export PATH
|
||||||
if [ -x /usr/bin/dircolors ]; then
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
{% for alias in dotfiles__aliases %}
|
{% for alias in dotfiles__aliases %}
|
||||||
{% if alias.color %}
|
{% if alias.color %}
|
||||||
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
|
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
|
||||||
{% endif%}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{% for alias in l3d_users__dotfiles__aliases %}
|
{% for alias in l3d_users__dotfiles__aliases %}
|
||||||
{% if not alias.color %}
|
{% if not alias.color %}
|
||||||
alias {{ alias.alias }}="{{ alias.command }}"
|
alias {{ alias.alias }}="{{ alias.command }}"
|
||||||
{% endif%}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{%if l3d_users__dotfiles__bash_completion_enabled %}
|
{% if l3d_users__dotfiles__bash_completion_enabled %}
|
||||||
if ! shopt -oq posix; then
|
if ! shopt -oq posix; then
|
||||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||||
. /usr/share/bash-completion/bash_completion
|
. /usr/share/bash-completion/bash_completion
|
||||||
|
@ -35,6 +35,7 @@ if ! shopt -oq posix; then
|
||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# fancy Prompt
|
# fancy Prompt
|
||||||
export PS1='{{ l3d_users__dotfiles__user_prompt }} '
|
export PS1='{{ l3d_users__dotfiles__user_prompt }} '
|
||||||
|
@ -59,7 +60,7 @@ HISTFILESIZE={{ dotfiles__history_file_size }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
# additional user rules
|
# additional user rules
|
||||||
{% for custom in {{ user.bashrc | default([]) }} %}
|
{% for custom in user.bashrc | default([]) %}
|
||||||
{{ custom }}
|
{{ custom }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
49
roles/dotfiles/templates/vimrc.j2
Normal file
49
roles/dotfiles/templates/vimrc.j2
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
" gopass secure editor
|
||||||
|
au BufNewFile,BufRead /dev/shm/gopass.* setlocal noswapfile nobackup noundofile
|
||||||
|
|
||||||
|
" vim layout
|
||||||
|
syntax on " enable syntax highlighting
|
||||||
|
set cursorline " highlight the current line
|
||||||
|
set fileencoding=utf-8
|
||||||
|
set encoding=utf-8
|
||||||
|
colorscheme elflord
|
||||||
|
set cursorline " highlight the current line
|
||||||
|
|
||||||
|
" tabs and indenting
|
||||||
|
set autoindent " auto indenting
|
||||||
|
set smartindent " smart indenting
|
||||||
|
set expandtab " spaces instead of tabs
|
||||||
|
set tabstop=2 " 2 spaces for tabs
|
||||||
|
set shiftwidth=2 " 2 spaces for indentation
|
||||||
|
|
||||||
|
" mouse
|
||||||
|
set mouse-=a " disable weird mouse behavior
|
||||||
|
nnoremap <C-Left> :tabprevious<CR>
|
||||||
|
nnoremap <C-h> :tabprevious<CR>
|
||||||
|
nnoremap <C-Right> :tabnext<CR>
|
||||||
|
nnoremap <C-l> :tabnext<CR>
|
||||||
|
|
||||||
|
" bells
|
||||||
|
set noerrorbells " turn off audio bell
|
||||||
|
set visualbell " but leave on a visual bell
|
||||||
|
|
||||||
|
" search
|
||||||
|
set hlsearch " highlighted search results
|
||||||
|
set showmatch " show matching bracket
|
||||||
|
|
||||||
|
" behavior
|
||||||
|
filetype on " enable filetype detection
|
||||||
|
set scrolloff=5 " show at least 5 lines above/below
|
||||||
|
set showcmd " show selection metadata
|
||||||
|
set showmode " show INSERT, VISUAL, etc. mode
|
||||||
|
set showmatch " show matching brackets
|
||||||
|
set autoindent smartindent " auto/smart indent
|
||||||
|
set smarttab " better backspace and tab functionali
|
||||||
|
set nobackup " don't create pointless backup files; Use VCS instead
|
||||||
|
set autoread " watch for file changes
|
||||||
|
|
||||||
|
" extra whitespace
|
||||||
|
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||||
|
match ExtraWhitespace /\s\+$/
|
|
@ -3,7 +3,6 @@ l3d_users__dotfiles_packages:
|
||||||
- bash
|
- bash
|
||||||
- vim
|
- vim
|
||||||
- htop
|
- htop
|
||||||
- ranger
|
|
||||||
|
|
||||||
playbook_version_number: 2
|
playbook_version_number: 4
|
||||||
playbook_version_path: 'l3d.users.dotfiles.version'
|
playbook_version_path: 'l3d.users.dotfiles.version'
|
||||||
|
|
Loading…
Reference in a new issue