From 2a16ef4a63d6ba5bfab1bd9cbbe2da604354ba23 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 15 Jun 2019 00:22:17 -0400 Subject: [PATCH] add bashrc --- common/map.jinja | 3 +- icinga2/init.sls | 4 +++ ssh/files/bashrc.jinja | 81 ++++++++++++++++++++++++++++++++++++++++++ ssh/init.sls | 9 +++++ top.sls | 1 + 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 icinga2/init.sls create mode 100644 ssh/files/bashrc.jinja diff --git a/common/map.jinja b/common/map.jinja index f8111db..4ac7396 100644 --- a/common/map.jinja +++ b/common/map.jinja @@ -32,7 +32,8 @@ 'iftop', 'iotop', 'nano', - 'screen' + 'screen', + 'git' ] } %} diff --git a/icinga2/init.sls b/icinga2/init.sls new file mode 100644 index 0000000..e545696 --- /dev/null +++ b/icinga2/init.sls @@ -0,0 +1,4 @@ + +'icinga2': + pkg.installed: [] + diff --git a/ssh/files/bashrc.jinja b/ssh/files/bashrc.jinja new file mode 100644 index 0000000..cc384c5 --- /dev/null +++ b/ssh/files/bashrc.jinja @@ -0,0 +1,81 @@ + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# See bash(1) for more options +export HISTCONTROL=ignoredups +export HISTSIZE=2000000 +export HISTFILESIZE=2000000 +export HISTTIMEFORMAT="(%m/%d/%y) %T " +export PROMPT_COMMAND='history -a' +shopt -s histappend +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# 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 + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' +alias vi='vim' + +export EDITOR='vim' +export VISUAL='vim' + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # color support + PS1="[\[\e[1;33;1m\]\$(awk '{print \$1}' /proc/loadavg)\[\e[0m\]/\[\e[1;34;1m\]\$(grep -c '^processor' /proc/cpuinfo)\[\e[0m\]][\[\e[1;31;1m\]\u\[\e[0m\]@\[\e[1;32;32m\]\h\[\e[39;1m\] \w\[\e[0m\]]$ " +else + PS1="[\$(awk {'print \$1'} /proc/loadavg)/\$(grep -c '^processor' /proc/cpuinfo)][\u@\h \w]$ " +fi + +if which apt-get >/dev/null 2>&1; then + alias update="sudo apt-get update && sudo apt-get -y upgrade" +else + alias update="yum clean all && yum -y update" +fi + +if [ $(id -u) -gt 0 ]; then + alias puppet='sudo puppet' + alias fab='sudo fab' +fi + +# https://git.keiran.us/config-mgmt/puppet/raw/commit/09158fc579f5ee2c00f395971d8c986e3ec08788/modules/keir/files/bash/bashrc + diff --git a/ssh/init.sls b/ssh/init.sls index 0672d5b..e4c0222 100644 --- a/ssh/init.sls +++ b/ssh/init.sls @@ -15,6 +15,14 @@ - require: - file: /root/.ssh +/root/.bashrc: + file.managed: + - source: 'salt://ssh/files/bashrc.jinja' + - template: jinja + - user: root + - group: root + - mode: 644 + /root/.ssh/config: file.managed: - source: 'salt://ssh/files/ssh_config.jinja' @@ -62,3 +70,4 @@ - file: /home/{{user}}/.ssh {% endfor %} + diff --git a/top.sls b/top.sls index 3fe6d95..9df86e3 100644 --- a/top.sls +++ b/top.sls @@ -7,3 +7,4 @@ - gitea 'kpi.keiran.us': - salt.master + - icinga2