Loading...
Ansible Semaphore



Ansible Semaphore

The web-based solution for managing your Ansible automation

  I recently discovered Ansible Semaphore and have been thoroughly impressed with its capabilities. As someone who frequently uses Ansible to manage my servers, I was excited to find a web-based interface that would make it even easier to manage my playbooks and inventory. Ansible is a powerful automation tool that allows you to manage, configure, and deploy servers remotely, but it can be challenging to keep track of all the playbooks and inventory. Ansible Semaphore aims to solve this problem by providing a web-based interface that allows you to easily manage your playbooks and inventory.

  Ansible Semaphore is an open-source project, you can find the repository on GitHub here. It's built on top of the popular Ansible automation tool and provides a user-friendly interface for creating and running playbooks, as well as tracking their progress and history. The web-based interface makes it easy to create and run playbooks, regardless of your technical ability. And, it also allows for easy management of inventory, which is a huge plus. You can easily add, remove, and edit your inventory from the web interface, which makes it much more convenient than having to manually edit inventory files.

  The ability to view and track the progress of my playbooks in real-time is one of the major benefits that I've found from using Ansible Semaphore. When you run a playbook, you can see the progress in real-time, including which tasks are currently running, which have completed, and which have failed. This allows you to quickly identify and troubleshoot any issues that may arise. Additionally, being able to run playbooks from the web interface instead of the command line is much more convenient. You don't need to have any technical knowledge or experience with the command line to use Ansible Semaphore. The interface is intuitive and easy to navigate, making it simple to create and run playbooks.

Here are the steps I took to set this up:

  1. The first step was to install Docker and docker-compose on my home server. This can be done by following the instructions on the Docker website.

  2. Once Docker and docker-compose were installed, I created a new directory on my home server and named it "ansible-semaphore". Inside this directory, I created a new file called "docker-compose.yml"

  3. In the "docker-compose.yml" file, I added the following configuration:
                                        services:
      mysql:
        restart: unless-stopped
        ports:
          - 3306:3306
        image: mysql:8.0
        hostname: mysql
        volumes:
          - semaphore-mysql:/var/lib/mysql
        environment:
          MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
          MYSQL_DATABASE: sema     # Change me if desired
          MYSQL_USER: sema         # Change me if desired
          MYSQL_PASSWORD: changeme # Change me
      semaphore:
        restart: unless-stopped
        ports:
          - 3000:3000
        image: semaphoreui/semaphore:latest
        environment:
          SEMAPHORE_DB_USER: sema                  # Change me to match MYSQL_USER
          SEMAPHORE_DB_PASS: changeme              # Change me to match MYSQL_PASSWORD
          SEMAPHORE_DB_HOST: mysql
          SEMAPHORE_DB_PORT: 3306
          SEMAPHORE_DB_DIALECT: mysql
          SEMAPHORE_DB: sema                       # Change me to match MYSQL_DATABASE
          SEMAPHORE_PLAYBOOK_PATH: /tmp/semaphore/
          SEMAPHORE_ADMIN_PASSWORD: adminpass      # Set admin password here
          SEMAPHORE_ADMIN_NAME: AdminName          # Set admin username here
          SEMAPHORE_ADMIN_EMAIL: [email protected]   # Set admin e-mail here
          SEMAPHORE_ADMIN: AdminName               # Set to match SEMAPHORE_ADMIN_NAME
          SEMAPHORE_ACCESS_KEY_ENCRYPTION: key     # Use command `head -c32 /dev/urandom | base64` to generate this key and place it here
          SEMAPHORE_LDAP_ACTIVATED: 'no'
          SEMAPHORE_LDAP_HOST: dc01.local.example.com
          SEMAPHORE_LDAP_PORT: '636'
          SEMAPHORE_LDAP_NEEDTLS: 'yes'
          SEMAPHORE_LDAP_DN_BIND: 'uid=bind_user,cn=users,cn=accounts,dc=local,dc=shiftsystems,dc=net'
          SEMAPHORE_LDAP_PASSWORD: 'ldap_bind_account_password'
          SEMAPHORE_LDAP_DN_SEARCH: 'dc=local,dc=example,dc=com'
          SEMAPHORE_LDAP_SEARCH_FILTER: "(\u0026(uid=%s)(memberOf=cn=ipausers,cn=groups,cn=accounts,dc=local,dc=example,dc=com))"
        depends_on:
          - mysql
    volumes:
      semaphore-mysql:

  4. This configuration tells Docker to use the latest version of the Ansible Semaphore image and to map port 3000 on my home server to port 3000 on the container. It also specifies that I'm using MySQL as the database type and mounts a data volume to the container.

  5. Next, I navigated to the "ansible-semaphore" directory in my terminal and ran the following command:
                                        docker-compose up -d
                                    
    This command starts the Ansible Semaphore container in detached mode.

  6. Once the container was up and running, I was able to access the Ansible Semaphore web interface by going to http://[server-ip]:3000 on my browser.

  7. I logged in to the web interface using the set username and password and started creating and running playbooks. I was able to track the progress and history of my playbooks, and also make changes and updates as needed.
Overall, deploying Ansible Semaphore as a Docker container in my home network was a straightforward process. The web interface makes it easy to manage playbooks and inventory, and the ability to track progress and history is a huge plus. And using the docker-compose.yml file, I was able to automate the container creation and management process. If you're looking for a user-friendly and powerful web-based interface for managing Ansible, I would highly recommend giving Ansible Semaphore a try.

Top