Semaphore UI 적용(Ansible)

Laigasus

Troubleshooting|2024년 10월 10일|마지막 수정 시간: 2024년 10월 14일|
type
status
date
slug
summary
tags
category
icon
password

소개

awx 적용 사례는 아래의 링크를 참고하세요
 

종류

RedHat Ansible Automation Platform

Red Hat Ansible Automation Platform은 엔터프라이즈급 자동화 솔루션으로, 강력한 기능과 지원을 제공합니다. 이 플랫폼은 대규모 조직에서 복잡한 IT 인프라를 관리하고 자동화하는 데 특히 유용합니다. 그러나 이러한 기능의 대가로 상당한 비용이 발생할 수 있습니다.

AWX

AWX는 Red Hat Ansible Tower의 오픈소스 버전으로, 많은 Ansible Tower의 기능을 무료로 제공합니다. 이는 중소규모 조직이나 예산이 제한된 팀에게 좋은 선택이 될 수 있습니다. AWX는 Ansible 플레이북의 시각화, 역할 기반 접근 제어, 작업 스케줄링 등의 기능을 제공하여 Ansible 자동화를 보다 효율적으로 관리할 수 있게 해줍니다.

Rundeck

Rundeck는 다양한 자동화 작업을 위한 오픈소스 플랫폼입니다. Ansible 뿐만 아니라 다양한 스크립트와 도구를 통합할 수 있어 유연성이 높습니다. 작업 스케줄링, 접근 제어, 로깅 등의 기능을 제공하며, 플러그인 시스템을 통해 확장성도 뛰어납니다. 그러나 Ansible에 특화된 기능은 상대적으로 적을 수 있습니다.

Semaphore

Semaphore는 Ansible을 위한 오픈소스 웹 UI 및 대시보드입니다. 경량화되어 있어 설치와 사용이 간단하며, 기본적인 Ansible 작업 관리 기능을 제공합니다. 사용자 친화적인 인터페이스로 Ansible 플레이북의 실행과 모니터링을 용이하게 합니다.
 
비교표는 다음과 같습니다
도구
장점
단점
RedHat Ansible Automation Platform
사후 지원, 엔터프라이즈 기능
유료, 복잡할 수 있음
AWX
Ansible Tower의 오픈소스 버전
현재 쿠버네티스로만 설치 가능
Rundeck
유연성, 여러 언어 호환 플러그인 지원
Ansible 특화 기능 부족
Semaphore
오픈소스, 경량화, 클라우드 지원
최소한의 기능

설치

Semaphore 설치 작업은 redhat 계열 리눅스로 진행됩니다.

환경 구성

노드 구조는 다음과 같습니다.
 

Vagrant 구성

설치

충족되는 환경 구성을 위해 vagrant 를 설치합니다.
 

프로비저닝

구성환경이 반영된 Vagrantfile 을 준비합니다.
당시 윈도우 24H2 에서 Virtualbox 와 Vagrant 가 호환이 안되어 vmware를 사용했습니다.
 
디렉터리 내 Vagrantfile 을 두고 vagrant up 으로 프로비저닝합니다.
 

Control 계정 생성

제어 노드(Control Tower) 와 관리형 노드(Host) 에 모두 동일한 계정을 생성합니다
 

SSH 키 연결

인스턴스가 생성되면 ssh로 접속해줍니다.
 
Tower 노드가 제어 노드들을 접근하기 위해 키를 생성합니다.
 
이후 다른 노드에게 공유합니다.
💡
root 계정 로그인을 허용하려면 제어 노드의 etc/ssh/sshd_config 값을 변경합니다
  • PermitRootLogin yes
  • PasswordAuthentication yes
 
추가로 비밀번호를 묻지 않으려면 sudoers 에 등록해주어야 합니다.
 

Ansible 설치

패키지 설치

 

Ansible 설정

설치되면 ansible.cfg 값을 설정합니다.
저는 semaphore 기본 설정으로 두고자 /etc/ansible/ansible.cfg 를 수정했습니다.
 
임시로 ansible.cfg , inventory 를 생성합니다.
 
UI 설치 전 정상 동작하는지 확인합니다
 
임시 생성 파일은 지우고, UI에서 생성해보겠습니다

Semaphore 구성

설치

Semaphore UI 공식 사이트에서 다운로드합니다.
semaphore
semaphoreuiUpdated Oct 26, 2024
 
다운로드된 패키지를 설치합니다.
 

세팅

세팅을 하되 저는 내장 DB를 활용했습니다.
프로그램 종료시 기록이 안남기 때문에 로그 분석이 필요하면 외부 DB 연동을 고려해야 합니다.
 
재부팅 후에도 실행될 수 있도록 service로 등록합니다.
 
config 파일을 /etc/semaphore/config.json 로 이동시키고, semaphore 와 내부 파일의 소유, 그룹 대상을 변경합니다
 
실행합니다. http://[Tower Node ip]:3000 로 접속할 수 있습니다.
 
💡
vmware 로 동일 ip 에 포트만 다를 경우 터널링 연결하면 접속할 수 있습니다.
 
