Ensure the .bashrc exists, expand aliases after sudo and color grep in the common role aliases
This commit is contained in:
+36
-15
@@ -1,20 +1,41 @@
|
|||||||
|
- name: Ensure .bashrc exists
|
||||||
|
file:
|
||||||
|
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
||||||
|
state: touch
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
- name: General aliases
|
- name: General aliases
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
||||||
marker: "# {mark} ANSIBLE MANAGED BLOCK | General aliases"
|
marker: "# {mark} ANSIBLE MANAGED BLOCK | General aliases"
|
||||||
block: |
|
block: |
|
||||||
alias clr="clear"
|
alias clr="clear"
|
||||||
alias hgrep="history | grep"
|
alias hgrep="history | grep"
|
||||||
alias syslog="tail -f --lines=100 /var/log/syslog"
|
alias syslog="tail -f --lines=100 /var/log/syslog"
|
||||||
alias cp="rsync -hlAXEptgoDS --numeric-ids --info=progress2"
|
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
|
- name: ls aliases and colors
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
path: "{{ ansible_facts.env.HOME }}/.bashrc"
|
||||||
marker: "# {mark} ANSIBLE MANAGED BLOCK | ls aliases and colors"
|
marker: "# {mark} ANSIBLE MANAGED BLOCK | ls aliases and colors"
|
||||||
block: |
|
block: |
|
||||||
export LS_OPTIONS='--color=auto'
|
# enable color support of ls and also add handy aliases
|
||||||
eval "`dircolors`"
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
alias ls='ls $LS_OPTIONS'
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
alias ll='ls $LS_OPTIONS -l'
|
alias ls='ls --color=auto'
|
||||||
alias l='ls $LS_OPTIONS -la'
|
#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'
|
||||||
|
alias ll='ls $LS_OPTIONS -l'
|
||||||
|
alias l='ls $LS_OPTIONS -la'
|
||||||
|
|||||||
Reference in New Issue
Block a user