Tuesday, February 27, 2018

Ansible: Part Three

So at work I'm tasked with hardening the new Wildfly environment which consists of 1xdev, 2xuat and 4xprod servers.

I *had* plans on using this as an opportunity to pound our some Python but after a learned recommendation from a friend in IRC I went the Ansible route and boy am I glad I did!
I can't quite recall what happened last year when I tried and failed twice.. but yesterday I had a simple ping command working and hitting all 7 servers within an hour's time.  Last night I banged out half a dozen cursory playbooks within 4 hours and today I've got a working couple of playbooks that are furthering me to my goal of World Domina.. err automating the things.

Wednesday, February 7, 2018

SCP files thru multiple proxy hosts

I realize this might be old-hat for quite a few but I just learned it and this will save me so bloody much time!

While there are multiple ways of doing this.. including editing your .ssh/config file to include a similar reference I am choosing the full CLI method.

So first off make sure netcat (nc) is installed on all hosts.  Then craft a string as such:

scp -o ProxyCommand="ssh first_host nc second_host 22" /local/path/to/file user@target_host:/dest/path


So what I have done here is to ssh proxy through host1, to host2 then scp'd from host2 to target_host.  Which in my case was exactly what I needed since this new Java environment requires me to jump through two proxies to reach my target.

Like I said I know this is old stuff to a large percentage of you Unix/Linux admins but hopefully this will help someone.

Wednesday, January 31, 2018

Dynamically naming Konsole tabs

So at work I use Fedora 27, and I administer quite a number of Linux servers.. So since I run the Plasma desktop environment (DE) I use the terminal emulator Konsole.  The Konsole window uses tabs.. much like modern internet browsers to help you multitask instead multiple full windows.

So anyway when you open Konsole the opening tab is named with, by default, username and current directory. If you SSH into a remote host the tab name changes to username and remote host.. which is very cool.  However if you further SSH into another host from the first the tab name remains the same as it was.  Which.. for me anyway leads to mass confusion if you have more than a couple tabs open.

So one of the fine folks in teh Fedora User mailing list tossed me a bone today.. I inquired about being able to change the tab name based on remote hostname past the first remote host.  Here's what he gave me:

    chpwd() {
        [[ -t 1 ]] || return
        case $TERM in
            sun-cmd) print -Pn "\e]l%~\e\\"
            ;;
            *xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;[%m] %~\a"
            ;;
            vt220) print -Pn "\e]2;[%m] %~\a"
            ;;
        esac
    }

    chpwd


So.. I'll admit that I do not quite understand the % or print syntax as of yet.. however adding this tidbit to the end of my .zshrc file then within Konsole changing the tab and remote tab fields to %w did exactly what I wanted to do and more.
The more part meaning that now my tab names also include the username@hostname but also the full path where I am at currently in that remote host.  Honestly its too much info for a small pane.  But it's a damned fine start!


Friday, January 19, 2018

So it's been a while..

Been quite a while, actually, since my last post. Been busier than ever really, with work and home stuff and doing all I can to get out and enjoy Montana.

Back during the summer and fall I try to get out and hike once a week.. whether its Mt. Helena or just out in the woods around the Wickes mine.   Also got to hunt this year, which is always a good time.  Got my first Montana whitetail this year too! (or well technically last year but yeah)



Driving down an unnamed road, because yeah like I'm going to give out my secret hunting spots.. A truck leaving a driveway had the passenger hanging out of the window pointing up and across the road.  I swivel my head to see this big 8 point standing there looking all majestic like.  So TL;DR I was able to sneak within 50 yards and popped him.  Single shot, through and through lungs. He ran maybe 20 yards and fell. The last day of season, the last 20 minutes of daylight :)

Sadly though I did not get to get him with a new scope I got for christmas:



A no-name Amazon purchase, 6-24x52mm.. you can really reach out and see your target.  Mounted on the Ruger American LH bolt-action in a stainless 30-06 package, it was the All Weather model.  And being perfectly honest, I went for the stainless after seeing Glenn Villenue on Life Below Zero's rifle.

Anyway I do have some pictures to post here from the places I've hiked thus far.. so damn beautiful here.  I love it.

Wednesday, August 30, 2017

DavMail, Thunderbird and Systemd..

So I can't recall if I posted about this or not but since switching full time to Fedora I've had to get creative with email clients.  Since Evolution is clunky and rather ugly I decided to brave the DavMail world with Thunderbird.

Now for quite a while I've been suffering through DavMail just quitting on me.  Nothing gets logged anywhere, the pid just dies. However today in #systemadmins I tossed out a question and it was fielded by a guy who I'd consider quite the senior in the whole *nix/SysAdmin world.  Dude took less than 20 minutes and had me a working systemd.service file that will run automagically and restart if it happens to die, oh and get this.. it will LOG too! *giggle*

Here's the file for those interested:

[Unit]
Description=DavMail Exchange Gateway
Requires=network.target
After=network.target
[Service]
Type=simple
RemainAfterExit=no
#ExecStart=/usr/bin/davmail /etc/conf.d/davmail.properties
#ExecStop=killall davmail
Environment=BASE=/path/to/davmail-linux-x86_64-4.8.0-2479/
Environment=PROPERTIES=/path/to/.davmail.properties
ExecStartPre=/usr/bin/bash -c "for i in $BASE/lib/*; do /usr/bin/systemctl set-environment CLASSPATH=${CLASSPATH}:$i ; done"
ExecStart=/usr/bin/java -Xms1G -Xmx1G -Djava.awt.headless=true -XX:ErrorFile=/tmp/davmail_errors.log -XX:-HeapDumpOnOutOfMemoryError -Dsun.net.inetaddr.ttl=60 -cp ${BASE}/davmail.jar:${CLASSPATH} davmail.DavGateway ${PROPERTIES}
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target