TNS
VOXPOP
What news from AWS re:Invent last week will have the most impact on you?
Amazon Q, an AI chatbot for explaining how AWS works.
0%
Super-fast S3 Express storage.
0%
New Graviton 4 processor instances.
0%
Emily Freeman leaving AWS.
0%
I don't use AWS, so none of this will affect me.
0%
Operations

How to Put a GUI on Ansible, Using Semaphore

Ansible can be great for automating routine IT tasks, but some may feel stymied by the command line. Here's how to install the Semaphore graphical user interface.
Apr 22nd, 2023 6:00am by
Featued image for: How to Put a GUI on Ansible, Using Semaphore

Red Hat‘s open source Ansible is an open source IT automation platform, written in Python, that can configure systems, deploy software, and orchestrate advanced workflows. By default, Ansible is a command-line tool but isn’t terribly complicated to work with.

However, there are some who’d much prefer having a graphical user interface (GUI) to make the platform more efficient to use. Thankfully, there’s one particular GUI, called Semaphore, that can help make using Ansible easier for larger environments and organizations.

I want to walk you through the process of installing Semaphore. I’m going to demonstrate on Ubuntu Linux (version 22.04), so you’ll want to make sure to have Ansible installed and working. To do that, make sure to first follow this tutorial. Once you’ve taken care of that, you are ready to install Semaphore.

What You’ll Need

Obviously, you’ll need Ansible up and running on Ubuntu. You’ll also need a user with sudo privileges. That’s it. Let’s get to the installation.

Installing Semaphore

Although you can easily install Semaphore with Snap, we’re going to go a different route, so we can ensure the platform is available from anywhere on your LAN.

The first thing to do is install a database server.  We’re going to go with MariaDB. To install MariaDB on Ubuntu, you must add the repository with the command:


After that command finishes, install both the server and client with:


With MariaDB installed, secure it with the command:


Answer n to the first question and y to the remaining. You’ll also be prompted to create and verify a root user password.

With the database installed, it’s time to add Semaphore. We’ll first set a variable for the version with the command:


We can now use that variable to download the correct version with the command:


Install Semaphore with:


Boom! Semaphore is installed and ready to be configured.

Configure Semaphore

You don’t just edit a configuration file because none exists yet. To generate the configure file, run semaphore such that it will prompt you to configure everything. The command for this is:


The first section of the configuration looks like this:


Make sure to select MySQL for your database and then configure it accordingly. You can accept the default for everything, but you will have to type the MariaDB root user password you created earlier.

When you get to the Hostname section (which looks like db Hostname (default 127.0.0.1:3306):), make sure to type it in the form:


Where SERVER is the IP address of your hosting server.

Near the end of the prompt, you’ll also be asked to create a new admin user for the web UI.

Create a Systemd File

Next, we need to create a systemd file so the Semaphore service can be controlled. Create the file with the command:


In that file, paste the following:


Save and close the file.

Reload the systemd daemon with:


Start and enable the Semaphore service with:

Accessing the Semaphore Web UI

With the service running and accepting connections, open a web browser that’s on a machine connected to the same LAN and point it to http://SERVER:3000 (Where SERVER is the IP address of the hosting server). You will be greeted by the Semaphore login prompt (Figure 1).

 

Figure 1: The Semaphore login screen.

You will then be prompted to create your first project (Figure 2), so give it a name and configure the optional Telegram Chat ID and Max Number of Parallel Tasks. Once you’ve taken care of that, click CREATE.

Figure 2: Creating a new project in Semaphore.

From the project page (Figure 3), you can start by adding inventory (which are machines Ansible will manage), as well as environment variables, key stores, repositories, task templates, and team members. Make sure to create your first key store, inventory, and playbook repositories (you do still have to manually create playbooks at this point — a process that I describe in the article linked at the top of this article).

Figure 3: Your first Semaphore project is ready to go.

Congratulations, at this point, Ansible should be considerably easier to manage.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Unit.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.