https://github.com/mehradi-github/ref-singbox
Installing sing-box on Linux via Ansible
https://github.com/mehradi-github/ref-singbox
ansible jinja linux reality sing-box
Last synced: about 1 month ago
JSON representation
Installing sing-box on Linux via Ansible
- Host: GitHub
- URL: https://github.com/mehradi-github/ref-singbox
- Owner: mehradi-github
- License: mit
- Created: 2023-05-27T21:47:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-09T08:10:17.000Z (over 2 years ago)
- Last Synced: 2025-08-30T12:36:42.933Z (10 months ago)
- Topics: ansible, jinja, linux, reality, sing-box
- Language: Jinja
- Homepage:
- Size: 79.1 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Installing sing-box via Ansible
Installing [sing-box](https://github.com/SagerNet/sing-box) on Linux via [Ansible](https://docs.ansible.com/ansible/latest/index.html)
Ansible automates the management of remote systems and controls their desired state. more details [Automation with Ansible](https://github.com/mehradi-github/ref-ansible#automation-with-ansible).
- [Installing sing-box via Ansible](#installing-sing-box-via-ansible)
- [Requirments](#requirments)
- [Installing Ansible](#installing-ansible)
- [Gathers facts about remote hosts](#gathers-facts-about-remote-hosts)
- [Adding hosts](#adding-hosts)
- [Installing sing-box on Server](#installing-sing-box-on-server)
- [Installing sing-box on Client](#installing-sing-box-on-client)
## Requirments
### Installing Ansible
Ansible automates the management of remote systems and controls their desired state. [[Installing Ansible on Ubuntu](https://github.com/mehradi-github/ref-ansible#installing-ansible-on-ubuntu)]
## Gathers facts about remote hosts
```sh
vi /etc/ansible/hosts
ansible all -m ping
#Gathers facts about remote hosts
ansible all -m setup
```
### Adding hosts
```sh
# Download project and cd to project dir
vi ./src/hosts
# Changing SERVER-IP,USER and PORT
[servers]
SERVER-IP ansible_user=USER ansible_port=PORT
```
## Installing sing-box on Server
```sh
vi ./src/roles/server-sing-box/vars/main.yml
# Changing port and SNI
listen_port: 443
server_name: 'example.com'
cd ./src
ansible-playbook -i ./hosts ./install-playbook.yaml -t servers
ansible-playbook -i ./hosts ./install-playbook.yaml -t servers -K
```
-k, --ask-pass: ask for connection password
-K, --ask-become-pass: ask for privilege escalation password
## Installing sing-box on Client
```sh
vi src/roles/client-sing-box/vars/main.yml
# Changing below vars based on server info
server_ipv4: 'a'
uuid: 'b'
server_name: 'c'
public_key: 'd'
short_id: 'e'
cd ./src
ansible-playbook ./install-playbook.yaml -t clients
```