HOWTO: Install Ansible Semaphore on CentOS 7.X (no docker)

I wrote a little ago about how to install Ansible Semaphore as a docker. It’s been raining a lot since them, and now it’s time to finish what I started and install it for real. It’s not so complicated. Unfortunately the result didn’t deliver. Below you have my installation log and my setup, together with a relevant output.

## > wget https://github.com/ansible-semaphore/semaphore/releases/\
> download/v2.8.75/semaphore_2.8.75_linux_amd64.rpm
--DATE-- https://github.com//semaphore_2.8.75_linux_amd64.rpm
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://XXX
Saving to: - semaphore_2.8.75_linux_amd64.rpm
100%[==========================>] 11,696,811 34.3MB/s in 0.3s
DATE (34.3 MB/s) -  semaphore_2.8.75_linux_amd64.rpm
saved [11696811/11696811]
## > yum install semaphore_2.8.75_linux_amd64.rpm
Loaded plugins: fastestmirror, langpacks, nvidia
Examining semaphore_2.8.75_linux_amd64.rpm:
semaphore-2.8.75-1.x86_64
Marking semaphore_2.8.75_linux_amd64.rpm
to be installed
Resolving Dependencies
--> Running transaction check
---> Package semaphore.x86_64 0:2.8.75-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================
Package Arch Version Repository Size
============================
Installing:
semaphore x86_64 2.8.75-1 semaphore_2.8.75_linux_amd64 31 M
Transaction Summary
================================
Install 1 Package
Total size: 31 M
Installed:
semaphore.x86_64 0:2.8.75-1
Complete!
## > semaphore setup
Hello! You will now be guided through a setup to:

1. Set up configuration for a MySQL/MariaDB database
2. Set up a path for your playbooks (auto-created)
3. Run database Migrations
4. Set up initial semaphore user & password

What database to use:
1 - MySQL
2 - BoltDB
3 - PostgreSQL
(default 1):

db Hostname (default 127.0.0.1:3306):
db User (default root):
db Password: MYPASSWORD
db Name (default semaphore):
Playbook path (default /tmp/semaphore):
Web root URL (optional, see Web-root-URL):
Enable email alerts? (yes/no) (default no): yes
Mail server host (default localhost):
Mail server port (default 25):
Mail sender address (default semaphore@localhost): XXX
Enable telegram alerts? (yes/no) (default no):
Enable slack alerts? (yes/no) (default no):
Enable LDAP authentication? (yes/no) (default no):
Config output directory (default /root/Downloads):

Running: mkdir -p /XXX/semaphore..
Configuration written to /XXX/semaphore/config.json..
Pinging db..

Running db Migrations..
Executing migration v0.0.0 (at DATE)...
Creating migrations table
[12/0]8]
Executing migration v1.0.0 (at DATE)...
[4/87]
... some other migrations...
Executing migration v2.8.58 (at DATE)...
[1/57]
Migrations Finished

> Username: root
> Email: my.email@domain.org
WARN[0075] no rows in result set level=Warn
> Your name: MYNAME
> Password: MYPASSWORD

You are all setup Juan!
Re-launch this program pointing to the configuration file

./semaphore server --config /XXX/semaphore/config.json

To run as daemon:

nohup ./semaphore server \
--config /XXX/semaphore/config.json &

You can login with my.email@domain.org or root.

Now let’s run it.

## > semaphore server --config /XXX/semaphore/config.json
MySQL root@127.0.0.1:3306 semaphore
Tmp Path (projects home) /XXX/ansible/semaphore
Semaphore v2.8.75
Interface
Port :3000
Server is running
WARN[0037] write IP:3000->IP:41248: write: broken pipe level=Warn
INFO[322969] Task 1 added to queue
INFO[322970] Set resource locker with TaskRunner 1
INFO[322970] Stopped preparing TaskRunner 1
INFO[322970] Release resource locker with TaskRunner 1
INFO[322975] Task 1 removed from queue

The INFO entries are produced after running my first task successfully. It takes a little to configure it (you need to write an inventory, an environment, choose a key and define your repositories). Everything is fine from now on. Unfortunately it’s relying on repositories and quite complex playbooks, so it’s not going to be my choice. I want something that even a monkey with a keyboard can use. I’ll keep you informed of the results of my search 🙂

 

HOWTO : fix clock skew on date (when running it on a cron job)

Preliminaries: the date command works but it shows a different output when running as a cronjob than when running as a script. That is:

