Ansible: Reboot the server and pick up where it left off.

Nov 26 2018

Here's the situation: You're using Ansible to configure a machine on your network, like a new Raspberry Pi.  Ansible has done a bunch of things to the machine and needs to reboot it - for example, when you grow a Raspbian disk image so that it takes up the entire device, it has to be rebooted to notice the change.  The question is, how do you reboot the machine, have Ansible pick up where it left off, and do it in one playbook only (instead of two or more)?

I spent the last couple of days searching for specifics and found a number of techniques that just don't work. After some experimentation, however, I pieced together a small snippet of Ansible playbook that does what I need.  Because it was such a pain to figure out I wanted to save other folks the same trouble.  Here's the code, suitable for copying and pasting into your playbook:

...the first part of your playbook goes here.
    - name: Reboot the system.
      shell: sleep 2 && shutdown -r now
      async: 1
      poll: 0
      ignore_errors: true
    - name: Reconnect and resume.
      local_action: wait_for
      args:
        host: bob-newhart
        port: 22
        state: started
        delay: 10
        timeout: 30
...the rest of your playbook goes here.

Specifics of proof of concept for later reference:

  • Ansible v2.7.0
  • Raspberry Pi 3
  • Raspbian 2018-06-27

VLC crashes when trying to play stuff over the network from Kodi.

Dec 02 2018

This took me a while to figure out, so here's a fix for an annoying problem:

Let's say that you have a media box running Kodi on your local area network.  You have uPNP turned on so you can stream videos from your media box across your LAN.  You want to use VLC to watch stuff across your LAN.

Problem: When you select your Kodi box in VLC and double-click on the server to open the directory of media to watch, VLC crashes with no error message (even in debug mode).

Explanation: VLC is configured to exit when the current playlist is over.  This includes downloading a playlist across the network, and is really irritating.

Solution: In VLC, go to Tools -> Preferences -> Show Settings: All.  Scroll down to Playlist.  Un-check Play and Exit.  Save.

Enjoy!

Build your own time server with a GPS receiver.

Nov 24 2018

If you've had your ear to the ground lately, you might have heard that the NIST timekeeping radio station used by devices all over the world as a time reference for Coordinated Universal Time as well as some experiments in signal propagation and geophysical event notices might be on the chopping block in 2019, leaving the HF bands quieter and, let's face it, we can't have nice things.  Clocks that rely on this time source signal won't have any way to stay in sync and the inevitable drift due to the imperfections in everything will cause fractions of second to be lost and a fresh outbreak of kinetic pattern baldness.  The ultimate effects of this latest bit of clueless petulance on the part of Donald Trump remain to be seen, but it seems likely that this isn't a sexy enough problem to catch brainshare like Y2k did.  If you work extensively with computers chances are you're not that worried because your machines use NTP - the Network Time Protocol - to synch their internal clocks with a known time reference server on the Net someplace.  Something to consider, however, is whether or not your upstream tier-one and tier-two time sources are actually using the NIST WWV time singnals as their reference signals.  There is, however, a nifty way around this: Build your own NTP server that uses a reference time source that can't be shut off as a source, the Global Positioning System.

First, I'll show you how to build your own GPS time server, and then I'll explain why it works.

Click for the rest of the article...

Neologism: Ablumeditation

Nov 13 2018

ablumeditation - verb - The act of taking a bath or shower to take a break from working on a problem, in the hope that insight will strike.

Neologism: Sharkfinning

Nov 03 2018

sharkfinning - verb, gerund - Learning something from scratch in an entirely hands-on way, which is to say, "Swimming with the sharks."  When you don't know what you're doing or how to do it, but you have a job to do.

Technomancer Tools: Note taking with Joplin.

Oct 30 2018

Some time ago I began a search for a decent note-taking tool that I could carry around with me.  For many years I was a devotee of the notes.txt file on my desktop, constantly open in a text editor so I could add and refer to it as necessary.  When that ceased to scale I turned to software that replicated the legions of sticky notes on my desks at work and home, such as Tomboy.  And that worked well enough for a while, but when I started relying upon my mobile more and more for things it too stopped being as useful as I wanted it to be.  For about a year I turned to Simplenote, which is pretty much what it says on the tin: It's a note-taking system with a nice web interface, applications on all of the platforms that I use regularly, and even a command line utility which I used to back up my notes a couple of times a day.  However, Simplenote is a centralized service and there is always a risk that it could go away at any time.  At the very least, the switchover to the Simperium API could have caused problems in the near term for me, and I have enough on my plate these days that I didn't feel like fighting that particular war.  So, the search for a replacement that relied more upon my own infrastructure than someone else's began.

Click for the rest of the article...

Neologism: Faraday roundtable

Oct 22 2018

Faraday roundtable - noun phrase - A meeting conducted entirely offline.  All portable devices and computers are powered down, and ideally locked inside conductive and grounded containers to prevent radio transmissions from reaching or being emitted from same.  Similarly, no active computers are permitted at the meeting.  The proceedings of such a meeting are carried out using Chatham house rules.

Named for the Faraday cage.

Life and times.

Oct 14 2018

Long time readers are probably wondering where I've been lately.  The answer is kind of long and is worth a post all on its own.  The short version of the story is, work's been eating me alive lately.  This is our busiest time of year and it's been all hands on deck for a couple of weeks now.  In point of fact, last week was our quarterly all-hands meeting, where everybody on my team was flown into town for a solid week of meetings.  All day, every day.  Most of my visible activity lately took the form of parts of my exocortex running on automatic with some hit-and-run posting while waiting for the coffee maker at work to top me up in between meetings.

This also means that I haven't had a whole lot of patience for interacting with people.  Not in the sense that people can feel frustrated with other people or their actions, but in the sense that interacting with people in a meaningful way - having a real conversation - takes more compute cycles than I have available right now.  After fourteen hours in a conference room with 40 other people, not only am I out of social, but I'm mentally exhausted.

Click for the rest of the article...

It's a bit of a surprise when I don't have enough processing power.

Oct 13 2018

Earlier this year I got back into urban hiking by taking up war walking again around home.  Not too long after that, I started picking up buzz that upcoming versions of Android are specifically not going to make it easy (or probably possible) to wardrive or war walk by changing how the wifi drivers work.  By this, I mean they're making it possible to trigger a wireless scan once every two minutes instead of whenver you ask it to.  Unsurprisingly, if you read through that ticket's comments this is going to break a lot of other applications out there, but when you're the 500 pound gorilla you can pretty much dictate terms, and to hell with what your users actually ask for.

Yeah, I'm still bitter about that.  Moving on.

Click for the rest of the article...

Neologism: Squirrel clever

Oct 01 2018

squirrel clever - noun complex - The state of being extremely smart when it comes to figuring out how to do something.  Notably, this does not include figuring out whether or not one should do something.