Coloriser/tabulation le code Ansible avec vim, nano ou mcedit Faites un copier/coller dans votre session ssh en root Pour nano et mcedit, vous pouvez également éditer les fichiers à la place d'utiliser 'cat > ... EOF' Par exemple: nano /usr/share/nano/yaml.nanorc mcedit /usr/share/nano/yaml.nanorc ### vim YAML Ansible highlight Configurer votre éditeur vim pour les playbooks Ansible Quelques définitions des paramètres: ts : tabstop et : expandtab sw : shiftwidth sts : softtabstop nu – show line number vim /root/.vimrc autocmd FileType yaml setlocal et ts=2 ai sw=2 nu sts=0 colorscheme evening Choisissez votre schéma de couleurs ----------------------------------- Vous pouvez voir les schémas de couleurs installés en tapant :colorscheme, puis un espace et la touche de tabulation dans l'éditeur vim. :colorscheme (touche tab) ### nano YAML Ansible highlight cat > /usr/share/nano/yaml.nanorc << EOF # Supports YAML (ansible highlight) files syntax "YAML" "\.ya?ml$" header "^(---|===)" "%YAML" color brightmagenta "^\s*[\$A-Za-z0-9_-]+\:" color brightmagenta " name:" color brightred "[{},]" color brightblack "\s*(#|---).*$" color ,green "[[:space:]]+$" EOF # tabulation cat >> .nanorc << EOF ## YAML-type files include "/usr/share/nano/yaml.nanorc" # Config set tabsize 2 set tabstospaces EOF ### mcedit YAML Ansible highlight sed -i s/'^include yaml.syntax'/'include yaml-ansible.syntax'/1 /usr/share/mc/syntax/Syntax cat > /usr/share/mc/syntax/yaml-ansible.syntax << EOF # YAML Ansible syntax highlighting caseinsensitive context default white spellcheck keyword #*\n lightgray keyword linestart --- lightgray keyword linestart \[\s\]-\s lightgray keyword \{ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\}\[\s-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\]:\{\s\n\} brightmagenta keyword {{ brightred keyword }} brightred EOF # tabulation sed -i s/'^editor_tab_spacing=.*'/'editor_tab_spacing=4'/1 /root/.config/mc/ini sed -i s/'^editor_fill_tabs_with_spaces=.*'/'editor_fill_tabs_with_spaces=true'/1 /root/.config/mc/ini