Install Ansible Semaphore on CentOS 8 - CentLinux

Latest

Thursday, 28 May 2020

Install Ansible Semaphore on CentOS 8

install-ansible-semaphore-on-centos-8

In this article, you will learn how to install Ansible Semaphore on CentOS 8. We will also create our first project by using the Semaphore web interface.

 

This Article Provides:

     

    What is Ansible? :

    Ansible is a free and open source software provisioning, configuration management and application deployment tool. Ansible is developed by Red Hat and available in free and commercial editions.

    Ansible is agent-less and it uses the SSH and Python to apply operating system configurations on Ansible managed nodes.

    Ansible is also daemon-less and we do not required to configure a server for it. Instead, we need to configure a machine as Ansible Control Node, to store the Ansible software and inventory.

    Ansible has a powerful command set that let the administrators to perform all server orchestration tasks from command line. But for the administrators who prefer Graphical user interface (GUI), we have some free web interfaces available such as AWX and Semaphore.

    AWX is the free and open source upstream version of Ansible Tower and we have already explored how to install Ansible AWX on CentOS.

     

    What is Ansible Semaphore? :

    Ansible Semaphore is another open source alternative to Ansible Tower. Semaphore is available in both Community (free) and Enterprise (commercial) editions.

    Semaphore is written in Golang (backend) and AngularJS (frontend) and distributed under MIT license. Semaphore supports LDAP authentication, REST API, Email and Telegram alerts.

     

    Ansible Semaphore Prerequisites:

    Ansible Semaphore has following three prerequisites.

    • MySQL >= 5.6.4/MariaDB >= 5.3
    • ansible in $PATH
    • git >= 2.x in $PATH

     

    Environment Specification:

    We are using a minimal CentOS 8 KVM virtual machine with following specifications.

    • CPU - 3.4 Ghz (2 cores)
    • Memory - 4 GB
    • Storage - 40 GB
    • Operating System - CentOS 8.1
    • Hostname – semaphore-01.centlinux.com
    • IP Address - 192.168.116.206 /24

     

    Update CentOS 8 Software Packages:

    Connect with semaphore-01.centlinux.com as root user by using a SSH tool.

    Use dnf command to update CentOS 8 software packages.

    [root@semaphore-01 ~]# dnf update -y Last metadata expiration check: 0:00:16 ago on Wed 27 May 2020 12:20:39 AM PKT. Dependencies resolved. Nothing to do. Complete!

    Our CentOS machine is already up-to-date. Therefore, dnf has nothing to update this time.

     

    Install MariaDB Server on CentOS 8:

    Ansible Semaphore requires a MySQL database to create its data repository. Therefore, we are installing MariaDB 10.3 server on CentOS 8 by using dnf command.

    [root@semaphore-01 ~]# dnf install -y mariadb-server ... Installed: mariadb-server-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-backup-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-gssapi-server-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-server-utils-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Socket-SSL-2.066-3.el8.noarch perl-Mozilla-CA-20160104-7.el8.noarch mariadb-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-common-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 mariadb-connector-c-3.0.7-1.el8.x86_64 mariadb-connector-c-config-3.0.7-1.el8.noarch mariadb-errmsg-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64 perl-DBI-1.641-3.module_el8.1.0+199+8f0a6bbd.x86_64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.x86_64 perl-Net-SSLeay-1.88-1.el8.x86_64 perl-URI-1.73-3.el8.noarch perl-libnet-3.11-3.el8.noarch perl-Carp-1.42-396.el8.noarch perl-Data-Dumper-2.167-399.el8.x86_64 perl-Encode-4:2.97-3.el8.x86_64 perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-MIME-Base64-3.15-396.el8.x86_64 perl-Math-BigInt-1:1.9998.11-7.el8.noarch perl-Math-Complex-1.59-416.el8.noarch perl-PathTools-3.74-1.el8.x86_64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 perl-Socket-4:2.027-3.el8.x86_64 perl-Storable-1:3.11-3.el8.x86_64 perl-Term-ANSIColor-4.06-396.el8.noarch perl-Term-Cap-1.17-395.el8.noarch perl-Text-ParseWords-3.30-395.el8.noarch perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Time-Local-1:1.280-1.el8.noarch perl-Unicode-Normalize-1.25-396.el8.x86_64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.x86_64 perl-libs-4:5.26.3-416.el8.x86_64 perl-macros-4:5.26.3-416.el8.x86_64 perl-parent-1:0.237-1.el8.noarch perl-podlators-4.11-1.el8.noarch perl-threads-1:2.21-2.el8.x86_64 perl-threads-shared-1.58-2.el8.x86_64 psmisc-23.1-3.el8.x86_64 Complete!

    Enable and start mariadb.service.

    [root@semaphore-01 ~]# systemctl enable --now mariadb.service Created symlink /etc/systemd/system/mysql.service â /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/mysqld.service â /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service â /usr/lib/systemd/system/mariadb.service.

    Configure MariaDB server and set root user password.

    [root@semaphore-01 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!

    MariaDB 10.3 Server has been installed.

     

    Install Ansible on CentOS 8:

    There are different ways to install Ansible on CentOS 8, but we are installing it from EPEL yum repository.

    Because Ansible is not available in default yum repositories. Therefore, we need to install EPEL (Extra Packages for Enterprise Linux) yum repository.

    [root@semaphore-01 ~]# dnf install -y epel-release Last metadata expiration check: 0:19:22 ago on Wed 27 May 2020 12:24:06 AM PKT. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: epel-release noarch 8-8.el8 extras 23 k Transaction Summary ================================================================================ Install 1 Package Total download size: 23 k Installed size: 32 k Downloading Packages: epel-release-8-8.el8.noarch.rpm 46 kB/s | 23 kB 00:00 -------------------------------------------------------------------------------- Total 14 kB/s | 23 kB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : epel-release-8-8.el8.noarch 1/1 Running scriptlet: epel-release-8-8.el8.noarch 1/1 Verifying : epel-release-8-8.el8.noarch 1/1 Installed: epel-release-8-8.el8.noarch Complete!

    Build cache for EPEL yum repository.

    [root@semaphore-01 ~]# dnf makecache CentOS-8 - AppStream 12 kB/s | 4.3 kB 00:00 CentOS-8 - Base 1.2 kB/s | 3.9 kB 00:03 CentOS-8 - Extras 4.2 kB/s | 1.5 kB 00:00 Extra Packages for Enterprise Linux Modular 8 - 25 kB/s | 118 kB 00:04 Extra Packages for Enterprise Linux 8 - x86_64 606 kB/s | 6.8 MB 00:11 Metadata cache created.

    Now, we can install Ansible from EPEL yum repository.

    [root@semaphore-01 ~]# dnf install -y ansible Last metadata expiration check: 0:00:33 ago on Wed 27 May 2020 12:43:57 AM PKT. Dependencies resolved. ================================================================================ Package Arch Version Repo Size ================================================================================ Installing: ansible noarch 2.9.9-1.el8 epel 17 M Installing dependencies: python3-babel noarch 2.5.1-5.el8 AppStream 4.8 M python3-jinja2 noarch 2.10.1-2.el8_0 AppStream 538 k python3-jmespath noarch 0.9.0-11.el8 AppStream 45 k python3-markupsafe x86_64 0.23-19.el8 AppStream 39 k python3-pip noarch 9.0.3-15.el8 AppStream 19 k python3-pyasn1 noarch 0.3.7-6.el8 AppStream 126 k python3-pytz noarch 2017.2-9.el8 AppStream 54 k python36 x86_64 3.6.8-2.module_el8.1.0+245+c39af44f AppStream 19 k python3-pyyaml x86_64 3.12-12.el8 BaseOS 193 k python3-setuptools noarch 39.2.0-5.el8 BaseOS 162 k libsodium x86_64 1.0.18-2.el8 epel 162 k python3-bcrypt x86_64 3.1.6-2.el8.1 epel 44 k python3-pynacl x86_64 1.3.0-5.el8 epel 100 k sshpass x86_64 1.06-9.el8 epel 27 k Installing weak dependencies: python3-paramiko noarch 2.4.3-1.el8 epel 289 k Enabling module streams: python36 3.6 Transaction Summary ================================================================================ Install 16 Packages Total download size: 24 M Installed size: 124 M Downloading Packages: (1/16): python3-jmespath-0.9.0-11.el8.noarch.rp 388 kB/s | 45 kB 00:00 (2/16): python3-markupsafe-0.23-19.el8.x86_64.r 885 kB/s | 39 kB 00:00 (3/16): python3-pip-9.0.3-15.el8.noarch.rpm 137 kB/s | 19 kB 00:00 (4/16): python3-pyasn1-0.3.7-6.el8.noarch.rpm 336 kB/s | 126 kB 00:00 (5/16): python3-pytz-2017.2-9.el8.noarch.rpm 305 kB/s | 54 kB 00:00 (6/16): python36-3.6.8-2.module_el8.1.0+245+c39 123 kB/s | 19 kB 00:00 (7/16): python3-jinja2-2.10.1-2.el8_0.noarch.rp 474 kB/s | 538 kB 00:01 (8/16): python3-babel-2.5.1-5.el8.noarch.rpm 591 kB/s | 4.8 MB 00:08 (9/16): python3-pyyaml-3.12-12.el8.x86_64.rpm 24 kB/s | 193 kB 00:08 (10/16): python3-setuptools-39.2.0-5.el8.noarch 20 kB/s | 162 kB 00:08 (11/16): python3-bcrypt-3.1.6-2.el8.1.x86_64.rp 27 kB/s | 44 kB 00:01 (12/16): libsodium-1.0.18-2.el8.x86_64.rpm 71 kB/s | 162 kB 00:02 (13/16): python3-pynacl-1.3.0-5.el8.x86_64.rpm 198 kB/s | 100 kB 00:00 (14/16): sshpass-1.06-9.el8.x86_64.rpm 54 kB/s | 27 kB 00:00 (15/16): python3-paramiko-2.4.3-1.el8.noarch.rp 137 kB/s | 289 kB 00:02 (16/16): ansible-2.9.9-1.el8.noarch.rpm 728 kB/s | 17 MB 00:24 -------------------------------------------------------------------------------- Total 709 kB/s | 24 MB 00:34 warning: /var/cache/dnf/epel-6519ee669354a484/packages/ansible-2.9.9-1.el8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY Extra Packages for Enterprise Linux 8 - x86_64 1.6 MB/s | 1.6 kB 00:00 Importing GPG key 0x2F86D6A1: Userid : "Fedora EPEL (8) <epel@fedoraproject.org>" Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : python3-setuptools-39.2.0-5.el8.noarch 1/16 Installing : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_6 2/16 Running scriptlet: python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_6 2/16 Installing : python3-pip-9.0.3-15.el8.noarch 3/16 Installing : sshpass-1.06-9.el8.x86_64 4/16 Installing : python3-bcrypt-3.1.6-2.el8.1.x86_64 5/16 Installing : libsodium-1.0.18-2.el8.x86_64 6/16 Installing : python3-pynacl-1.3.0-5.el8.x86_64 7/16 Installing : python3-pyyaml-3.12-12.el8.x86_64 8/16 Installing : python3-pytz-2017.2-9.el8.noarch 9/16 Installing : python3-babel-2.5.1-5.el8.noarch 10/16 Installing : python3-pyasn1-0.3.7-6.el8.noarch 11/16 Installing : python3-paramiko-2.4.3-1.el8.noarch 12/16 Installing : python3-markupsafe-0.23-19.el8.x86_64 13/16 Installing : python3-jinja2-2.10.1-2.el8_0.noarch 14/16 Installing : python3-jmespath-0.9.0-11.el8.noarch 15/16 Installing : ansible-2.9.9-1.el8.noarch 16/16 Running scriptlet: ansible-2.9.9-1.el8.noarch 16/16 Verifying : python3-babel-2.5.1-5.el8.noarch 1/16 Verifying : python3-jinja2-2.10.1-2.el8_0.noarch 2/16 Verifying : python3-jmespath-0.9.0-11.el8.noarch 3/16 Verifying : python3-markupsafe-0.23-19.el8.x86_64 4/16 Verifying : python3-pip-9.0.3-15.el8.noarch 5/16 Verifying : python3-pyasn1-0.3.7-6.el8.noarch 6/16 Verifying : python3-pytz-2017.2-9.el8.noarch 7/16 Verifying : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_6 8/16 Verifying : python3-pyyaml-3.12-12.el8.x86_64 9/16 Verifying : python3-setuptools-39.2.0-5.el8.noarch 10/16 Verifying : ansible-2.9.9-1.el8.noarch 11/16 Verifying : libsodium-1.0.18-2.el8.x86_64 12/16 Verifying : python3-bcrypt-3.1.6-2.el8.1.x86_64 13/16 Verifying : python3-paramiko-2.4.3-1.el8.noarch 14/16 Verifying : python3-pynacl-1.3.0-5.el8.x86_64 15/16 Verifying : sshpass-1.06-9.el8.x86_64 16/16 Installed: ansible-2.9.9-1.el8.noarch python3-paramiko-2.4.3-1.el8.noarch python3-babel-2.5.1-5.el8.noarch python3-jinja2-2.10.1-2.el8_0.noarch python3-jmespath-0.9.0-11.el8.noarch python3-markupsafe-0.23-19.el8.x86_64 python3-pip-9.0.3-15.el8.noarch python3-pyasn1-0.3.7-6.el8.noarch python3-pytz-2017.2-9.el8.noarch python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 python3-pyyaml-3.12-12.el8.x86_64 python3-setuptools-39.2.0-5.el8.noarch libsodium-1.0.18-2.el8.x86_64 python3-bcrypt-3.1.6-2.el8.1.x86_64 python3-pynacl-1.3.0-5.el8.x86_64 sshpass-1.06-9.el8.x86_64 Complete!

    Verify that the ansible command is available in $PATH (as required by the Semaphore).

    [root@semaphore-01 ~]# ansible --version ansible 2.9.9 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

    Ansible has been installed on CentOS 8.

     

    Install Git on CentOS 8:

    Ansible Semaphore also requires git.

    git is available in default yum repository, therefore, we can easily install git on CentOS it using a dnf command.

    [root@semaphore-01 ~]# dnf install -y git Last metadata expiration check: 0:03:04 ago on Wed 27 May 2020 12:43:57 AM PKT. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: git x86_64 2.18.2-2.el8_1 AppStream 186 k Installing dependencies: git-core x86_64 2.18.2-2.el8_1 AppStream 5.0 M git-core-doc noarch 2.18.2-2.el8_1 AppStream 2.3 M perl-Error noarch 1:0.17025-2.el8 AppStream 46 k perl-Git noarch 2.18.2-2.el8_1 AppStream 77 k perl-TermReadKey x86_64 2.37-7.el8 AppStream 40 k emacs-filesystem noarch 1:26.1-5.el8 BaseOS 69 k Transaction Summary ================================================================================ Install 7 Packages Total download size: 7.7 M Installed size: 42 M Downloading Packages: (1/7): git-2.18.2-2.el8_1.x86_64.rpm 324 kB/s | 186 kB 00:00 (2/7): perl-Error-0.17025-2.el8.noarch.rpm 227 kB/s | 46 kB 00:00 (3/7): perl-Git-2.18.2-2.el8_1.noarch.rpm 182 kB/s | 77 kB 00:00 (4/7): perl-TermReadKey-2.37-7.el8.x86_64.rpm 157 kB/s | 40 kB 00:00 (5/7): git-core-doc-2.18.2-2.el8_1.noarch.rpm 466 kB/s | 2.3 MB 00:04 (6/7): git-core-2.18.2-2.el8_1.x86_64.rpm 698 kB/s | 5.0 MB 00:07 (7/7): emacs-filesystem-26.1-5.el8.noarch.rpm 5.2 kB/s | 69 kB 00:13 -------------------------------------------------------------------------------- Total 488 kB/s | 7.7 MB 00:16 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : git-core-2.18.2-2.el8_1.x86_64 1/7 Installing : git-core-doc-2.18.2-2.el8_1.noarch 2/7 Installing : emacs-filesystem-1:26.1-5.el8.noarch 3/7 Installing : perl-TermReadKey-2.37-7.el8.x86_64 4/7 Installing : perl-Error-1:0.17025-2.el8.noarch 5/7 Installing : perl-Git-2.18.2-2.el8_1.noarch 6/7 Installing : git-2.18.2-2.el8_1.x86_64 7/7 Running scriptlet: git-2.18.2-2.el8_1.x86_64 7/7 Verifying : git-2.18.2-2.el8_1.x86_64 1/7 Verifying : git-core-2.18.2-2.el8_1.x86_64 2/7 Verifying : git-core-doc-2.18.2-2.el8_1.noarch 3/7 Verifying : perl-Error-1:0.17025-2.el8.noarch 4/7 Verifying : perl-Git-2.18.2-2.el8_1.noarch 5/7 Verifying : perl-TermReadKey-2.37-7.el8.x86_64 6/7 Verifying : emacs-filesystem-1:26.1-5.el8.noarch 7/7 Installed: git-2.18.2-2.el8_1.x86_64 git-core-2.18.2-2.el8_1.x86_64 git-core-doc-2.18.2-2.el8_1.noarch perl-Error-1:0.17025-2.el8.noarch perl-Git-2.18.2-2.el8_1.noarch perl-TermReadKey-2.37-7.el8.x86_64 emacs-filesystem-1:26.1-5.el8.noarch Complete!

    Verify that git is available in $PATH (as required by the Semaphore).

    [root@semaphore-01 ~]# git --version git version 2.18.2

    git has been installed on CentOS 8

     

    Install Ansible Semaphore on CentOS 8:

    Ansible Semaphore downloads are available at GitHub. Copy the URL of installation package according to your requirements and then use wget command to download it.

    [root@semaphore-01 ~]# wget https://github.com/ansible-semaphore/semaphore/releases/download/v2.5.1/semaphore_2.5.1_linux_amd64.rpm --2020-05-27 00:52:05-- https://github.com/ansible-semaphore/semaphore/releases/download/v2.5.1/semaphore_2.5.1_linux_amd64.rpm Resolving github.com (github.com)... 140.82.113.4 Connecting to github.com (github.com)|140.82.113.4|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/23267883/2ac8069c-5dfa-11e8-85cc-30b65d788746?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200526%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200526T195207Z&X-Amz-Expires=300&X-Amz-Signature=9c0cd6353eb693eb04a558da6ad463378d69d30ba5e022b5d3c3051907855122&X-Amz-SignedHeaders=host&actor_id=0&repo_id=23267883&response-content-disposition=attachment%3B%20filename%3Dsemaphore_2.5.1_linux_amd64.rpm&response-content-type=application%2Foctet-stream [following] --2020-05-27 00:52:07-- https://github-production-release-asset-2e65be.s3.amazonaws.com/23267883/2ac8069c-5dfa-11e8-85cc-30b65d788746?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200526%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200526T195207Z&X-Amz-Expires=300&X-Amz-Signature=9c0cd6353eb693eb04a558da6ad463378d69d30ba5e022b5d3c3051907855122&X-Amz-SignedHeaders=host&actor_id=0&repo_id=23267883&response-content-disposition=attachment%3B%20filename%3Dsemaphore_2.5.1_linux_amd64.rpm&response-content-type=application%2Foctet-stream Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.145.123 Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.145.123|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 4749991 (4.5M) [application/octet-stream] Saving to: âsemaphore_2.5.1_linux_amd64.rpmâ semaphore_2.5.1_lin 100%[===================>] 4.53M 1016KB/s in 5.0s 2020-05-27 00:52:13 (921 KB/s) - âsemaphore_2.5.1_linux_amd64.rpmâ saved [4749991/4749991]

    Now, install the Semaphore package by using dnf command.

    [root@semaphore-01 ~]# dnf install -y semaphore_2.5.1_linux_amd64.rpm Last metadata expiration check: 0:09:11 ago on Wed 27 May 2020 12:43:57 AM PKT. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: semaphore x86_64 2.5.1-1 @commandline 4.5 M Transaction Summary ================================================================================ Install 1 Package Total size: 4.5 M Installed size: 13 M Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: semaphore-2.5.1-1.x86_64 1/1 Installing : semaphore-2.5.1-1.x86_64 1/1 Running scriptlet: semaphore-2.5.1-1.x86_64 1/1 Verifying : semaphore-2.5.1-1.x86_64 1/1 Installed: semaphore-2.5.1-1.x86_64 Complete!

    Verify the installation of Ansible Semaphore by checking its version.

    [root@semaphore-01 ~]# semaphore -version v2.5.1

    Ansible Semaphore has been installed on CentOS 8.

     

    Configure Ansible Semaphore on CentOS 8:

    To configure Sempahore web UI, execute the following command and provide the required parameters as follows.

    [root@semaphore-01 ~]# semaphore -setup Hello! You will now be guided through a setup to: 1. Set up configuration for a MySQL/MariaDB database 2. Set up a path for your playbooks (auto-created) 3. Run database Migrations 4. Set up initial semaphore user & password > DB Hostname (default 127.0.0.1:3306): 127.0.0.1:3306 > DB User (default root): root > DB Password: 123 > DB Name (default semaphore): semaphore > Playbook path (default /tmp/semaphore): /opt/semaphore > Web root URL (optional, example http://localhost:8010/): http://localhost:8010/ > Enable email alerts (y/n, default n): n > Enable telegram alerts (y/n, default n): n > Enable LDAP authentication (y/n, default n): n Generated configuration: { "mysql": { "host": "127.0.0.1:3306", "user": "root", "pass": "123", "name": "semaphore" }, "port": "", "tmp_path": "/opt/semaphore", "cookie_hash": "amackrz6Wq4yQCTPPZFJOdPn5ZXrlwW9q5nFDrdz7bU=", "cookie_encryption": "+kh28Q3TZw7TFMTUj7JSQPsJg6TiueaM3MlQ0Y/quZ4=", "email_sender": "", "email_host": "", "email_port": "", "web_host": "http://localhost:8010/", "ldap_binddn": "", "ldap_bindpassword": "", "ldap_server": "", "ldap_searchdn": "", "ldap_searchfilter": "", "ldap_mappings": { "dn": "", "mail": "", "uid": "", "cn": "" }, "telegram_chat": "", "telegram_token": "", "concurrency_mode": "", "max_parallel_tasks": 0, "email_alert": false, "telegram_alert": false, "ldap_enable": false, "ldap_needtls": false } > Is this correct? (yes/no): yes > Config output directory (default /root): /etc/semaphore Running: mkdir -p /etc/semaphore.. Configuration written to /etc/semaphore/config.json.. Pinging db.. Running DB Migrations.. Checking DB migrations Creating migrations table Executing migration v0.0.0 (at 2020-05-27 12:27:24.45158697 +0500 PKT m=+106.357625439)... [11/11] Executing migration v1.0.0 (at 2020-05-27 12:27:24.546940933 +0500 PKT m=+106.452979414)... [7/7] Executing migration v1.1.0 (at 2020-05-27 12:27:24.6319435 +0500 PKT m=+106.537981967)... [1/1] Executing migration v1.2.0 (at 2020-05-27 12:27:24.64419921 +0500 PKT m=+106.550237674)... [1/1] Executing migration v1.3.0 (at 2020-05-27 12:27:24.649860391 +0500 PKT m=+106.555898875)... [3/3] Executing migration v1.4.0 (at 2020-05-27 12:27:24.657201716 +0500 PKT m=+106.563240171)... [2/2] Executing migration v1.5.0 (at 2020-05-27 12:27:24.665959955 +0500 PKT m=+106.571998419)... [1/1] Executing migration v0.1.0 (at 2020-05-27 12:27:24.672315103 +0500 PKT m=+106.578353568)... [6/6] Executing migration v1.6.0 (at 2020-05-27 12:27:24.688564215 +0500 PKT m=+106.594602697)... [4/4] Executing migration v1.7.0 (at 2020-05-27 12:27:24.698647135 +0500 PKT m=+106.604685611)... [1/1] Executing migration v1.8.0 (at 2020-05-27 12:27:24.708400388 +0500 PKT m=+106.614438870)... [2/2] Executing migration v1.9.0 (at 2020-05-27 12:27:24.717120752 +0500 PKT m=+106.623159225)... [2/2] Executing migration v2.2.1 (at 2020-05-27 12:27:24.72921036 +0500 PKT m=+106.635248822)... [2/2] Executing migration v2.3.0 (at 2020-05-27 12:27:24.746290078 +0500 PKT m=+106.652328536)... [3/3] Executing migration v2.3.1 (at 2020-05-27 12:27:24.760803184 +0500 PKT m=+106.666841662)... [1/1] Executing migration v2.3.2 (at 2020-05-27 12:27:24.763959613 +0500 PKT m=+106.669998075)... [1/1] Executing migration v2.4.0 (at 2020-05-27 12:27:24.76662111 +0500 PKT m=+106.672659571)... [1/1] Executing migration v2.5.0 (at 2020-05-27 12:27:24.769857459 +0500 PKT m=+106.675895917)... [1/1] Migrations Finished > Username: centlinux > Email: ahmer@centlinux.com WARN[0126] sql: no rows in result set level=Warn > Your name: CentLinux > Password: 123 You are all setup CentLinux! Re-launch this program pointing to the configuration file ./semaphore -config /etc/semaphore/config.json To run as daemon: nohup ./semaphore -config /etc/semaphore/config.json & You can login with ahmer@centlinux.com or centlinux.

     

    Create Semaphore Service on CentOS 8:

    To configure autostart of Ansible Semaphore, we have to create a systemd unit for Semaphore service.

    [root@semaphore-01 ~]# vi /usr/lib/systemd/system/semaphore.service

    Add following directives in this file.

    [Unit] Description=Semaphore Ansible UI Wants=network-online.target After=network-online.target [Service] Type=simple ExecReload=/bin/kill -HUP $MAINPID ExecStart=/usr/bin/semaphore -config /etc/semaphore/config.json SyslogIdentifier=semaphore Restart=always [Install] WantedBy=multi-user.target

    Enable and start semaphore.service.

    [root@semaphore-01 ~]# systemctl enable --now semaphore.service Created symlink /etc/systemd/system/multi-user.target.wants/semaphore.service â /usr/lib/systemd/system/semaphore.service.

    Allow Semaphore default service port in CentOS firewall.

    [root@semaphore-01 ~]# firewall-cmd --permanent --add-port=3000/tcp success [root@semaphore-01 ~]# firewall-cmd --reload success

    Semaphore uses plain text http protocol. Therefore, it is advisable to configure a https reverse proxy server by using Caddy or Nginx for enhanced security. We are not reproducing the steps here, but you can follow our previous articles to configure reverse proxy using Nginx or Caddy on CentOS.

     

    Access Ansible Semaphore Web UI:

    To access Semaphore web interface, browse URL http://semaphore-01.centlinux.com:3000 in Google Chrome.

    01-install-ansible-semaphore-centos-8-login

    We are at the login page of the Ansible Semaphore. Login by using the user/password that we have created during configuration of Semaphore.

    02-install-ansible-semaphore-centos-8-dashboard

    After successful login, we are now at the dashboard of Semaphore. Since, it is a new server and we didn't yet configure anything, therefore it is empty.

    Click on + button after Projects to add a new project.

    03-install-ansible-semaphore-centos-8-add-new-project

    Provide a Project name and click on Create button.

    04-install-ansible-semaphore-centos-8-dashboard

    We are again at the dashboard of the Semaphore. Click on the newly added project to open it.

    05-install-ansible-semaphore-centos-8-project

    Our Ansible Semaphore server has been installed on CentOS 8. Before using Semaphore web interface, you should refer to Semaphore Documentation to build the necessary understanding about its usage.

    No comments:

    Post a comment