Initial import

This commit is contained in:
Glenn Y. Rolland 2024-07-12 14:12:40 +02:00
commit ace87a8309
36 changed files with 572 additions and 0 deletions

38
README.md Normal file
View file

@ -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).

5
TODO.md Normal file
View file

@ -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)

7
defaults/main.yml Normal file
View file

@ -0,0 +1,7 @@
---
# defaults file for roles/glenux.bash
bash_users: []
# - alice
# - bob
# - charlie

51
files/bash_aliases Normal file
View file

@ -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; }"'

9
files/bash_profile Normal file
View file

@ -0,0 +1,9 @@
##
## BASH PROFILE - Only for login shells
##
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

18
files/bashrc Normal file
View file

@ -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

View file

@ -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

View file

@ -0,0 +1,3 @@
#echo "[ERROR] Fake resolv & host is not set up" >&2

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
# Disable ansible cowsay
export ANSIBLE_NOCOWS=1

View file

@ -0,0 +1,6 @@
# Help darcs on network mounts
if hash darcs >/dev/null 2>&1 ; then
export DARCS_SLOPPY_LOCKS=1
fi

View file

@ -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

View file

@ -0,0 +1,5 @@
if hash fasd >/dev/null 2>&1 ; then
eval "$(fasd --init auto)"
fi

View file

View file

@ -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

View file

@ -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=

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,3 @@
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

View file

@ -0,0 +1,3 @@
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,8 @@
##
# BASH COMPLETION
#
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi

2
handlers/main.yml Normal file
View file

@ -0,0 +1,2 @@
---
# handlers file for roles/glenux.bash

7
local.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
ansible-playbook role.yml \
--limit "$(uname -n)" \
-e "bash_users=['$USER']" \
-e "role_path=$(pwd)"

139
meta/main.yml Normal file
View file

@ -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.

10
role.yml Normal file
View file

@ -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'

35
tasks/main.yml Normal file
View file

@ -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}}"

12
templates/bashrc.jinja2 Normal file
View file

@ -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

2
vars/main.yml Normal file
View file

@ -0,0 +1,2 @@
---
# vars file for roles/glenux.bash