Had a somewhat curious situation: need to run a task in Ansible in different user accounts, but I don’t have sudo
or su
access, only ssh access for every account. Took me a moment to figure out how to do that.
Had a somewhat curious situation: need to run a task in Ansible in different user accounts, but I don’t have sudo
or su
access, only ssh access for every account. Took me a moment to figure out how to do that.
For one project I need to insert the content of a local file into another file on the remote system, and the first file happens to be JSON. The JSON file is in compact format (jq --compact-output
) and is supposed to stay this way. When Ansible reads the content of the file, it determines that the content is JSON, and parses the content into the variable - and along the way is uncompressing the format. Not what I want.
To keep the file content as string, it is necessary to tell Ansible to handle this as string.
In a more complex openHAB2 Rule I’m writing, I need to find out if a certain Item exist. If I try to access it when it does not exist, the Rule will fail. Not good.
I could pass in a parameter to the framework which builds the Rule, but that is cumbersome and requires changes on several places.
Let’s see if I can have the Rule figure this out.
Was running in a stupid problem where Ansible (version 2.9.x) throws an error when a variable is defined. The Play:
For testing I did spin up a couple of new virtual (Ubuntu 20.04 LTS) instances, installed PostgreSQL, and wanted to copy over a .sql
file to install in the database:
Ansible has a very useful module “postgresql_ping” which checks connectivity to the database server. I’m using it in quite a few Playbooks as first step just to ensure that the database server is present - this fails early if there is a problem which otherwise just prevents the rest of the Playbook to work properly.
There are a number of ChromeCasts in our setup. I’m adding (physical) switches to turn displays on and off, and primarily control the volume. When I turn the display off, I also want the ChromeCast to stop doing whatever it is doing right now (stop streaming), and go back to the default application (for video CC).
Recently I installed a number of new power sockets (like this one). The Hue bridge can not only add each switch to a light group, but also reports each plug as a Thing in openHAB. There I thought it will be a nice touch if openHAB actually reports when it sees a device plugged in. The power socket has a LED which turns on when the plug is on. The Hue bridge reports OFFLINE
and ONLINE
. That’s useful.
The plan is to turn the LED light - and the power plug - on and off for a few second.
Was asked quite a few times how I do my backups with Restic.
For more than 10 years I was using “Duplicity” for backups, but in 2019 I changed to Restic. The main reason for the change was that Duplicity still can’t handle “Big Data”, as in: larger directories. In 2009 someone opened an issue on the Duplicity bugtracker, and this problem still exists as of today. For about two years I was shifting around the problem, excluding files, trying to make the sigfile smaller. But at some point I decided that it is enough and I need to change the tool.
The openHAB rule system is not very helpful by pointing out when it’s missing something, or when there is an error to actually point to the problem.