1
0
Fork 0
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:
L3D 2024-04-06 19:42:57 +02:00
parent 48de3d601d
commit 4cc7cdfa10
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
7 changed files with 95 additions and 16 deletions

View file

@ -41,7 +41,7 @@ l3d_users__dotfiles__aliases:
- {alias: "lz", command: "ls -Z", color: false}
- {alias: "EDITOR", command: "/usr/bin/vim", 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: "gdiff", command: "git diff --submodule=diff", color: false}
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_file_size: '-1'
# vim config
l3d_users__vimrc: true
# run simple versionscheck
submodules_versioncheck: false

View file

@ -12,3 +12,8 @@
ansible.builtin.include_tasks:
file: 'bashrc.yml'
when: l3d_users__bashrc | bool
- name: Setup and configure vimrc
ansible.builtin.include_tasks:
file: 'vimrc.yml'
when: l3d_users__vimrc | bool

View 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'

View file

@ -8,19 +8,19 @@
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
{% for alias in dotfiles__aliases %}
{% if alias.color %}
{% if alias.color %}
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
{% endif%}
{% endif %}
{% endfor %}
fi
{% for alias in l3d_users__dotfiles__aliases %}
{% if not alias.color %}
{% if not alias.color %}
alias {{ alias.alias }}="{{ alias.command }}"
{% endif%}
{% endif %}
{% endfor %}
{%if l3d_users__dotfiles__bash_completion_enabled %}
{% if l3d_users__dotfiles__bash_completion_enabled %}
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
@ -28,7 +28,6 @@ if ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
{% endif %}
# fancy Prompt

View file

@ -4,7 +4,7 @@
# Source global definitions
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
source /etc/bash.bashrc
fi
# User specific environment
@ -15,19 +15,19 @@ export PATH
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
{% for alias in dotfiles__aliases %}
{% if alias.color %}
{% if alias.color %}
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
{% endif%}
{% endif %}
{% endfor %}
fi
{% for alias in l3d_users__dotfiles__aliases %}
{% if not alias.color %}
{% if not alias.color %}
alias {{ alias.alias }}="{{ alias.command }}"
{% endif%}
{% endif %}
{% endfor %}
{%if l3d_users__dotfiles__bash_completion_enabled %}
{% if l3d_users__dotfiles__bash_completion_enabled %}
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
@ -35,6 +35,7 @@ if ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
{% endif %}
# fancy Prompt
export PS1='{{ l3d_users__dotfiles__user_prompt }} '
@ -59,7 +60,7 @@ HISTFILESIZE={{ dotfiles__history_file_size }}
{% endfor %}
# additional user rules
{% for custom in {{ user.bashrc | default([]) }} %}
{% for custom in user.bashrc | default([]) %}
{{ custom }}
{% endfor %}

View 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\+$/

View file

@ -3,7 +3,6 @@ l3d_users__dotfiles_packages:
- bash
- vim
- htop
- ranger
playbook_version_number: 2
playbook_version_number: 4
playbook_version_path: 'l3d.users.dotfiles.version'