Get your XTLS/Xray server up and running with Ansible.
- A Linux machine with
systemd
(tested with DigitalOcean's 1vCPU-512MB-10GB Ubuntu 23.10 droplet) - SSH config to access the Linux machine as a
root
(to make Ansible playbook work) - Python &
pip
- (Optional) NekoRay/NekoBox client (tested with v3.23)
- Clone the repo
- Change directory
cd xray-ansible
- Install requirements
pip install -r requirements.txt
- Add your Linux machine IP address to the Ansible inventory file, e.g.
~/.ansible/hosts
:
[xray]
xray-az-label-1 ansible_host=your.machine.ip.address
- Run the playbook with verbosity 1:
ansible-playbook -v --limit xray playbook-xray-setup.yaml \
--inventory ~/.ansible/hosts \
--user root
- Note the
ansible_facts
from the stepxray: Decode and set Xray variables from file
, you will need them to set up your client
The playbook is parametrized with the following variables:
xray_version
- version string of the Xray-core [defaultv1.8.1
]xray_platform
- platform the binary compiled for, see Xray-core releases for more platforms [defaultlinux-64
]xray_path
- path for the Xray-core installation [default/opt/xray
]
Use -e variable=value
Ansible CLI argument to change default values, e.g.:
ansible-playbook -v --limit xray playbook-xray-setup.yaml \
--inventory ~/.ansible/hosts \
--user root \
-e xray_version=v1.8.4
- Download the NekoRay client
- Unzip
- Change directory to unzipped client
- Run as
./launcher
- Preferences -> Basic Settings -> Core -> sign box
- Server -> New profile -> Type VLESS
- Edit settings:
Common:
Name: you profile name
Address: your Linux machine IP address/DNS
Port: 443
VLESS:
UUID: ansible_facts -> xray -> uuid
Flow: xtls-rprx-vision
Settings:
Settings: tcp
Security: tls
Packet encoding: xudp
TLS security settings:
SNI: www.microsoft.com
ALPN: h2
TLS camouflage Settings:
uTLS: chrome
Reality Pbk: ansible_facts -> xray -> x25519_public
Reaily Sid: ansible_facts -> xray -> short_id
- Save settings
- Select the new profile in the list -> right mouse click -> Start
- Select the new profile in the list -> right mouse click -> Current Select -> URL test
- If test from the previous step is ok, then select the checkbox System proxy
- Enjoy
The Ansible playbook and the xray
role have been developed by
dmgening and productionized by
pilosus.
The playbook relies heavily on the tutorial (in Russian; last accessed on 25.10.23) by MiraclePtr.