diff --git a/README.md b/README.md index a8723f3..00ae1e4 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Ansible role to deploy some dotfiles which may be useful Affected files: ```ini /etc/bash.bashrc -.bashrc -.vimrc +~/.bashrc +~/.vimrc ``` needed vars: --------------- diff --git a/defaults/main.yml b/defaults/main.yml index 614c935..004349d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,3 +4,7 @@ bash: bashrc: '' nextcloud: false nm: false + pwgen: true + shell: "/bin/bash" + ps1: '$(if [[ $(id -u) -ne 0 ]];then echo "\[\033[01;33m\]"; else echo "\[\033[01;31m\]"; fi) $(if [[ $? == 0 ]]; then printf "\xE2\x9D\xA4"; fi) \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' + diff --git a/tasks/main.yml b/tasks/main.yml index f214218..5b5dbe1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,7 +7,7 @@ - name: Create a global bashrc configuration copy: - src: 'files/bash.bashrc' + src: 'templates/bash.bashrc' dest: '/etc/bash.bashrc' owner: root group: root @@ -15,7 +15,7 @@ - name: Copy bashrc configuration to admin users template: - src: 'files/bashrc' + src: 'templates/bashrc' dest: '/home/{{ item }}/.bashrc' owner: '{{ item }}' group: wheel @@ -24,7 +24,7 @@ - name: Copy vimrc configuration to root copy: - src: 'files/vimrc' + src: 'templates/vimrc' dest: '/root/.vimrc' owner: root group: root @@ -32,7 +32,7 @@ - name: Copy vimrc configuration to admin users copy: - src: 'files/vimrc' + src: 'templates/vimrc' dest: '/home/{{ item }}/.vimrc' owner: '{{ item }}' group: wheel diff --git a/files/bash.bashrc b/templates/bash.bashrc similarity index 89% rename from files/bash.bashrc rename to templates/bash.bashrc index 1302adb..5198232 100644 --- a/files/bash.bashrc +++ b/templates/bash.bashrc @@ -47,7 +47,7 @@ if [ -z "$BASHRCSOURCED" ]; then # and console windows # If you want to do so, just add e.g. if [ "$PS1" ]; then - PS1='$(if [[ $(id -u) -ne 0 ]];then echo "\[\033[01;33m\]"; else echo "\[\033[01;31m\]"; fi) $(if [[ $? == 0 ]]; then printf "\xE2\x9D\xA4"; fi) \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' + PS1='{{ bash.ps1 }}' fi # to your custom modification shell script in /etc/profile.d/ directory fi @@ -77,7 +77,7 @@ if [ -z "$BASHRCSOURCED" ]; then umask 022 fi - SHELL=/bin/bash + SHELL={{ bash.shell }} # Only display echos from profile.d scripts if we are no login shell # and interactive - otherwise just process them to set envvars for i in /etc/profile.d/*.sh; do @@ -111,4 +111,6 @@ alias ll='ls -la' alias la='ls -A' alias l='ls -CF' +{% if bash.pwgen %}alias pwgen="/usr/bin/pwgen --num-passwords=3000 --numerals --capitalize --secure --no-vowels --symbols 42 | grep -v '0' | grep -v 'o' | grep -v 'O' | grep -v '\"' | grep -v 'I' | grep -v 'l' | grep -v '1' | grep -v 'ยด' | grep -v '@' | tail -1 "{% endif %} + # vim:ts=4:sw=4 diff --git a/files/bashrc b/templates/bashrc similarity index 100% rename from files/bashrc rename to templates/bashrc diff --git a/files/vimrc b/templates/vimrc similarity index 100% rename from files/vimrc rename to templates/vimrc