프로젝트 생성을 합니다.
notion image
 
Tower 노드 private 키를 등록합니다.
notion image
 
인벤토리를 추가해줍니다.
notion image
 
테스트용 플레이북을 Github에 올렸습니다.
notion image
 
플레이북을 관리할 repo를 할당해줍니다. 원격지 repository 가 존재해야 하며, private 사용 시 ssh 키를 형상관리 호스팅 서비스(Github)에 별도 등록해야 합니다.
notion image
 
다른 노드에 정상 수행되었습니다.
notion image
 
스케줄링이나 트리거를 설정해 github action 와 연계할 수 있습니다.
 

REF
Complete Ansible Semaphore Tutorial: From Installation to Automation
Do you want to make server deployment easier? Consider Ansible Semaphore: An awesome project that provides a full GUI experience around Ansible, enabling you to take your automation game to the next level. In this video, Jay will show you how to install Ansible Semaphore, set it up, and more! *LEARN LINUX TV - YOUR HOME FOR LINUX-RELATED FUN AND LEARNING!* *🎓 BRAND NEW UDEMY COURSES AVAILABLE!* Check out my new courses on Udemy and learn something new! • Getting Started with Ansible ➜ https://learnlinux.link/ansible • LPI Linux Essentials Complete Workshop ➜ https://learnlinux.link/linux-essentials *Check out the Linux Shop* Shirts, hats, stickers, bags and more ➜ https://merch.learnlinux.tv *Support the Channel* Show your support for Learn Linux TV and get access to exclusive perks! • Become a Channel Member ➜ https://learnlinux.link/member • Become a Patron ➜ https://learnlinux.link/patron *Official Stores and Merchandise* • Linux Merch ➜ https://merch.learnlinux.tv • Latest book: Mastering Ubuntu Server ➜ https://ubuntuserverbook.com • Linux stuff from Amazon ➜ https://learnlinux.link/amazon • Awesome Pi-powered KVM ➜ https://learnlinux.link/tinypilot • 5% discount on LPI exam vouchers ➜ https://learnlinux.link/lpi-voucher _Note: Royalties and/or commission is earned from each of the above links_ *⏰ TIME CODES* 00:00 - Intro 00:45 - Updated Shop (commission earned) 01:44 - Some basic information about our project 04:31 - Installing MariaDB 06:22 - Using mysql_secure_installation to secure mariadb 08:57 - Setting up a MySQL database for Ansible Semaphore 09:47 - Creating a database user for Semaphore 12:02 - Installing Ansible Semaphore 14:11 - Creating a config file for Semaphore 18:54 - Installing Ansible on Debian 12 19:20 - Running Semaphore from the shell 21:21 - Creating a Systemd unit for Semaphore 24:47 - Setting up a project in Semaphore 27:13 - Support message 27:46 - Creating a Production environment in Semaphore 28:37 - Creating an SSH key 31:10 - Setting up an Inventory, and a Task Template 32:29 - Configuring "sudoers" on the Ansible target 35:00 - Testing SSH connectivity between the server and target 36:52 - Adding a Playbook to our Git repository 38:50 - Installing NGINX 40:50 - Setting up NGINX as a proxy for Semaphore 44:51 - Setting up a TLS certificate for Semaphore with Let's Encrypt *Relevant Links* • Check out Ansible Semaphore ➜ https://www.semui.co • Semaphore Releases Page ➜ https://github.com/ansible-semaphore/semaphore/releases • Official blog post for this video ➜ https://learnlinux.link/semaphore*🎓 FULL LINUX COURSES FROM LEARN LINUX TV* • Linux Crash Course ➜ https://linux.video/cc • Learn tmux ➜ https://linux.video/tmux • Learn vim ➜ https://linux.video/vim • Bash Scripting Series ➜ https://linux.video/bash • Proxmox VE ➜ https://linux.video/pve • Getting Started with Ansible (Udemy) ➜ https://learnlinux.link/ansible • LPI Linux Essentials Workshop (Udemy) ➜ https://learnlinux.link/linux-essentials *🌐 LEARN LINUX TV ON THE WEB* • Main site ➜ https://www.learnlinux.tv • Community ➜ https://community.learnlinux.tv • Official Github Account ➜ https://github.com/LearnLinuxTV • Enterprise Linux Security Podcast ➜ https://enterpriselinuxsecurity.show • The Homelab Show Podcast ➜ https://thehomelab.show • Jay on Udemy ➜ https://www.udemy.com/user/jay-lacroix-3 • Jay on Twitter ➜ https://x.com/JayTheLinuxGuy • Content Ethics ➜ https://www.learnlinux.tv/content-ethics • Request Assistance ➜ https://www.learnlinux.tv/request-assistance *⚠️ DISCLAIMER* Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. Always make sure you have written permission before working with any infrastructure and that you are compliant with all company rules, change control procedures, and local laws. #CloudComputing #DevOps #Ansible
Complete Ansible Semaphore Tutorial: From Installation to Automation
Loading...