diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92cba2a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +host_vars diff --git a/ansible.cfg b/ansible.cfg index 6bb04a0..ad1116c 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -6,7 +6,7 @@ remote_tmp = /tmp/.ansible-${USER}/tmp gathering = smart gather_timeout = 600 fact_caching = jsonfile -fact_caching_connection = /etc/ansible/facts +fact_caching_connection = /etc/ansible/facts.d fact_caching_timeout = 300 retry_files_enabled = False forks = 40 diff --git a/baseos.yml b/baseos.yml index 84393e8..cf60797 100644 --- a/baseos.yml +++ b/baseos.yml @@ -1,5 +1,5 @@ --- -- name: Provision hosts using the jchristianh.baseos Ansible collection +- name: Deploy a standardized base configuration hosts: all become: yes gather_facts: yes @@ -17,7 +17,7 @@ - name: Include relevant role(s) include_role: name: "{{ item }}" - loop: "{{ baseos_include_roles }}" + loop: "{{ __baseos_include_roles }}" ... diff --git a/files/lxcmon.pl b/files/lxcmon.pl new file mode 100755 index 0000000..4915991 --- /dev/null +++ b/files/lxcmon.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use strict; + +# > ls /var/lib/lxc +# cnode1/ cnode2/ cnode3/ cnode4/ cnode5/ + +my @nodes = `ls /var/lib/lxc`; + +for (@nodes) +{ + chomp $_; + + my $mac = `grep hwaddr /var/lib/lxc/$_/config|grep -v '#'`; + $mac =~ s/.*?=\s+(.*?)/$1/; + + print `lxc-info -n $_`; + print "MAC Addr:\t$mac\n"; +} diff --git a/files/lxcmon2.pl b/files/lxcmon2.pl new file mode 100755 index 0000000..349918e --- /dev/null +++ b/files/lxcmon2.pl @@ -0,0 +1,20 @@ +#!/usr/bin/perl + +use strict; + +# > ls /var/lib/lxc +# cnode1/ cnode2/ cnode3/ cnode4/ cnode5/ + +my @nodes = `ls /var/lib/lxc`; + +for (@nodes) +{ + chomp $_; + + my $mac = `grep hwaddr /var/lib/lxc/$_/config|grep -v '#'`; + $mac =~ s/.*?=\s+(.*?)/$1/; + + print "Name:\t\t$_\n"; + print `lxc-info -n $_ -is`; + print "MAC Addr:\t$mac\n"; +} diff --git a/files/root.bashrc b/files/root.bashrc new file mode 100644 index 0000000..66f2382 --- /dev/null +++ b/files/root.bashrc @@ -0,0 +1,82 @@ +# /etc/skel/.bashrc: +# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bashrc,v 1.7 2002/11/18 19:39:22 azarah Exp $ + +# This file is sourced by all *interactive* bash shells on startup. This +# file *should generate no output* or it will break the scp and rcp commands. + +######## TTY Colours ####### + +export LESS_TERMCAP_mb=$'\E[01;31m' +export LESS_TERMCAP_md=$'\E[01;31m' +export LESS_TERMCAP_me=$'\E[0m' +export LESS_TERMCAP_se=$'\E[0m' +export LESS_TERMCAP_so=$'\E[01;44;33m' +export LESS_TERMCAP_ue=$'\E[0m' +export LESS_TERMCAP_us=$'\E[01;32m' + +### linux console colors (jwr dark) ### + +if [ "$TERM" = "linux" ]; then + echo -en "\e]P0000000" #black + echo -en "\e]P83d3d3d" #darkgrey + echo -en "\e]P18c4665" #darkred + echo -en "\e]P9bf4d80" #red + echo -en "\e]P2287373" #darkgreen + echo -en "\e]PA53a6a6" #green + echo -en "\e]P3914e89" #brown + echo -en "\e]PBbf85cc" #yellow + echo -en "\e]P4395573" #darkblue + echo -en "\e]PC477ab3" #blue + echo -en "\e]P55e468c" #darkmagenta + echo -en "\e]PD7e62b3" #magenta + echo -en "\e]P631658c" #darkcyan + echo -en "\e]PE6096bf" #cyan + echo -en "\e]P7899ca1" #lightgrey + echo -en "\e]PFc0c0c0" #white + clear # bring us back to default input colours +fi + + +# colors for ls, etc. +alias bc="bc -q" +alias d="ls --color" +alias ls="ls -F --color=auto" +alias ll="ls --color -al" +alias cls="clear" +alias kansai="ssh kansai" +alias amaterasu="ssh amaterasu" +alias tokyo="ssh tokyo" +alias tm="clear;tail -f /var/log/messages" +alias tz="clear;tail -f /virtual/thezengarden.net/logs/access_log" +alias nslookup="nslookup -sil" +#alias do="sudo" +alias watch="watch -t -n 2" +#alias up="watch -t -n 10 uptime" +alias loads="/home/chris/scripts/monitor/loadwatch.sh" +alias wwwrestart='/home/chris/scripts/www/restart_webnodes.sh' + +alias block="/home/chris/scripts/ipblock.sh" + +alias update="/home/chris/scripts/update_system.sh" + +alias localtime=\ +'perl -e '\''print scalar localtime(shift||time),"\n"'\''' + +alias bigfiles="find . -maxdepth 15 -type f -exec du -ckx {} \; | grep -v total | sort -rn > /home/chris/files.lst" +alias top10="du -a . | sort -nr | head -n 10" + + +export PS1='\h: \[\033[1;31m\]\w\[\033[0m\]\[\033[0m\]> ' + +export EDITOR=vim + +# find partition name for a given filename +findpart() { [ -e "$1" ] && df -P "$1" | awk '/^\/dev/ {print $1}' || echo "$1 not found"; } + +export XDG_CONFIG_HOME="/home/chris/.config" +export TERM="xterm-256color" + + +#alias lxcmon='watch -t -n .3 "grep hwaddr /var/lib/lxc/*/config|grep -v '\''#'\'';echo && echo "running containers:" && lxc-ls --active"' +alias lxcmon='watch -t -n .3 /root/lxcmon.pl' +alias lxcmon2='watch -t -n .3 /root/lxcmon2.pl' diff --git a/inventory/hosts b/inventory/hosts index 29d66f4..34d4031 100644 --- a/inventory/hosts +++ b/inventory/hosts @@ -1,3 +1,2 @@ -debian-test ansible_host=10.1.1.41 -centos-test ansible_host=10.1.1.27 ansible_user=root -tumbleweed-test ansible_host=10.1.1.86 +centos-test ansible_host=10.1.1.39 ansible_user=root +debian-test ansible_host=10.1.1.43 ansible_user=root diff --git a/vars/baseos_vars.yml b/vars/baseos_vars.yml index fcb0eb9..ef40d28 100644 --- a/vars/baseos_vars.yml +++ b/vars/baseos_vars.yml @@ -1,11 +1,13 @@ --- -baseos_include_roles: - - base_packages - - update_all_packages - - etc_hosts +__baseos_include_roles: - resolv_conf - - snmpd_conf + - hostname + - etc_hosts + - bashrc - motd + - update_all_packages + - base_packages + - snmpd_conf ...