Ensure the .bashrc exists, expand aliases after sudo and color grep in the common role aliases
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
- name: Ensure .bashrc exists
|
||||
file:
|
||||
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
||||
state: touch
|
||||
mode: "0644"
|
||||
|
||||
- name: General aliases
|
||||
blockinfile:
|
||||
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
||||
@@ -8,11 +14,26 @@
|
||||
alias syslog="tail -f --lines=100 /var/log/syslog"
|
||||
alias cp="rsync -hlAXEptgoDS --numeric-ids --info=progress2"
|
||||
|
||||
# We can tell bash to check the next word after the alias (i.e sudo) by adding a space to the end of the alias value. https://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo
|
||||
alias sudo='sudo '
|
||||
|
||||
- name: ls aliases and colors
|
||||
blockinfile:
|
||||
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK | ls aliases and colors"
|
||||
block: |
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
export LS_OPTIONS='--color=auto'
|
||||
eval "`dircolors`"
|
||||
alias ls='ls $LS_OPTIONS'
|
||||
|
||||
Reference in New Issue
Block a user