Semaphore

Shardul | Apr 2, 2025 min read

Prerequisites

Before proceeding with the installation of the required tools, ensure you have the following:

  1. MYSQL/mariadb
  2. git
  3. ansible

Installation MariaDB :

1. Download MariaDB Repository Setup Script

First, download the repository setup script for MariaDB:

curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup

2. Install MariaDB

Run the following command to set up MariaDB:

sudo bash mariadb_repo_setup

Now, install the MariaDB server, client, and backup tools:

sudo yum install MariaDB-server MariaDB-client MariaDB-backup

Enable and start the MariaDB service:

sudo systemctl enable --now mariadb

3. Secure MariaDB Installation

sudo mariadb-secure-installation

Follow the prompts as outlined below:

-> Switch to unix_socket authentication [Y/n] n
-> Change the root password? [Y/n] y
-> Remove anonymous users? [Y/n] y
-> Disallow root login remotely? [Y/n] y
-> Remove test database and access to it? [Y/n] y
-> Reload privilege tables now? [Y/n] y

Installation Ansible :

1. Install EPEL Repository

Ansible requires the EPEL (Extra Packages for Enterprise Linux) repository. Install it by running:

sudo yum -y install epel-release

2. Install Ansible

Now, install Ansible:

sudo yum -y install ansible

3. Verify Installation

To verify that Ansible was installed successfully, check the version:

ansible --version

Installing GIT :

1. Install Git

Run the following command to install Git:

sudo yum -y instal git

2. Verify Installation

To verify that Git is installed correctly, check the version:

git --version

Installing Semaphore

Semaphore is a web-based user interface for Ansible. Here’s how to install it:

1. Download Semaphore

Download the latest Semaphore release:

wget https://github.com/ansible-semaphore/semaphore/releases/download/v2.8.75/semaphore_2.8.75_linux_amd64.rpm

2. Install Semaphore

Install Semaphore using the following command:

sudo yum install semaphore_2.8.75_linux_amd64.rpm

3. Verify Semaphore Installation

You can verify the installation and check available commands with:

semaphore  --help

4. Setup Semaphore

Run the following command to set up Semaphore:

sudo semaphore setup

Press Enter to accept all the default values during the setup.

Create Semaphore Service

1. Create Semaphore Service File

To run Semaphore as a service, create a systemd unit file:

sudo vi /etc/systemd/system/semaphore.service

Add the following content:

[Unit]
Description=Semaphore Ansible UI
Documentation=https://github.com/ansible-semaphore/semaphore
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/bin/semaphore server --config /etc/semaphore/config.json
SyslogIdentifier=semaphore
Restart=always

[Install]
WantedBy=multi-user.target

2. Create Semaphore Configuration Directory

Create the directory for Semaphore’s configuration:

sudo mkdir /etc/semaphore

Link the configuration file to the correct location:

sudo ln -s /root/config.json /etc/semaphore/config.json

Conclusion

You have successfully installed MariaDB, Git, Ansible, and Semaphore on your system. Semaphore is now configured as a service and ready for use as an Ansible UI.

Feel free to modify your configuration files and start using Semaphore to manage your Ansible playbooks efficiently!