[PR #5632] [CLOSED] feat(deploy): add Ansible role for automated 3x-ui installation #5940

Closed
opened 2026-11-02 04:05:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5632
Author: @alchkalbasi
Created: 6/28/2026
Status: ❌ Closed

Base: main ← Head: feat/ansible-deployment


📝 Commits (1)

  • 9f89157 feat(deploy): add Ansible role for automated 3x-ui installation

📊 Changes

21 files changed (+1074 additions, -0 deletions)

View changed files

➕ ansible/.gitignore (+2 -0)
➕ ansible/README.md (+83 -0)
➕ ansible/inventories/hosts.sample.yml (+9 -0)
➕ ansible/playbook.yml (+8 -0)
➕ ansible/roles/install-3x-ui/defaults/main.yml (+56 -0)
➕ ansible/roles/install-3x-ui/handlers/main.yml (+11 -0)
➕ ansible/roles/install-3x-ui/tasks/configure.yml (+115 -0)
➕ ansible/roles/install-3x-ui/tasks/database.yml (+92 -0)
➕ ansible/roles/install-3x-ui/tasks/install.yml (+218 -0)
➕ ansible/roles/install-3x-ui/tasks/main.yml (+44 -0)
➕ ansible/roles/install-3x-ui/tasks/prerequisites.yml (+149 -0)
➕ ansible/roles/install-3x-ui/tasks/service.yml (+56 -0)
➕ ansible/roles/install-3x-ui/tasks/ssl.yml (+157 -0)
➕ ansible/roles/install-3x-ui/templates/install-result.env.j2 (+10 -0)
➕ ansible/roles/install-3x-ui/templates/x-ui-db.env.j2 (+6 -0)
➕ ansible/roles/install-3x-ui/templates/x-ui-panel.env.j2 (+7 -0)
➕ ansible/roles/install-3x-ui/templates/x-ui.rc.j2 (+18 -0)
➕ ansible/roles/install-3x-ui/templates/x-ui.service.j2 (+19 -0)
➕ ansible/roles/install-3x-ui/vars/Debian.yml (+6 -0)
➕ ansible/roles/install-3x-ui/vars/RedHat.yml (+6 -0)

...and 1 more files

📄 Description

Hi.
I put together an Ansible setup for 3x-ui to make deploying and managing the panel a lot easier, especially for folks running multiple nodes.

The current shell script is great for single servers, but managing things across a cluster manually gets tricky. I wanted to provide a way to automate the whole stack.

Why this helps:

  1. No more manual setups: You can spin up identical panel nodes from scratch without running through the steps by hand every time.

  2. Handles the annoying stuff: It automatically takes care of firewall rules (like firewalld) and Let's Encrypt SSL via acme.sh so you don't have to mess with port 80 routing manually.

  3. Safe to rerun: It's idempotent. You can run the playbook again to update configs or fix a broken state without worrying about wiping the SQLite database or dropping active Xray tunnels.

What's inside:

  • inventory.sample.yml: A quick template for users to define their servers.

  • playbook.yml: The main entry point to kick off the deployment.

  • roles/install-3x-ui/: The actual automation logic (handles prerequisites, pulling binaries, SSL, and creating the systemd service).

Testing

I built and tested this primarily on Debian-based systems (Debian 12 and Ubuntu 20.04 - 24.04). The Xray-core service initializes perfectly under systemd and the web UI spins up without issues.

I think it would be great if this repository also included an Ansible role, since it would solve a problem I was facing.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5632 **Author:** [@alchkalbasi](https://github.com/alchkalbasi) **Created:** 6/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/ansible-deployment` --- ### 📝 Commits (1) - [`9f89157`](https://github.com/MHSanaei/3x-ui/commit/9f891571c1c69cdb86366f5a8e867d5b01c0e2a4) feat(deploy): add Ansible role for automated 3x-ui installation ### 📊 Changes **21 files changed** (+1074 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `ansible/.gitignore` (+2 -0) ➕ `ansible/README.md` (+83 -0) ➕ `ansible/inventories/hosts.sample.yml` (+9 -0) ➕ `ansible/playbook.yml` (+8 -0) ➕ `ansible/roles/install-3x-ui/defaults/main.yml` (+56 -0) ➕ `ansible/roles/install-3x-ui/handlers/main.yml` (+11 -0) ➕ `ansible/roles/install-3x-ui/tasks/configure.yml` (+115 -0) ➕ `ansible/roles/install-3x-ui/tasks/database.yml` (+92 -0) ➕ `ansible/roles/install-3x-ui/tasks/install.yml` (+218 -0) ➕ `ansible/roles/install-3x-ui/tasks/main.yml` (+44 -0) ➕ `ansible/roles/install-3x-ui/tasks/prerequisites.yml` (+149 -0) ➕ `ansible/roles/install-3x-ui/tasks/service.yml` (+56 -0) ➕ `ansible/roles/install-3x-ui/tasks/ssl.yml` (+157 -0) ➕ `ansible/roles/install-3x-ui/templates/install-result.env.j2` (+10 -0) ➕ `ansible/roles/install-3x-ui/templates/x-ui-db.env.j2` (+6 -0) ➕ `ansible/roles/install-3x-ui/templates/x-ui-panel.env.j2` (+7 -0) ➕ `ansible/roles/install-3x-ui/templates/x-ui.rc.j2` (+18 -0) ➕ `ansible/roles/install-3x-ui/templates/x-ui.service.j2` (+19 -0) ➕ `ansible/roles/install-3x-ui/vars/Debian.yml` (+6 -0) ➕ `ansible/roles/install-3x-ui/vars/RedHat.yml` (+6 -0) _...and 1 more files_ </details> ### 📄 Description Hi. I put together an Ansible setup for 3x-ui to make deploying and managing the panel a lot easier, especially for folks running multiple nodes. The current shell script is great for single servers, but managing things across a cluster manually gets tricky. I wanted to provide a way to automate the whole stack. **Why this helps:** 1. No more manual setups: You can spin up identical panel nodes from scratch without running through the steps by hand every time. 2. Handles the annoying stuff: It automatically takes care of firewall rules (like firewalld) and Let's Encrypt SSL via acme.sh so you don't have to mess with port 80 routing manually. 3. Safe to rerun: It's idempotent. You can run the playbook again to update configs or fix a broken state without worrying about wiping the SQLite database or dropping active Xray tunnels. **What's inside:** - inventory.sample.yml: A quick template for users to define their servers. - playbook.yml: The main entry point to kick off the deployment. - roles/install-3x-ui/: The actual automation logic (handles prerequisites, pulling binaries, SSL, and creating the systemd service). **Testing** I built and tested this primarily on Debian-based systems (Debian 12 and Ubuntu 20.04 - 24.04). The Xray-core service initializes perfectly under systemd and the web UI spins up without issues. > I think it would be great if this repository also included an Ansible role, since it would solve a problem I was facing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:05:10 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5940
No description provided.