## > date=$(date +"%Y-%m-%d %H:%M:%S")
## > echo $date
2023-03-27 20:04:49
... wait for the cron each minute to run...
## > more date.log
2023-03-27 14:05:49

Such a precise skew directly points to a wrong timezone. Let’s configure it.

## > timedatectl 
Warning: Ignoring the TZ variable. Reading the system's time zone setting only.
Local time: Mon 2023-03-27 14:12:29 EDT
Universal time: Mon 2023-03-27 18:12:29 UTC
RTC time: Mon 2023-03-27 18:12:29
Time zone: America/New_York (EDT, -0400)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2023-03-12 01:59:59 EST
Sun 2023-03-12 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2023-11-05 01:59:59 EDT
Sun 2023-11-05 01:00:00 EST

We are NOT in NY! Unfortunately, I hope. I found the fix here. I set the zone to Berlin and restart the crons just in case:

## > timedatectl set-timezone Europe/Berlin
## > systemctl restart crond
## > systemctl restart rsyslog

After this all the times are right, except mine 😀

HOWTO: install Chrome in CentOS 7.X

We need to have a browser up to date. And some things don’t run unless we have Chrome (picture taken from here). Unfortunately, the browser is not available by default on CentOS 7.X, so you cannot simply yum install it 🙂 . How can you enjoy it? I found the solution on this linuxize post. In two steps.

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

yum localinstall google-chrome-stable_current_x86_64.rpm

After that, I get the icon in the corresponding menu (the internet menu) and I can call it from command line if needed. And enjoy the latest technology 🙂

