Today I will finally announce the availability of my new open source application MJ Inventory. Yes … I am still looking for a better name.
In the previous post I talked a bit about the motivation behind the project. Now comes the release in the tradition of the bazaar. Release early, release often. Its still not completely clear where this project is going but here it is. Let’s see if someone else is finding it useful. Or even if it is working for anyone but me :).
The application is written in the elixir programming language. The gui a phoenix liveview app.
There is a presentation available that is intended to be a mixture of introduction and documentation. It is also available in the git repository in the doc/ folder.
The Readme file gives some documentation either and the instructions on how to hopefully successfully building the application.
The project lives on github for now.
Next step would be a video/screencast about it. But that turns out to be difficult :). Having not much experience with that.
]]>My day-to-day job is no longer programming. Started there but slowly got into Build and Configuration Management, then Release Management and finally did some jobs as a deployer. You could say now I do anything AFTER the source code is ready. Build, Release, Deployment, Monitoring and Test Automation (CI/CD).
In the last years, perhaps even decade, the idea of using development techniques during all stages of the delivery pipeline became much more popular and gained a name: DevOps. I started from development so its kinda second nature to me to use version control, separate configuration from code and do testing. Ok … on the last part there is still room for improvement :).
One of the tools I used a lot for this in the last decade is reclass (https://reclass.pantsfullofunix.net/). It was developed as a drop in replacement for the included inventories of ansible, puppet and SaltStack with much better defined rules.
It is also useful without these tools. The end result is one big json or yaml file with your complete configuration. You just read it and act accordingly. I used it over the times to:
Some of my colleagues call it a “reclass fetish”. Not sure why :).
I will not go into detail here now how it works. It defines the concept of classes and nodes, rules for inheritance and how to merge the configuration. Lists get appended, Maps get merged but it is also possible to just override them. Check the documentation for more.
The whole concept just has one problem. Its very elegant, very concise and very hard to understand if the inventory is big, and you didn’t create it. Or if you created it half a year ago. I always wanted a graphical tool that would help me stay on top of my ever growing reclass configuration databases.
Later i could implement some additional features on top of what reclass currently provides. Even if reclass works perfectly fine its kind of unmaintained right now. There are some forks out there that added functionality.
End of last year I actually started to develop this tool. A elixir / phoenix liveview application that in its first iteration will be
Having achieved this I plan to slowly enhance its functionality.
In my next post I want to show a short video of the apps current state. The source code should be opened soon after. I just have to decide on a license. Never open sourced an app like this so not sure what the best license is. Any pointer welcome.
Michael
]]>Just a short announcement that I pushed some commits to github https://github.com/jansenm/systemd-plasmoid and tagged a release 2.0.1. The first ever with a tag. Unfortunately I am not that sure I did that right so in case someone out there packages this and needs more just complain.
The source code now is fully reuse compatible.
$ reuse lint
# SUMMARY
* Bad licenses:
* Deprecated licenses:
* Licenses without file extension:
* Missing licenses:
* Unused licenses:
* Used licenses: CC0-1.0, LGPL-2.1-or-later
* Read errors: 0
* Files with copyright information: 42 / 42
* Files with license information: 42 / 42
Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)
Environment Modules is one of those open source projects that I wish more people would know and use. I always wonder why tools like asdf don’t provide support for it instead of rolling their own implementation. So lets increase awareness.
The Environment Modules package provides for the dynamic modification of a user’s environment via modulefiles.
So what does it do? Here is a small example:
~ $ type ansible
bash: type: ansible: not found
~ $ module avail -l ansible/
- Package/Alias -----------------------.- Versions --------.- Last mod. -------
/home/mjansen/local/etc/modules:
ansible/2.8.15 2.8 2020/10/28 18:43:05
ansible/2.9.13 2.9 2020/10/28 18:43:15
ansible/2.10.1 2.10:default 2020/10/28 18:42:56
~ $ module load ansible/2.9.13
~ $ ansible --version
ansible 2.9.13
config file = None
configured module search path = ['/home/mjansen/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/mjansen/local/opt/ansible/2.9.13/lib64/python3.8/site-packages/ansible
executable location = /home/mjansen/local/opt/ansible/2.9.13/bin/ansible
python version = 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC]
~ $ type ansible
ansible is hashed (/home/mjansen/local/opt/ansible/2.9.13/bin/ansible)
~ $ module unload ansible
~ $ type ansible
bash: type: ansible: not found
So in short environment modules allow you to alter your shell session dynamically by
Modulefiles are actually tcl scripts. It is a slightly weird (imo) looking scripting language. Tcl and environment modules are available forever. They are from the 1990s.
The ansible script above looks like this:
#%Module1.0#####################################################################
##
## ANSIBLE VERSION
##
proc ModulesHelp { } {
global version
puts stderr "\tActivates ansible v$version [ARA]"
}
set home $::env(HOME)
set version 2.9.13
set root $home/local/opt/ansible/$version
set ansible_callback_plugins [exec $root/bin/python3 -m ara.setup.callback_plugins]
module-whatis "Ansible V$version"
conflict ansible
append-path PATH $root/bin
setenv ANSIBLE_CALLBACK_PLUGINS $ansible_callback_plugins
So why should you care. As a hypothetical developer you probably need to install different versions of libraries and tools to check your programs against or with. Like different Qt Versions or compiler. Most developer I know then proceed to use shell scripts they source to deal with that. This does not allow easy unloading and switching. Utilizing environment modules gives you a much more pleasant experience. My list currently looks like this:
- Package/Alias -----------------------.- Versions --------.- Last mod. -------
/home/mjansen/local/etc/modules:
ansible/2.8.15 2.8 2020/10/28 18:43:05
ansible/2.9.13 2.9 2020/10/28 18:43:15
ansible/2.10.1 2.10:default 2020/10/28 18:42:56
catt 2019/08/26 14:58:23
editor/vim 2020/10/26 19:39:10
elixir_escripts 2020/11/11 05:29:32
elm/0.19.1-3 0.19:0.19.1:default 2020/03/31 22:24:21
go/1.13.6 2020/01/21 16:06:16
gopath 2020/01/21 16:16:09
groovy/2.4.7 2019/08/26 14:58:23
groovy/2.5.7 2019/08/26 14:58:23
home_install 2020/02/23 16:20:05
hugo/0.76.5 2020/10/28 18:46:11
hugo/0.80.0 2021/01/09 21:07:52
java/jdk1.8.0_172 2019/08/26 14:58:23
jupyter 2019/08/26 14:58:23
maven/3.3.9 2019/08/26 14:58:23
minishift 2020/03/29 16:29:17
novisual 2019/08/26 14:58:23
reclass/1.4.1 2020/01/27 14:27:20
reclass/git 2020/12/20 19:51:34
usr_local 2020/01/29 13:36:42
vit 2020/01/15 17:01:25
zeppelin/0.9.0-preview2 2020/10/29 16:42:13
Environment modules also has the concept of sessions which allows you to save and load different configurations. Either in
a central location (eg. ~/.module
) or to a file specified on the command line.
~ $ module save homepage
~ $ module savelist
Named collection list:
1) homepage
~ $ module saveshow homepage
-------------------------------------------------------------------
/home/mjansen/.module/homepage:
module use --append /home/mjansen/local/etc/modules
module load editor
module load gopath
module load go
module load hugo
-------------------------------------------------------------------
Modulefiles can even specify conflicts, so you don’t load two different versions of a library or program. They can also specify requirements, so you don’t forget to load a python version before loading ansible.
If you want to try environment modules one word of warning. In opensuse after installing environment modules it is not active. I guess the same applies to other distros. Shell initialization files for additional packages are a sore spot in most distros. You have to activate it manually in your shell initialization file (eg. bashrc).
# ACTIVATE ENVIRONMENT MODULES # {{{2
###############################################################################
case "$0" in
-sh|sh|*/sh) modules_shell=sh ;;
-ksh|ksh|*/ksh) modules_shell=ksh ;;
-zsh|zsh|*/zsh) modules_shell=zsh ;;
-bash|bash|*/bash) modules_shell=bash ;;
esac
source /usr/share/Modules/init/$modules_shell
test -r /usr/share/Modules/init/{$modules_shell}_completion && source /usr/share/Modules/init/{$modules_shell}_completion
Given no one seems to be interested in working on the applet (boo) I decided to tackle the bug myself. Apparently the fact it worked previously was the result of happenstance.
The systemd manager processes only send out signals after at least one process told them to do so. It seems that some process did that on my computer before but no more. From the doc:
Subscribe() enables most bus signals to be sent out. Clients which are interested in signals need to call this function. Signals are only sent out if at least one client invoked this function. Unsubscribe() undoes the signal subscription that Subscribe() implements. It is not necessary to invoke Unsubscribe() as clients are tracked. Signals are no longer sent out as soon as all clients which previously asked for Subscribe() either closed the bus connection or invoked Unsubscribe().
After adding the call now the applet notices state changes for units on the session manager too.
Next step is proper licensing. Getting it reuse compatible.
Then moving it over to kde infrastructure.
]]>The attempt actually led to a result which was neither pretty nor perfect, but it worked. I put it on github https://github.com/jansenm/systemd-plasmoid and used it locally. No formal announcement was ever done and my plan to put it into kde infrastructure kinda never realized too.
Fast-forward nearly a year and some aspect of the applet stopped working. It no longer notices if you stop a service manually on the session service manager. For the system service manager it works. Unfortunately I realized I am no longer interested in this kind of programming. And that i kinda forgot everything i learned a year ago :).
The solution. Make an announcement to check if someone else is interested in taking over the applet.
So are YOU interested in taking over? I consider it a very useful applet and would hate to see it perish. I would assist in moving it over to kde infrastructure.
Btw … is it applet or widget? There seems to be some inconsistent naming.
]]>As i did a clean reinstall once again resolv.conf was not updated when starting my libvirt networks so no dns resolve of vm names. Not sure if that is a bug or expected behaviour but i had it with 13.2 too and consider it a REAL bug. Or at least major annoyance.
Adding the ip address statically to resolv.conf is not a option. This is a notebook so most services do not get started on default. Which includes libvirtd.
The solution i came up with is to add a libvirt hook that registers the libvirt dnsmasq instance with netconfig when starting libvirt networks and removing it when stopping it. Not much explanation … just code for your convenience.
The script could be improved i guess. Check if dhcp is configured for the network and so on or if dnsmasq is configured for the network in libvirt. But for me it works as is.
#!/bin/sh
# vim: et sw=0
# See https://www.libvirt.org/hooks.html
OBJECT="${1}"
OPERATION="${2}"
SUB_OPERATION="${3}"
EXTRA_ARGS="${4}"
# Get the configuration from STDIN
config=$(cat)
# Extract the interface and ip addr
iface=$(sed -ne "s/^.*bridge *name='\([a-zA-Z0-9_]*\).*$/\1/p;" <<<"${config}")
ipaddr=$(sed -ne "s/^.*ip *address *= *'\([0-9.]*\).*$/\1/p;" <<<"${config}")
function check_suboperation() {
local operation= shift;
local expected= shift;
if [ "${oper}" != "${expected}" ]; then
echo "WARN: Unknown sub-operation ${oper} encountered!" >&2
exit 1
fi
}
case "${OPERATION}" in
started)
check_suboperation "${SUB_OPERATION}" "begin"
netconfig modify -v --service libvirt --interface "${iface}" -v <<< "DNSSERVERS='${ipaddr}'"
;;
stopped)
check_suboperation "${SUB_OPERATION}" "begin"
netconfig remove -v --service libvirt --interface "${iface}" -v <<< "DNSSERVERS='${ipaddr}'"
;;
esac
exit 0
This script is put under the unlicense license.
]]>I hope to be able to blog more in the next months. It will be less build-tool and more ansible, jenkins, docker and automation in general. And python. And IDEA.
Btw. for those of you out there that actually used build-tool here the official announcement: Its dead. And dead does not even get it right. Its gone. As in i no longer have the source code. Apparently gitorious AND rubyforge went down while i was away. My desktop too and out of a sense of false security i thought its safe out there in the wild wild internet :). The gems are naturally still available but not useful anymore.
I moved my blog from ModX (which i took down quite some time ago) to the pelican static site generator . A lack of time and a unfamiliarity with it let me fall behind security updates so badly taking down the site was the only option left.
The decision was between using a hosted blog or a static site generator in a language i am familiar with. Which means pelican was the natural selection.
And so far i am loving it. Much easier.
]]>