diff --git a/roles/dotfiles/README.md b/roles/dotfiles/README.md index 3fc6b91..b18f62f 100644 --- a/roles/dotfiles/README.md +++ b/roles/dotfiles/README.md @@ -37,23 +37,18 @@ There is a third directory-variable called ``l3d_users__ssh_login: []`` which on | name | default value | description | | --- | --- | --- | -| ``l3d_users__limit_login`` | ``true`` | Only allow SSH login for specified users | -| ``l3d_users__sshd_port`` | ``22`` | Port for SSH | -| ``l3d_users__sshd_password_authentication`` | ``false`` | Allow login with Password | -| ``l3d_users__sshd_permitrootlogin`` | ``false`` | Allow login as root | -| ``l3d_users__create_ansible`` | ``true`` | Create Ansible User | -| ``l3d_users__ansible_user_state`` | ``present`` | Ansible User State | -| ``l3d_users__sshd_manage_server_key_types`` | ``true`` | Manage Server SSH Key types | -| ``l3d_users__sshd_server_key_types`` | ``['ed25519']`` | List of supported SSH Key Types | -| ``l3d_users__sshd_manage_key_algorithmus`` | ``true`` | Manage SSH Key Algorythmins | -| ``l3d_users__sshd_key_algorithmus`` | ``['ssh-ed25519-cert-v01@openssh.com', 'ssh-ed25519', 'ecdsa-sha2-nistp521-cert-v01@openssh.com', 'ecdsa-sha2-nistp384-cert-v01@openssh.com', 'ecdsa-sha2-nistp256-cert-v01@openssh.com']`` | Used SSH Key Algorithms | -| ``l3d_users__sshd_manage_kex_algorithmus`` | ``true`` | Manage SSH Kex Algorythms | -| ``l3d_users__sshd_kex_algorithmus`` | ``['curve25519-sha256@libssh.org', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1']`` | Used Kex Algorythms | -| ``l3d_users__sshd_manage_ciphers`` | ``true`` | Manage SSH Ciphers | -| ``l3d_users__sshd_ciphers`` | ``['chacha20-poly1305@openssh.com', 'aes256-gcm@openssh.com', 'aes256-ctr']`` | Used SSH Ciphers | -| ``l3d_users__sshd_manage_macs`` | ``true`` | Manage Used MACs | -| ``l3d_users__sshd_macs`` | ``['hmac-sha2-512-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512']`` | Used MACs | -| ``l3d_users__sshd_xforwarding`` |``true`` | Enable X-Forwarding | +| ``l3d_users__bashrc`` | ``true`` | Configure bashrc | +| ``l3d_users__dotfiles__bash_completion_enabled`` | ``true`` | Enable bash completion | +| ``l3d_users__dotfiles__aliases`` | *see [defaults/main.yml](defaults/main.yml)* | A predefined list of usefull aliases for your bash config | +| ``dotfiles__additional_user_bashrc_lines`` | ``[]`` | variable for additional bashrc lines | +| ``l3d_users__bashrc_path`` | ``$HOME/.local/bin:$HOME/bin:$HOME/.cargo/env:$PATH``| bashrc $PATH | +| ``l3d_users__dotfiles__user_prompt`` | *see [defaults/main.yml](defaults/main.yml)* | PS1 prompt for users | +| ``l3d_users__dotfiles__root_prompt`` | *see [defaults/main.yml](defaults/main.yml)* | PS1 prompt for root | +| ``l3d_users__dotfiles__history_control`` | ``ignoreboth`` | bashrc history control | +| ``l3d_users__dotfiles__history_size`` | ``-1`` | bashrc history size | +| ``l3d_users__dotfiles__history_file_size`` | ``-1`` | bashrc history filesize | +| ``l3d_users__vimrc`` | ``true`` | Create vim config | +| ``l3d_users__tmuxcfg`` | ``true`` | Create Tmux Config | | ``submodules_versioncheck`` | ``false`` | Optionaly enable simple versionscheck of this role | Example Playbook diff --git a/roles/dotfiles/defaults/main.yml b/roles/dotfiles/defaults/main.yml index 2e16778..7d6e697 100644 --- a/roles/dotfiles/defaults/main.yml +++ b/roles/dotfiles/defaults/main.yml @@ -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 ; 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: [] @@ -59,6 +59,7 @@ l3d_users__dotfiles__history_file_size: '-1' # vim config l3d_users__vimrc: true +l3d_users__vim_colorscheme: 'elflord' # tmux config l3d_users__tmuxcfg: true diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml index 227690a..af696a8 100644 --- a/roles/dotfiles/tasks/main.yml +++ b/roles/dotfiles/tasks/main.yml @@ -8,6 +8,10 @@ ansible.builtin.include_tasks: file: 'packages.yml' +- name: Merge default and locale Users + ansible.builtin.set_fact: + _l3d_users__merged_users: "{{ l3d_users__default_users + l3d_users__local_users }}" + - name: Setup and configure bashrc ansible.builtin.include_tasks: file: 'bashrc.yml' diff --git a/roles/dotfiles/templates/bash.bashrc.j2 b/roles/dotfiles/templates/bash.bashrc.j2 index f91e152..59433e2 100644 --- a/roles/dotfiles/templates/bash.bashrc.j2 +++ b/roles/dotfiles/templates/bash.bashrc.j2 @@ -1,5 +1,5 @@ # /etc/bashrc -{{ ansible_managed | comment }} +{{ ansible_managed | ansible.builtin.comment }} # System wide functions and aliases # Environment stuff goes in /etc/profile @@ -41,13 +41,13 @@ fi HISTCONTROL={{ l3d_users__dotfiles__history_control }} shopt -s histappend {% if ansible_os_family == 'Redhat' %} -# HISTSIZE={{ dotfiles__history_size }} -# HISTFILESIZE={{ dotfiles__history_file_size }} +# HISTSIZE={{ l3d_users__dotfiles__history_size }} +# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }} {% elif ansible_distribution == "CentOS" %} -# HISTSIZE={{ dotfiles__history_size }} -# HISTFILESIZE={{ dotfiles__history_file_size }} +# HISTSIZE={{ l3d_users__dotfiles__history_size }} +# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }} {% else %} -HISTSIZE={{ dotfiles__history_size }} -HISTFILESIZE={{ dotfiles__history_file_size }} +HISTSIZE={{ l3d_users__dotfiles__history_size }} +HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }} {% endif %} # vim:ts=4:sw=4 diff --git a/roles/dotfiles/templates/dotbashrc.j2 b/roles/dotfiles/templates/dotbashrc.j2 index 814a343..e123388 100644 --- a/roles/dotfiles/templates/dotbashrc.j2 +++ b/roles/dotfiles/templates/dotbashrc.j2 @@ -1,6 +1,6 @@ # {{ user.home | default('/home/' + user.name) }}/.bashrc" # for user {{ user.name }} -{{ ansible_managed | comment }} +{{ ansible_managed | ansible.builtin.comment }} # Source global definitions if [ -f /etc/bash.bashrc ]; then @@ -44,18 +44,18 @@ export PS1='{{ l3d_users__dotfiles__user_prompt }} ' HISTCONTROL={{ l3d_users__dotfiles__history_control }} shopt -s histappend {% if ansible_os_family == 'Redhat' %} -# HISTSIZE={{ dotfiles__history_size }} -# HISTFILESIZE={{ dotfiles__history_file_size }} +# HISTSIZE={{ l3d_users__dotfiles__history_size }} +# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }} {% elif ansible_distribution == "CentOS" %} -# HISTSIZE={{ dotfiles__history_size }} -# HISTFILESIZE={{ dotfiles__history_file_size }} +# HISTSIZE={{ l3d_users__dotfiles__history_size }} +# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }} {% else %} -HISTSIZE={{ dotfiles__history_size }} -HISTFILESIZE={{ dotfiles__history_file_size }} +HISTSIZE={{ l3d_users__dotfiles__history_size }} +HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }} {% endif %} # additional general rules -{% for _row in dotfiles__additional_user_bashrc_lines | default() %} +{% for _row in l3d_users__dotfiles__additional_user_bashrc_lines | default() %} {{ _row }} {% endfor %} diff --git a/roles/dotfiles/templates/tmux.conf.j2 b/roles/dotfiles/templates/tmux.conf.j2 index 334c1da..062cd03 100644 --- a/roles/dotfiles/templates/tmux.conf.j2 +++ b/roles/dotfiles/templates/tmux.conf.j2 @@ -1,2 +1,2 @@ - +{{ ansible_managed | ansible.builtin.comment }} set -g history-limit 65536 diff --git a/roles/dotfiles/templates/vimrc.j2 b/roles/dotfiles/templates/vimrc.j2 index b274040..e9623b8 100644 --- a/roles/dotfiles/templates/vimrc.j2 +++ b/roles/dotfiles/templates/vimrc.j2 @@ -1,5 +1,6 @@ -{{ ansible_managed | comment }} - +" +" {{ ansible_managed }} +" " gopass secure editor au BufNewFile,BufRead /dev/shm/gopass.* setlocal noswapfile nobackup noundofile @@ -8,7 +9,7 @@ syntax on " enable syntax highlighting set cursorline " highlight the current line set fileencoding=utf-8 set encoding=utf-8 -colorscheme elflord +colorscheme {{ l3d_users__vim_colorscheme }} set cursorline " highlight the current line " tabs and indenting diff --git a/roles/dotfiles/vars/main.yml b/roles/dotfiles/vars/main.yml index fe06c73..85c32f8 100644 --- a/roles/dotfiles/vars/main.yml +++ b/roles/dotfiles/vars/main.yml @@ -5,5 +5,5 @@ l3d_users__dotfiles_packages: - htop - tmux -playbook_version_number: 6 +playbook_version_number: 7 playbook_version_path: 'l3d.users.dotfiles.version' diff --git a/roles/user/tasks/main.yml b/roles/user/tasks/main.yml index 1f207cf..83e5a07 100644 --- a/roles/user/tasks/main.yml +++ b/roles/user/tasks/main.yml @@ -8,7 +8,6 @@ ansible.builtin.set_fact: _l3d_users__merged_users: "{{ l3d_users__default_users + l3d_users__local_users }}" - - name: Create ansible user with superuser permissions ansible.builtin.include_tasks: file: 'user_ansible.yml'