Ansible Semaphore is a web-based user interface for running Ansible playbooks. It allows teams to manage and automate infrastructure tasks using Ansible in a simplified and structured way. In this guide, we will walk through installing Semaphore on Debian 12.

Ansible Semaphore is a web-based solution that helps teams manage and automate their IT infrastructure using Ansible. It provides a user-friendly graphical interface for executing Ansible playbooks, organizing tasks, and managing inventories without needing to use the command line. Semaphore allows you to:

  • Manage automation tasks efficiently.
  • Schedule and monitor playbook execution.
  • Collaborate with team members on Ansible tasks.
  • Manage inventories, environments, and secrets securely.
  • Integrate with version control systems like Git.

This makes Semaphore useful for teams looking to streamline their Ansible-based infrastructure automation.


Step 1: Create an Instance on Cloud.shape.host

Step 1.1: Log in

First, log in to your Cloud.shape.host account and access your Dashboard.

Step 1.2: Create a New Instance

Click the Create button and select Instances from the dropdown menu.

Shape.host Resources dashboard with Create > Instance highlighted.

Step 1.3: Choose Datacenter

On the next screen, select the datacenter location closest to your users.

Shape.host instance form with the data center location selector highlighted.

Step 1.4: Configure the Instance

Choose Debian 12 as your operating system. Configure authentication (SSH keys or password) and adjust any other instance settings.

Shape.host instance form with the operating system image selector highlighted.

Step 1.5: Configure and Launch

  • Set the Network Type and Authentication Method (SSH key or password).
  • Click Create Instance.
Shape.host instance form with the Create Instance button highlighted.

Step 1.6: Locate your Instance’s IP

Shape.host Resources dashboard with the server IP address highlighted.

Step 1.7: Create and Access

Click Create Instance to finalize. After the instance is created, connect via SSH using:

ssh root@<your-instance-ip>

Step 2: Update System and Install Required Packages

Update the system and install the necessary packages:

apt update
apt install git curl wget software-properties-common ansible postgresql nginx
Terminal showing APT package management commands and output.
Terminal showing APT package management commands and output.

Verify PostgreSQL and Nginx services:

systemctl is-enabled postgresql
systemctl status postgresql
systemctl is-enabled nginx
systemctl status nginx
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Check the Ansible version:

ansible --version
Terminal showing python commands or output during Update System and Install Required Packages.

Step 3: Configure PostgreSQL for Semaphore

Log in to PostgreSQL:

sudo -u postgres psql

Create a new user and database for Semaphore:

CREATE USER semaphore WITH PASSWORD 'passw0rd';
CREATE DATABASE semaphoredb OWNER semaphore;

Verify the creation:

\du
\l
Terminal showing Semaphore command-line setup or version output.

Type \q to exit from the PostgreSQL.


Step 4: Download and Install Semaphore

Download the latest version of Semaphore:

VER=$(curl -s https://api.github.com/repos/semaphoreui/semaphore/releases/latest | grep tag_name | cut -d '"' -f 4 | sed 's/v//g')
wget -q https://github.com/semaphoreui/semaphore/releases/download/v${VER}/semaphore_${VER}_linux_amd64.deb
Terminal showing Semaphore command-line setup or version output.

Install Semaphore:

dpkg -i semaphore_${VER}_linux_amd64.deb
Terminal showing Semaphore command-line setup or version output.

Verify the installation:

which semaphore
semaphore version
semaphore help
Terminal showing Semaphore command-line setup or version output.
Terminal showing Semaphore command-line setup or version output.

Step 5: Configure Semaphore

Create the necessary directories and run the setup:

mkdir -p /etc/semaphore; cd /etc/semaphore
semaphore setup
Terminal showing Semaphore command-line setup or version output.
Terminal showing Semaphore command-line setup or version output.

Step 6: Create Systemd Service for Semaphore

Create a new systemd service file for Semaphore:

nano /etc/systemd/system/semaphore.service

Insert the following content:

[Unit]
Description=Semaphore Ansible
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 service --config=/etc/semaphore/config.json
SyslogIdentifier=semaphore
Restart=always

[Install]
WantedBy=multi-user.target
Terminal showing Semaphore command-line setup or version output.

Reload systemd and enable Semaphore:

systemctl daemon-reload
Terminal showing systemd service management commands or output.

Check its status:

systemctl enable --now semaphore
systemctl status semaphore
Terminal showing systemd service management commands or output.

Step 7: Configure Nginx as a Reverse Proxy

Create an Nginx server block for Semaphore:

nano /etc/nginx/sites-available/semaphore.conf

Insert the following configuration:

upstream semaphore {
    server 127.0.0.1:3000;
}

server {
    listen 80;
    server_name debian.shape.host;
    client_max_body_size 0;
    chunked_transfer_encoding on;

    location / {
      proxy_pass http://semaphore/;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_buffering off;
      proxy_request_buffering off;
    }

    location /api/ws {
      proxy_pass http://semaphore/api/ws;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header Origin "";
    }
}
Terminal showing Semaphore command-line setup or version output.

Enable the configuration:

ln -s /etc/nginx/sites-available/semaphore.conf /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginx
Terminal showing Semaphore command-line setup or version output.
Terminal showing Semaphore command-line setup or version output.
Terminal showing systemd service management commands or output.

Step 8: Secure Semaphore with SSL

Install Certbot and the Nginx plugin:

apt install certbot python3-certbot-nginx -y
Terminal showing Semaphore command-line setup or version output.

Generate SSL certificates for Semaphore:

certbot --nginx --agree-tos --no-eff-email --redirect --email contact@shape.host -d debian.shape.host
Terminal showing Semaphore command-line setup or version output.

Step 9: Access Semaphore

Open your web browser and visit:

https://debian.shape.host

You will see the Ansible Semaphore login page where you can log in and start managing your automation tasks.

Enter your admin user and password, and then click SIGN IN to confirm.

Semaphore sign-in form.

Now enter the name of your first project and click Create to continue.

Semaphore New Project form with project name and alert settings.

You’ll see the Semaphore dashboard like the following:

Semaphore dashboard with task history and project navigation.

By following this guide, you have successfully installed Ansible Semaphore on Debian 12, configured it with Nginx as a reverse proxy, and secured the installation with SSL. Semaphore provides an intuitive web interface for managing Ansible tasks, improving collaboration, and simplifying automation processes. For reliable performance and uptime, consider hosting Semaphore on Shape.Host’s Linux SSD VPS, which offers scalable and high-performance hosting solutions.