From ace87a8309f20a6d494d1646c452f2e1d3034949 Mon Sep 17 00:00:00 2001 From: Glenn Date: Fri, 12 Jul 2024 14:12:40 +0200 Subject: [PATCH] Initial import --- README.md | 38 +++++++ TODO.md | 5 + defaults/main.yml | 7 ++ files/bash_aliases | 51 ++++++++++ files/bash_profile | 9 ++ files/bashrc | 18 ++++ files/bashrc.d/00-bin-private.sh | 10 ++ files/bashrc.d/20-fake-resolv-host.sh | 3 + files/bashrc.d/50-dev-android.sh | 10 ++ files/bashrc.d/50-dev-debian.sh | 12 +++ files/bashrc.d/50-dev-go.sh | 12 +++ files/bashrc.d/50-dev-opam.sh | 11 ++ files/bashrc.d/50-dev-rbenv.sh | 10 ++ files/bashrc.d/50-dev-ruboto.sh | 9 ++ files/bashrc.d/70-util-ansible.sh | 4 + files/bashrc.d/70-util-darcs.sh | 6 ++ files/bashrc.d/70-util-editor.sh | 10 ++ files/bashrc.d/70-util-fasd.sh | 5 + files/bashrc.d/70-util-godir.sh | 0 files/bashrc.d/70-util-gpg.sh | 12 +++ files/bashrc.d/70-util-grep.sh | 9 ++ files/bashrc.d/70-util-pager.sh | 10 ++ files/bashrc.d/80-app-gtk.sh | 4 + files/bashrc.d/90-prompt.sh | 60 +++++++++++ files/bashrc.d/90-shell-display.sh | 3 + files/bashrc.d/90-shell-history.sh | 3 + files/bashrc.d/95-completion.sh | 12 +++ files/bashrc.d/95-misc-aliases.sh | 14 +++ files/bashrc.d/99-misc-completion.sh | 8 ++ handlers/main.yml | 2 + local.sh | 7 ++ meta/main.yml | 139 ++++++++++++++++++++++++++ role.yml | 10 ++ tasks/main.yml | 35 +++++++ templates/bashrc.jinja2 | 12 +++ vars/main.yml | 2 + 36 files changed, 572 insertions(+) create mode 100644 README.md create mode 100644 TODO.md create mode 100644 defaults/main.yml create mode 100644 files/bash_aliases create mode 100644 files/bash_profile create mode 100644 files/bashrc create mode 100644 files/bashrc.d/00-bin-private.sh create mode 100644 files/bashrc.d/20-fake-resolv-host.sh create mode 100644 files/bashrc.d/50-dev-android.sh create mode 100644 files/bashrc.d/50-dev-debian.sh create mode 100644 files/bashrc.d/50-dev-go.sh create mode 100644 files/bashrc.d/50-dev-opam.sh create mode 100644 files/bashrc.d/50-dev-rbenv.sh create mode 100644 files/bashrc.d/50-dev-ruboto.sh create mode 100644 files/bashrc.d/70-util-ansible.sh create mode 100644 files/bashrc.d/70-util-darcs.sh create mode 100644 files/bashrc.d/70-util-editor.sh create mode 100644 files/bashrc.d/70-util-fasd.sh create mode 100644 files/bashrc.d/70-util-godir.sh create mode 100644 files/bashrc.d/70-util-gpg.sh create mode 100644 files/bashrc.d/70-util-grep.sh create mode 100644 files/bashrc.d/70-util-pager.sh create mode 100644 files/bashrc.d/80-app-gtk.sh create mode 100644 files/bashrc.d/90-prompt.sh create mode 100644 files/bashrc.d/90-shell-display.sh create mode 100644 files/bashrc.d/90-shell-history.sh create mode 100644 files/bashrc.d/95-completion.sh create mode 100644 files/bashrc.d/95-misc-aliases.sh create mode 100644 files/bashrc.d/99-misc-completion.sh create mode 100644 handlers/main.yml create mode 100755 local.sh create mode 100644 meta/main.yml create mode 100644 role.yml create mode 100644 tasks/main.yml create mode 100644 templates/bashrc.jinja2 create mode 100644 vars/main.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..3e696eb --- /dev/null +++ b/TODO.md @@ -0,0 +1,5 @@ + +* Add 'safety' aliases for rm -i, mv -i, etc. +* Fill local.yml for direct role application +* Install fasd (zz, etc. autocompletion aliases) + diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..1f4c6ac --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,7 @@ +--- +# defaults file for roles/glenux.bash +bash_users: [] +# - alice +# - bob +# - charlie + diff --git a/files/bash_aliases b/files/bash_aliases new file mode 100644 index 0000000..7e605b3 --- /dev/null +++ b/files/bash_aliases @@ -0,0 +1,51 @@ +### ALIASES SUDO +alias dpkg='sudo dpkg' +alias photo_dl='sudo gphoto2 --auto-detect -P' +alias svnforget='svn st | egrep '\''^(\!|\?).*\.(cpp|cc|am|h|hh|hxx|tex|png)$'\''' + +## ALIASES +alias atodo='todo -G' +alias tdg='todo -G' +alias be='bundle exec' + +alias ls='ls --color=auto -F' +alias makepatch='LC_ALL=C TZ=UTC0 diff -Naur ' +alias timidity='timidity -Oe' +alias synaptic='gksu synaptic' +alias sl='ls' +#alias cmake='colormake' +alias music123='esddsp music123' +alias xdu='du > ~/.tmp/du.out && xdu -n -c 7 ~/.tmp/du.out' +alias gnux_bgfiles='find -exec du -sh "{}" \; | egrep [0-9]M | sort -n | tail -n 11 | head -n 10' +alias fr='file-roller' +alias mp3blaster='esddsp mp3blaster' +alias ll='ls -lh' +alias llla='ls -la | less' +alias lsd="ls -F | egrep '\/$'" +alias speech='esddsp festival --tts' +alias gvimr='gvim --remote-tab' +alias grep='grep --color' + +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' + +#alias ip='/sbin/ifconfig eth0 | grep adr | sed -e "s/^.*adr://" |sed -e "s/ Bcast.*//" ' + +alias rmplayer="mplayer -ao esd -nocache" + +alias filter_video="egrep -i '\.(avi|mov|mpe?g|mkv|wmv|rm)$'" +alias filter_audio="egrep -i '\.(wav|flac|mp3|aac|m4a|ogg|wma)$'" +alias filter_image="egrep -i '\.(jpe?g|png|xcf(.gz)|eps|svg|gif)$'" +alias filter_imageart="egrep -i '\.(xcf(.gz)?|psd|ora|svg)$'" +alias filter_archive="egrep -i '\.(tar\.)?(gz|bz2|7z|tgz|zip|rar|ace|zoo|arj|lha)$'" +alias filter_document="egrep -i '\.(txt|pdf|ps|sxw|odt|doc|rtf)$'" + +alias pwgen="pwgen -B 10 14" +alias http_serve="python -m SimpleHTTPServer 5001" + +alias scp="BINARY_SSH=scp $HOME/bin/ssh" +alias rsync="BINARY_SSH=rsync $HOME/bin/ssh" +alias fuck='$(thefuck $(fc -ln -1))' +alias baloostatus='balooctl status 2>/dev/null |grep Indexed |awk -v p=200 "{print int(p * \$2/\$4)/p; }"' + diff --git a/files/bash_profile b/files/bash_profile new file mode 100644 index 0000000..7af268c --- /dev/null +++ b/files/bash_profile @@ -0,0 +1,9 @@ +## +## BASH PROFILE - Only for login shells +## + + +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi + diff --git a/files/bashrc b/files/bashrc new file mode 100644 index 0000000..eff621c --- /dev/null +++ b/files/bashrc @@ -0,0 +1,18 @@ +## +## BASH RC - every new shell +##  + +## 01-29 environment changes (XX-bin-... and XX-env-) +## 40-69 development settings (XX-dev) +## 70-89 utilities and applications specific environment changes (XX-app-...) +## 90-99 shell customisation : colors, prompt, etc. +## 95-99 miscelanous or low priority : aliases and completion (XX-misc-) + +if [ -d "$HOME/.bashrc.d" ]; then + for script in $(find "$HOME/.bashrc.d/" -name '*.sh' |sort -n) ; do + # echo "Loading `basename \"$script\"`..." # >&2 + . $script + done +fi + + diff --git a/files/bashrc.d/00-bin-private.sh b/files/bashrc.d/00-bin-private.sh new file mode 100644 index 0000000..5b36358 --- /dev/null +++ b/files/bashrc.d/00-bin-private.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +### +# set PATH so it includes user's private bin if it exists +# + +if [ -d "$HOME/bin" ] ; then + export PATH="$HOME/bin:$PATH" +fi + diff --git a/files/bashrc.d/20-fake-resolv-host.sh b/files/bashrc.d/20-fake-resolv-host.sh new file mode 100644 index 0000000..2fbca1f --- /dev/null +++ b/files/bashrc.d/20-fake-resolv-host.sh @@ -0,0 +1,3 @@ + +#echo "[ERROR] Fake resolv & host is not set up" >&2 + diff --git a/files/bashrc.d/50-dev-android.sh b/files/bashrc.d/50-dev-android.sh new file mode 100644 index 0000000..88c03e0 --- /dev/null +++ b/files/bashrc.d/50-dev-android.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +### +# Set up Android environment +# +ANDROIDDIR="$HOME/.adt-bundle" +if [[ -e "$ANDROIDDIR" ]]; then + export PATH=$ANDROIDDIR/sdk/platform-tools:$ANDROIDDIR/sdk/tools:$PATH +fi + diff --git a/files/bashrc.d/50-dev-debian.sh b/files/bashrc.d/50-dev-debian.sh new file mode 100644 index 0000000..4ce055f --- /dev/null +++ b/files/bashrc.d/50-dev-debian.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +export DEBEMAIL="nobody@example.com" +export DEBFULLNAME="Foo Bar" +export buildArea="$HOME/src/Debian/build-area" + +# override default values with any found in ~/.config/debian/config +if [ -f ~/.config/debian/config ]; then + . ~/.config/debian/config +fi + + diff --git a/files/bashrc.d/50-dev-go.sh b/files/bashrc.d/50-dev-go.sh new file mode 100644 index 0000000..ac3cb0f --- /dev/null +++ b/files/bashrc.d/50-dev-go.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +## +# Set up Go environment +# + +if hash go > /dev/null 2>&1; then + if [ -d "$HOME/bin" ]; then + export GOPATH="$HOME/src/Go" + export PATH="$GOPATH/bin:$PATH" + fi +fi diff --git a/files/bashrc.d/50-dev-opam.sh b/files/bashrc.d/50-dev-opam.sh new file mode 100644 index 0000000..a2cb195 --- /dev/null +++ b/files/bashrc.d/50-dev-opam.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +## +# Set up OCaml environment +# +if hash opam > /dev/null 2>&1 ; then + eval $(opam config env) +fi + +# OPAM configuration +#. /home/warbrain/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true diff --git a/files/bashrc.d/50-dev-rbenv.sh b/files/bashrc.d/50-dev-rbenv.sh new file mode 100644 index 0000000..294c4dc --- /dev/null +++ b/files/bashrc.d/50-dev-rbenv.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +### +# Set up Ruby environment +# +#export PATH=/var/lib/gems/1.8/bin:$PATH +if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then + export PATH="$HOME/.rbenv/bin:$PATH" + eval "$(rbenv init -)" +fi diff --git a/files/bashrc.d/50-dev-ruboto.sh b/files/bashrc.d/50-dev-ruboto.sh new file mode 100644 index 0000000..7e1fade --- /dev/null +++ b/files/bashrc.d/50-dev-ruboto.sh @@ -0,0 +1,9 @@ + +export PATH +export ANDROID_HOME + +if [ -d "$HOME/android-sdk-linux" ]; then + PATH="$HOME/android-sdk-linux/build-tools/19.1.0:$PATH" + PATH="$HOME/android-sdk-linux/tools:$PATH" + ANDROID_HOME="$HOME/android-sdk-linux/" +fi diff --git a/files/bashrc.d/70-util-ansible.sh b/files/bashrc.d/70-util-ansible.sh new file mode 100644 index 0000000..d2401df --- /dev/null +++ b/files/bashrc.d/70-util-ansible.sh @@ -0,0 +1,4 @@ + +# Disable ansible cowsay +export ANSIBLE_NOCOWS=1 + diff --git a/files/bashrc.d/70-util-darcs.sh b/files/bashrc.d/70-util-darcs.sh new file mode 100644 index 0000000..ec2c2a4 --- /dev/null +++ b/files/bashrc.d/70-util-darcs.sh @@ -0,0 +1,6 @@ + +# Help darcs on network mounts +if hash darcs >/dev/null 2>&1 ; then +export DARCS_SLOPPY_LOCKS=1 +fi + diff --git a/files/bashrc.d/70-util-editor.sh b/files/bashrc.d/70-util-editor.sh new file mode 100644 index 0000000..3b1a08a --- /dev/null +++ b/files/bashrc.d/70-util-editor.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Pager detection +for pager in vim nano emacs ; do + if hash $pager 2> /dev/null ; then + export PAGER=$pager + break + fi +done + diff --git a/files/bashrc.d/70-util-fasd.sh b/files/bashrc.d/70-util-fasd.sh new file mode 100644 index 0000000..0b4b6a5 --- /dev/null +++ b/files/bashrc.d/70-util-fasd.sh @@ -0,0 +1,5 @@ + +if hash fasd >/dev/null 2>&1 ; then + eval "$(fasd --init auto)" +fi + diff --git a/files/bashrc.d/70-util-godir.sh b/files/bashrc.d/70-util-godir.sh new file mode 100644 index 0000000..e69de29 diff --git a/files/bashrc.d/70-util-gpg.sh b/files/bashrc.d/70-util-gpg.sh new file mode 100644 index 0000000..2307069 --- /dev/null +++ b/files/bashrc.d/70-util-gpg.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +### +# GnuPG +# +if [ -f "${HOME}/.gpg-agent-info" ]; then + . "${HOME}/.gpg-agent-info" + export GPG_AGENT_INFO + export SSH_AUTH_SOCK +fi + + diff --git a/files/bashrc.d/70-util-grep.sh b/files/bashrc.d/70-util-grep.sh new file mode 100644 index 0000000..60e0992 --- /dev/null +++ b/files/bashrc.d/70-util-grep.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +#export GREP_OPTIONS="--color" +#GREP_COLORS="ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36" +#export GREP_COLORS + +# disable deprecated variable +export GREP_OPTIONS= + diff --git a/files/bashrc.d/70-util-pager.sh b/files/bashrc.d/70-util-pager.sh new file mode 100644 index 0000000..a15a018 --- /dev/null +++ b/files/bashrc.d/70-util-pager.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Pager detection +for pager in most less more ; do + if hash $pager 2> /dev/null ; then + export PAGER=$pager + break + fi +done + diff --git a/files/bashrc.d/80-app-gtk.sh b/files/bashrc.d/80-app-gtk.sh new file mode 100644 index 0000000..3fcdfa5 --- /dev/null +++ b/files/bashrc.d/80-app-gtk.sh @@ -0,0 +1,4 @@ + +# This line was appended by KDE +# Make sure our customised gtkrc file is loaded. +export GTK2_RC_FILES=$HOME/.gtkrc-2.0 diff --git a/files/bashrc.d/90-prompt.sh b/files/bashrc.d/90-prompt.sh new file mode 100644 index 0000000..36bbd64 --- /dev/null +++ b/files/bashrc.d/90-prompt.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +## +# PROMPT DEFINITIONS. +# + +ps1_show() { + local format=$1 + local fun=$2 + local str=$($fun) + + if [ ! -z "$str" ]; then + printf "$format\n" "$str" + fi +} + +ps1_vcs_branch() { + local vcs="" + local vcs_branch="" + local vcs_root="" + local vcs_root_path="" + local vcs_root_url="" + local vcs_branch_url="" + + { + if hash git && git rev-parse; then + vcs='git' + vcs_branch=$(git branch |sed -n "s/\* \(.*\)/\1/p") + elif hash hg && hg -q status; then + vcs='hg' + vcs_branch=$(hg branch) + elif hash svn && svn info; then + vcs='svn' + vcs_root_path=$(LANG=C LC_ALL=C svn info |sed -n 's/^Working Copy Root Path: //p') + vcs_root_url=$(cd "$vcs_root" ; LANG=C LC_ALL=C svn info |sed -n 's/^Repository Root: //p') + vcs_branch_url=$(cd "$vcs_root" ; LANG=C LC_ALL=C svn info |sed -n 's/^URL: //p') + vcs_branch=$(echo "$vcs_branch_url" |sed "s#^$vcs_root_url/##") + fi + } >/dev/null 2>&1 + + if [ -z "$vcs" ]; then + echo "" + else + echo "$vcs:$vcs_branch" + fi +} + +#export PS1=" \t [#\#]\n[\u@\h \w]\\$ " +#PS1='\[\033[1;32m\][\t|\d]\[\033[1;33m\][\u@\h] \[\033[0;36m\]\w\$\[\033[0m\]\n ' + +PS1="$ps1_context ." +PS1=$PS1": \[\e[1;33m\]\w\[\e[0m\] :" +PS1=$PS1"\`ps1_show ': \[\e[1;34m\]%s\[\e[0m\] :' ps1_vcs_branch\`" # vcs branch +PS1=$PS1": \[\e[0;32m\]\t\[\e[0m\] :" +#PS1=$PS1": \[\e[1;34m\]#\#\[\e[0m\] :" #command count +PS1=$PS1": \[\e[0;31m\]\u@\h " #username +PS1=$PS1"("`uname -m`")\[\e[0m\] :" # architecture +PS1=$PS1":.\n\$ " +export PS1 + diff --git a/files/bashrc.d/90-shell-display.sh b/files/bashrc.d/90-shell-display.sh new file mode 100644 index 0000000..0152ea4 --- /dev/null +++ b/files/bashrc.d/90-shell-display.sh @@ -0,0 +1,3 @@ +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize diff --git a/files/bashrc.d/90-shell-history.sh b/files/bashrc.d/90-shell-history.sh new file mode 100644 index 0000000..080813b --- /dev/null +++ b/files/bashrc.d/90-shell-history.sh @@ -0,0 +1,3 @@ + +# don't put duplicate lines in the history. See bash(1) for more options +export HISTCONTROL=ignoredups diff --git a/files/bashrc.d/95-completion.sh b/files/bashrc.d/95-completion.sh new file mode 100644 index 0000000..9df351a --- /dev/null +++ b/files/bashrc.d/95-completion.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# completion programmable sur les URLs qui vont bien +complete -W " 'mms://vip7.yacast.fr/encoderouifm' +'mms://vipbu.yacast.fr/encoderouifm' +'mms://vip2.yacast.fr/encoderfun1' +'mms://vipbu.yacast.fr/encoderfun' +'mms://vip1.yacast.fr/encodernrj' +'mms://vipbu.yacast.fr/encodernrj' +'mms://vip1.yacast.fr/encodernostalgie' +" rmplayer + diff --git a/files/bashrc.d/95-misc-aliases.sh b/files/bashrc.d/95-misc-aliases.sh new file mode 100644 index 0000000..8935d1f --- /dev/null +++ b/files/bashrc.d/95-misc-aliases.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +## +# ALIAS DEFINITIONS. +# + +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + diff --git a/files/bashrc.d/99-misc-completion.sh b/files/bashrc.d/99-misc-completion.sh new file mode 100644 index 0000000..3bdad3b --- /dev/null +++ b/files/bashrc.d/99-misc-completion.sh @@ -0,0 +1,8 @@ + +## +# BASH COMPLETION +# +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi + diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..ac9e42d --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for roles/glenux.bash diff --git a/local.sh b/local.sh new file mode 100755 index 0000000..ebe8851 --- /dev/null +++ b/local.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +ansible-playbook role.yml \ + --limit "$(uname -n)" \ + -e "bash_users=['$USER']" \ + -e "role_path=$(pwd)" + diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..62c7d35 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,139 @@ +--- +galaxy_info: + author: your name + description: + company: your company (optional) + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + # Some suggested licenses: + # - BSD (default) + # - MIT + # - GPLv2 + # - GPLv3 + # - Apache + # - CC-BY + license: license (GPLv2, CC-BY, etc) + min_ansible_version: 1.2 + # + # Below are all platforms currently available. Just uncomment + # the ones that apply to your role. If you don't see your + # platform on this list, let us know and we'll get it added! + # + #platforms: + #- name: EL + # versions: + # - all + # - 5 + # - 6 + # - 7 + #- name: GenericUNIX + # versions: + # - all + # - any + #- name: Fedora + # versions: + # - all + # - 16 + # - 17 + # - 18 + # - 19 + # - 20 + # - 21 + # - 22 + #- name: Windows + # versions: + # - all + # - 2012R2 + #- name: SmartOS + # versions: + # - all + # - any + #- name: opensuse + # versions: + # - all + # - 12.1 + # - 12.2 + # - 12.3 + # - 13.1 + # - 13.2 + #- name: Amazon + # versions: + # - all + # - 2013.03 + # - 2013.09 + #- name: GenericBSD + # versions: + # - all + # - any + #- name: FreeBSD + # versions: + # - all + # - 8.0 + # - 8.1 + # - 8.2 + # - 8.3 + # - 8.4 + # - 9.0 + # - 9.1 + # - 9.1 + # - 9.2 + #- name: Ubuntu + # versions: + # - all + # - lucid + # - maverick + # - natty + # - oneiric + # - precise + # - quantal + # - raring + # - saucy + # - trusty + # - utopic + # - vivid + #- name: SLES + # versions: + # - all + # - 10SP3 + # - 10SP4 + # - 11 + # - 11SP1 + # - 11SP2 + # - 11SP3 + #- name: GenericLinux + # versions: + # - all + # - any + #- name: Debian + # versions: + # - all + # - etch + # - jessie + # - lenny + # - squeeze + # - wheezy + # + # Below are all categories currently available. Just as with + # the platforms above, uncomment those that apply to your role. + # + #categories: + #- cloud + #- cloud:ec2 + #- cloud:gce + #- cloud:rax + #- clustering + #- database + #- database:nosql + #- database:sql + #- development + #- monitoring + #- networking + #- packaging + #- system + #- web +dependencies: [] + # List your role dependencies here, one per line. + # Be sure to remove the '[]' above if you add dependencies + # to this list. + diff --git a/role.yml b/role.yml new file mode 100644 index 0000000..b231f60 --- /dev/null +++ b/role.yml @@ -0,0 +1,10 @@ +--- +- hosts: localhost + remote_user: root + vars_files: + - 'vars/main.yml' + - 'defaults/main.yml' + tasks: + - include: 'tasks/main.yml' + handlers: + - include: 'handlers/main.yml' diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..6db7528 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,35 @@ +--- +- name: List installable sh scripts + become: false + local_action: shell ls -1 "{{role_path}}/files/bashrc.d/"*.sh + register: bash_scripts + failed_when: + bash_scripts.rc != 0 + changed_when: False + +# tasks file for roles/glenux.bash +- name: Install main configuration files for bash + copy: > + src="{{item[1]}}" + dest="~/.{{item[1]|basename}}" + mode=0644 + become: true + become_user: "{{item[0]}}" + with_nested: + - "{{bash_users}}" + - ['bashrc', 'bash_profile', 'bash_aliases'] + +- name: Create bashrc.d directory + file: path=~/.bashrc.d state=directory + become: true + become_user: "{{item}}" + with_items: "{{bash_users}}" + +- name: Install bashrc.d files + copy: "src={{item[1]}} dest=~/.bashrc.d/{{item[1]|basename}}" + become: true + become_user: "{{item[0]}}" + with_nested: + - "{{bash_users}}" + - "{{bash_scripts.stdout_lines}}" + diff --git a/templates/bashrc.jinja2 b/templates/bashrc.jinja2 new file mode 100644 index 0000000..c604b28 --- /dev/null +++ b/templates/bashrc.jinja2 @@ -0,0 +1,12 @@ +## +## BASH RC - every new shell +##  + +if [ -d "$HOME/.bashrc.d" ]; then + for script in $(find "$HOME/.bashrc.d/" -name '*.sh' |sort -n) ; do + # echo "Loading `basename \"$script\"`..." # >&2 + . $script + done +fi + + diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..8cff8fe --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for roles/glenux.bash