diff --git a/bin/atclab-update b/bin/atclab-update new file mode 100755 index 0000000..fcb1fb8 --- /dev/null +++ b/bin/atclab-update @@ -0,0 +1,4 @@ +#!/usr/bin/bash +#yum makecache + +yum --disablerepo="*" --enablerepo="atclab" clean all && yum --disablerepo="*" --enablerepo="atclab" -y update diff --git a/bin/gitcommit b/bin/gitcommit new file mode 100755 index 0000000..f160bff --- /dev/null +++ b/bin/gitcommit @@ -0,0 +1,5 @@ +#!/usr/bin/bash + +desc="$@" + +git commit -m "$desc" diff --git a/bin/gittag b/bin/gittag new file mode 100755 index 0000000..88acc24 --- /dev/null +++ b/bin/gittag @@ -0,0 +1,18 @@ +#!/usr/bin/bash + +DIR=$(git rev-parse --show-toplevel) || exit 10 +NAME=$(rpm -q --qf '%{name}\n' --specfile ${DIR}/*.spec) +VERSION=$(rpm -q --qf '%{version}\n' --specfile ${DIR}/*.spec) + + +while getopts ":h:" OPT; do + case "$OPT" in + \?|h) usage ; exit 0 ;; + esac +done +shift $((OPTIND-1)) + +case $1 in + apply) git tag -a -mversion v${VERSION} ;; + *) echo git tag -a -mversion v${VERSION} ;; +esac diff --git a/bin/r b/bin/r new file mode 100755 index 0000000..26c0ad7 --- /dev/null +++ b/bin/r @@ -0,0 +1,23 @@ +#!/usr/bin/bash + +DEL="" + +deletehost() { + local host ip + host=$(echo $1 | awk -F@ '{print $NF}') + ip=$(host $host | awk '/has address/ {print $NF}' | head -1) + ssh-keygen -R $host + test -n "$ip" && ssh-keygen -R $ip +} + +while getopts ":dh" OPT; do + case "$OPT" in + d) DEL=Y ;; + \?|h) usage >&2 ; exit 0 ;; + esac +done +shift $(expr $OPTIND - 1) + +test -n "$DEL" && deletehost $@ + +ssh root@${1:-none} diff --git a/bin/syslog b/bin/syslog new file mode 100755 index 0000000..a6c8576 --- /dev/null +++ b/bin/syslog @@ -0,0 +1,4 @@ +#!/usr/bin/bash + +test -f /var/log/messages && tail -n100 /var/log/messages +test -f /var/log/syslog && tail -n100 /var/log/syslog diff --git a/bin/syslogf b/bin/syslogf new file mode 100755 index 0000000..c71d322 --- /dev/null +++ b/bin/syslogf @@ -0,0 +1,4 @@ +#!/usr/bin/bash + +test -f /var/log/messages && tail -n100 -f /var/log/messages +test -f /var/log/syslog && tail -n100 -f /var/log/syslog diff --git a/config.yml b/config.yml index a6009d0..5fdac56 100644 --- a/config.yml +++ b/config.yml @@ -56,6 +56,30 @@ ansible.builtin.selinux: state: disabled + - name: Create bin directory + file: + path: /opt/atclab/bin + state: directory + mode: '0755' + owner: root + group: root + + - name: Copy etc configs + copy: + src: etc/profile.d/ + dest: /etc/profile.d/ + owner: root + group: root + mode: '0644' + + - name: Copy bin scripts + copy: + src: bin/ + dest: /opt/atclab/bin + owner: root + group: root + mode: '0755' + handlers: - name: Restart sssd service: diff --git a/etc/profile.d/aliases.sh b/etc/profile.d/aliases.sh new file mode 100644 index 0000000..69eaf65 --- /dev/null +++ b/etc/profile.d/aliases.sh @@ -0,0 +1,16 @@ +alias ll='ls -al' +alias lr='ls -altr ' +alias lh='ls -alh ' +alias ..='cd ..' +alias ...='cd ../..' +alias psaux='ps aux' +alias llh='ls -alh ' +alias ldir='ls -l | grep ^d' +alias suroot='sudo su -' +alias cdlab='cd /opt/atclab/' +alias lowercase='mmv "*" "#l1"' +alias lowerext='mmv "*.*" "#1.#l2"' +alias varlog='cd /var/log' + +#alias showlog='sudo cat /var/log/messages | tail -1000' +#alias trlog='sudo tail -fn1000 /var/log/messages' diff --git a/etc/profile.d/atclab.sh b/etc/profile.d/atclab.sh new file mode 100644 index 0000000..fda685d --- /dev/null +++ b/etc/profile.d/atclab.sh @@ -0,0 +1,2 @@ +pathmunge /opt/atclab/bin after +pathmunge /opt/atclab/sbin after diff --git a/etc/profile.d/zzz_nocolors.sh b/etc/profile.d/zzz_nocolors.sh new file mode 100644 index 0000000..48446e9 --- /dev/null +++ b/etc/profile.d/zzz_nocolors.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# =========================================================================== +# Title : zz_nocolors.sh +# Description : Disable LS colors if /etc/nocolors exists +# Author : Bart Sjerps +# License : GPLv3+ +# --------------------------------------------------------------------------- + +test -f /etc/nocolors || return +alias ls &>/dev/null && unalias ls +alias ll='ls -al ' +alias l.='ls -d .* ' +export S_COLORS=never diff --git a/group_vars/all.yml b/group_vars/all.yml index 474ad54..7fed1b9 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -1,29 +1,29 @@ common_packages: - - epel-release - - sssd - - sssd-ldap - - net-tools - - screen - - lsof - - sudo - - sssd - - xfsprogs - - parted - - wget - - tar - - bzip2 - - unzip - - autofs - - nfs-utils - - bash-completion - - git - - sysstat - atop + - autofs + - bash-completion + - bzip2 + - dstat + - epel-release + - git - htop - iftop - iotop - - pv - - dstat + - lsof + - net-tools + - nfs-utils - nmap + - parted + - pv + - qemu-guest-agent - rsync + - screen + - sssd + - sssd-ldap + - sudo + - sysstat + - tar + - unzip - vim + - wget + - xfsprogs diff --git a/inventory.ini b/inventory.ini index 97d0b7a..cc01776 100644 --- a/inventory.ini +++ b/inventory.ini @@ -7,3 +7,4 @@ atc-elastic01.dell-atc.lan ansible_user=root atc-kafka01.dell-atc.lan ansible_user=root atc-portal01.dell-atc.lan ansible_user=root atc-grafana.dell-atc.lan ansible_user=root +atc-test01.dell-atc.lan ansible_user=root