Finding changes in an ansible run output

As you can tell I work a bit with ansible. Once you get a few longer playbooks, or have to deploy to hundreds of hosts it can get a bit tedious to search through the output to find “ok, what changed?”

ARA can be a big help in such situations, but good old sed will also do nicely in a pinch:  sed -n '/^--- before/,/^changed/p' ansible_output  for bonus points you can pipe the output to colordiff 

Ansible 2.7 oddities

One of the changes with ansible 2.7 is how you are supposed to pass a list of packages to a package module. instead of passing a list via with_items (which then get’s squashed into one call anyway), you just pass the whole list.
Apt as an example:

ansible <= 2.6

ansible <= 2.7

What the documentation doesn’t touch is how to pass multiple lists.
The error output suggests using ['{{ list1 }}', '{{ list2 }}'], but ansible throws a fit if you do that. Turns out you can also concatenate lists with the + sign. So the solution looks like this:

Updating foscam firmware via API

Foscam just released a new round of firmware updates. The suggested process to deploy firmware updates involves using the web interface. I’m hoping newer models are less of a hassle, but older models require the user to install an .exe and use internet explorer 10 or hope that your browser is old enough to allow you to enable NPAPI.

That pretty much rules out Linux, Mac, and up-to-date browsers on Windows.

But fear not, the devices have an API (for some reason they deleted any references/links to it from their forum, but I found a version here).

The API comes with its own share of odd quirks, but to update the firmware without a browser you can use the following CURL command

curl --output - --connect-timeout 15 --max-time 180 -H 'Expect:' --form 'image=@FOSIPC_A_patch_ver_whatever.bin' --request POST '' 

Replace the username and password with an account with admin privileges, the IP with the IP of your device, and the .bin file with the latest patch for your device.

Note: If your admin username or password contain any non alphanumeric characters, you need to Urlencode them. There are multiple ways to do this (perl, python, jq), but I’ll assume you have curl installed and can do
echo -n '$uper$secure' | curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-

Blog cleanup

Today I cleaned the blog up a little. I removed the (hard to read) main menu at the top and moved the relevant topics over to the sidebar into the “More information” box. Makes information easier to find and the top of the page is a bit slimmer.

I also added a new page with an overview of a few of the more interesting public and private (web) services I’m running. This makes it easier for me to update the page when I add or remove a service, and easier for you all to see what I’m running, how to reach it, and what kind of uptime can be expected.

And last but not least I switched out the font to something that is slightly better readable with this layout and color scheme and tweaked the CSS a little bit.