Ansible WebUI工具之Semaphore

semaphore 是一款基于GO语言编写的 Ansible-WebUI系统,同类产品还有:

  • Tower,商业软件
  • awx,Tower的上游软件,开源免费,不适应于生产环境
  • ara 等

MySQL 安装

<略过>

Semphore 安装部署

  1. 下载 deb包安装
# wget https://github.com/ansible-semaphore/semaphore/releases/download/v2.5.1/semaphore_2.5.1_linux_amd64.deb
# dpkg -i semaphore_2.5.1_linux_amd64.deb
  1. 查看安装状态
# semaphore  -version
v2.5.1
  1. 初始化
semaphore -setup
Hello! You will now be guided through a setup to:
 Set up configuration for a MySQL/MariaDB database
 Set up a path for your playbooks (auto-created)
 Run database Migrations
 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: <root Password>  
   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 
   <略过若干行>
  1. 启动测试
# semaphore -config /root/config.json &
  1. 使用systemd 管理
cat >/etc/systemd/system/semaphore.service<<EOF
[Unit]
Description=Semaphore Ansible UI
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 -config /etc/semaphore/config.json
SyslogIdentifier=semaphore
Restart=always

[Install]
WantedBy=multi-user.target
EOF

# mkdir /etc/semaphore
# sudo ln -s /root/config.json /etc/semaphore/config.json

启用systemd 启动服务

sudo systemctl start semaphore
  1. 使用浏览器访问

http://SERVER_IP:3000
01

  1. 任务执行日志

Ansible 代码: https://github.com/vqiu/for-semaphore

02-1

资料引用