ERROR: kdump-kern.o:kdump-kern.c:(.text+0x445): more undefined references to `__x86_return_thunk’ follow (when building the GPFS packages)

Well I’m happy I’m not the first one with this issue. I’ve updated my CentOS 7.X to the latest kernel, with the so called retbleed kernel patch, and I get the above error when running mmbuildgpl as usual after getting a new kernel. The solution to the issue you can find on this IBM post. I copy it from the article:

  1. Edit /usr/lpp/mmfs/src/gpl-linux/Kbuild on the node
  2. Find the line
    $(KBHOSTPROGS) := lxtrace
  3. Above that line, add a new one with: CFLAGS_kdump-kern.o += -mfunction-return=keep
  4. Save the file and run mmbuildgpl again.

After a successful build I simply try mmstartup and, so far, so good. NOTE: since this is a “mini-post” I have backdated it so that I can post something else today 🙂

HOWTO: open a default file manager with GUI from a terminal on CentOS 7.X

Yes. we’re back in CentOS 7.X. Case scenario: I have a “file” created by (??) that I can’t remove easily (rm) because it has a weird name ( actually it’s –exclude=*.bin). Instead of trying to escape the characters, wild cards and so on, I decide to try from a GUI. Since it’s a remote server, I need to call the file manager from the terminal after ssh to the machine. I found out there’s a general way to do that. This is my output:

## > xdg-open .
START /usr/bin/dolphin %i -caption "%c" "."
KUrl("file:///root") KUrl("")
...
dolphin(90034) KDirWatch::removeDir: doesn't know ""
...
KUrl("file:///root/%25i") KUrl("file:///root")
dolphin(90034) KDirWatch::removeDir: doesn't know ""
KUrl("file:///root/%25i") KUrl("")
KUrl("") KUrl("file:///root/%25i")
KUrl("file:///root/") KUrl("")
KUrl("") KUrl("file:///root/")

As you see, in my case I call dolphin. The image above is not from COS 7, but from the CentOS 8 file explorer, as taken from dedoimedio CentOS 8 review. That I took because you should not, at this point, go for CentOS 7.X as software solution. COS 7 is going to die one of these days. I’m using it but looking forward for the new thing to come…

Taskcafe, an open source project management tool

In my eternal search for a good and free project management tool I’ve found this little jewel called Taskcafe. I went for a docker installation without changing an iota of the installation procedure, we clone the repository:

git clone https://github.com/JordanKnott/taskcafe && cd taskcafe

Now do the following:

docker-compose -p taskcafe up -d

This will start a postgres instance as well as a taskcafe instance, so two dockers, taskcafe_web_1 and taskcafe_postgres_1. But how do I log in? Fortunately there’s a trend about it. Just replace the end of the URL you got by /register. After getting my admin, the rest is easy. I create my first project, then I add lists to it, and cards. That’s it. Up and running! Beautiful ❤

sacct: error: slurm_persist_conn_open_without_init: failed to open persistent connection to host while adding new SLURM user

I wrote already about this error some time ago. Here the original post. So this issue is new, so to say. Symptoms. I want to add a new user to the ones allowed to run on the local cluster. The command, that was working before, must be run like this:

 ## > sacctmgr create user name="spongebob" 
cluster=local account=science
sacctmgr: error: slurm_persist_conn_open_without_init:
failed to open persistent connection to host:XXX:6819:
Connection refused
sacctmgr: error: Sending PersistInit msg:
Connection refused

All the daemons (slurmctld, slurmdbd, munge, etc) are up and running. Other users can launch a job. What’s this? Very easy: the culprit is the usual suspect. The database. After

## > systemctl start mariadb

I can again add new users. That I do just here:

## > sacctmgr create user name="spongebob" 
cluster=local account=science
Adding User(s)
spongebob
Associations =
U = spongebob A = science C = local
Non Default Settings
Would you like to commit changes?
(You have 30 seconds to decide)
(N/y): y

I love when the expected solution works 🙂

Python UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure

A sine or cosine is the ABC of plotting. If we can’t plot it, plotting is not possible. Actually, my message (it’s not an error) looks like this:

>>> plt.show()
__main__:1: UserWarning: Matplotlib is
currently using agg, which is a non-GUI backend,
so cannot show the figure.

I’m trying here to browse thought these python matplotlib snippets to see if I can build up my app using anything from them. In plain words, looking for code to steal. But my ABC plot doesn’t work. Allow me to show you how to make it work, as usual, in my CentOS 7.X machine. StackOverflow has this post about the message. What I did then:

## > yum install python3-tk
No package python3-tk available.
Error: Nothing to do
## > pip3 install PyQt5==5.9.2
Collecting PyQt5==5.9.2
Downloading PyQt5-5.9.2-5.9.3-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl (105.3 MB)
|XXXXX| 105.3 MB 152 kB/s
Collecting sip<4.20,>=4.19.4
Downloading sip-4.19.8-cp36-cp36m-manylinux1_x86_64.whl (66 kB)
|XXXXX| 66 kB 18.7 MB/s
Installing collected packages: sip, PyQt5
Successfully installed PyQt5-5.9.2 sip-4.19.8

After the pip3 install, I don’t get anymore the message of the title and my wished sample plots appear in a separated window. Nice!

HOWTO: reset local wp-admin password

A little bit of background: I have like 3 copies of WP installed on local machines. If you want to know how to install WP locally, I wrote already a post about it. Then one day I come back to one of them and… surprise! I can’t log in anymore. Panic. Fever. What shall we do now? Why didn’t we pay attention to this install when it was just released? Fortunately, my WP was not alone and it was coming with a mariadb and a phpmyadmin installations. From there we can destroy fix everything. Let’s do it.

  1. Log into phpmyadmin
  2. Search for the database storing the wp information
  3. Browse wp_users until you find your username
  4. Click on Edit, and change the user_pass field for your new password
  5. Choose Function: MD5 (as seen above)
  6. Restart mariadb and httpd just to be sure.

Solution found on this link. Image taken from there also. I can’t believe it’s not meat 🙂

WordPress multisite: more than one WP site in one server

I don’t have so much mood to write lately. I guess I’ve been busy thinking or something like that. Anyway, here I am again. (B)logging the last thing I did, that is to transform a single WP install onto a multisite install.I will be following this guide to arrive to the desired multisite configuration.

I start with an installed version (so no docker) on CentOS 7. I deactivate the plugins, then edit /var/www/html/wp-config.php as indicated.

Add this code before the /* That's all, stop editing! Happy blogging. */ line:

/* Multisite */
define('WP_ALLOW_MULTISITE', true);

I save the edits on the wp-config.php, and restart httpd service. Unfortunately I don’t get the Network Setup Menu as in the guide (maybe you get it) but I don’t worry about it and continue. After that I will regret, and I will need to edit various other files to achieve what I want. Here you have the details about the file modifications needed. But basicallyt I have installed phpMyAdmin also. For that I have installed and configured mod_rewrite for apache and fixed a package error problem with php 7.4 install on CentOS 7.9. In brief

yum-config-manager --disable 'remi-php*'
yum-config-manager --enable remi-php74

And of course, I have given permission to access phpmyadmin on this server. But at the end, as usual I manage to get what I want. Or should I say you managed to get what you wanted? 🧐. Because what I want is to write about what I think, not about what I do. And I’m not in the mood 😔. See you around…