Skip to content

Instantly share code, notes, and snippets.

@thedumbtechguy
Last active August 21, 2019 21:14
Show Gist options
  • Save thedumbtechguy/0fae1ae931042829b73426630f3cd168 to your computer and use it in GitHub Desktop.
Save thedumbtechguy/0fae1ae931042829b73426630f3cd168 to your computer and use it in GitHub Desktop.
Install Ansible Semaphore on Ubuntu

Ansible Installation

Ansible is a powerful configuration management tool that we use in managing our infrastructure and applications.

It requires a centralized Control server and can connect to hosts over an array of connection types including SSH.

Controller Setup

The Ansible controller will run our playbooks. This needs both Ansible and Semaphore (web based management console) setup.

Ansible

Ansible is the main dependency. This will run our configuration management.

Install Ansible

sudo apt-get -y install software-properties-common
sudo apt-get -y install python-software-properties
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get -y update
sudo apt-get -y install ansible
Install Dependencies
sudo apt-get -y install python-passlib

Configure Ansible

The configuration file can be found in /etc/ansible/ansible.cfg.

We need to disable host_key_checking else our plays will hang asking us to add the host certificate.

Search for and uncomment the relevant line.

host_key_checking: False

Semaphore

Semaphore is an open sourced alternative to Ansible Tower.

It is a web based GUI that helps us run our playbooks and manage our tasks properly.

MySQL

To install semaphore, you need MySQL running on the server.

Install
sudo apt-get -y update
sudo apt-get -y install mysql-server

Follow the prompts to complete the setup including entering the password.

Secure and initialize

Secure the installation. You will be prompted for the root password when you run this command.

sudo mysql_secure_installation

Disable all remote connections and delete all defaults when prompeted.

  • Enable validate password plugin: [y] on STRONG [2] setting.
  • Remove anonymous users: [y]
  • Disallow root login remotely: [y].
  • Remove test database and access to it: [y].
  • Reload privilege tables: [y]

If MySQL 5.7 is used, the initialize step is not necessary and will raise an error which you can ignore.

sudo mysqld --initialize
Verify Installation

Check if mysql is running

service mysql status

If it isn't, start the service

sudo service mysql start

Test your credentials to the database

mysqladmin -p -u root version

Install Semaphore

Get <link> for recent release for OS version here.

Ubuntu uses semaphore_linux_amd64

Run the installation.

sudo apt-get install -y wget git
wget <link>
sudo mv semaphore_linux_amd64 /usr/bin/semaphore
chmod +x /usr/bin/semaphore
sudo mkdir -p /opt/data/semaphore
sudo chown $(whoami): /opt/data/semaphore

Initialize semaphore for the first time

semaphore -setup

You will be required to enter the following configs

  • DB Hostname: default [enter]
  • DB User: default [enter]
  • DB Password: [password specified earlier] [enter]
  • DB Name: default [enter]
  • Playbook path: /opt/data/semaphore
  • Accept configuration: [y]
  • Username: [admin] [enter]
  • Email: [[email protected]] [enter]
  • Username: [admin] [enter]
  • Name: [admin] [enter]
  • Password: [admin] [enter]

Run using

semaphore -config /opt/data/semaphore/semaphore_config.json

or as a daemon:

nohup semaphore -config /opt/data/semaphore/semaphore_config.json &

Point your browser to port 3000 and start managing.

@thedumbtechguy
Copy link
Author

It's been a while since I did this and it appears semaphore has changed a bit since as well. Sorry. @gertellezv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment