2026-08-28 11:03:45 +00:00
|
|
|
---
|
|
|
|
|
- name: install required system packages
|
|
|
|
|
apt:
|
|
|
|
|
name:
|
|
|
|
|
- python3-venv
|
|
|
|
|
- git
|
|
|
|
|
state: present
|
|
|
|
|
update_cache: yes
|
|
|
|
|
|
|
|
|
|
- name: ensure base directories exist
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ item }}"
|
|
|
|
|
state: directory
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0755'
|
|
|
|
|
loop:
|
|
|
|
|
- /opt/xray-lists
|
|
|
|
|
- /var/lib/xray-lists
|
|
|
|
|
|
2026-09-07 19:50:34 +00:00
|
|
|
- name: create python venv for xray-lists
|
|
|
|
|
command: python3 -m venv /opt/xray-lists/venv
|
|
|
|
|
args:
|
|
|
|
|
creates: /opt/xray-lists/venv/bin/pip
|
|
|
|
|
|
2026-08-28 11:03:45 +00:00
|
|
|
- name: clone xray-lists repository
|
|
|
|
|
git:
|
2026-09-07 19:50:34 +00:00
|
|
|
repo: "http://10.1.0.104:3000/pyrschtjag/xray-lists.git"
|
2026-08-28 11:03:45 +00:00
|
|
|
dest: /opt/xray-lists-src
|
|
|
|
|
version: main
|
|
|
|
|
force: yes
|
|
|
|
|
|
|
|
|
|
- name: check if xray-lists is installed
|
|
|
|
|
command: /opt/xray-lists/venv/bin/pip show xray-lists
|
|
|
|
|
register: pip_check
|
|
|
|
|
changed_when: false
|
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
|
|
- name: install xray-lists package into venv
|
|
|
|
|
command: /opt/xray-lists/venv/bin/pip install -e /opt/xray-lists-src[socks]
|
|
|
|
|
when: pip_check.rc != 0
|
|
|
|
|
|
|
|
|
|
- name: deploy update helper script
|
|
|
|
|
copy:
|
2026-09-07 19:50:34 +00:00
|
|
|
src: update.sh
|
2026-08-28 11:03:45 +00:00
|
|
|
dest: /var/lib/xray-lists/update.sh
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0755'
|
|
|
|
|
|
2026-09-07 19:50:34 +00:00
|
|
|
- name: deploy systemd service and timer unit
|
2026-08-28 11:03:45 +00:00
|
|
|
copy:
|
2026-09-07 19:50:34 +00:00
|
|
|
src: "{{ item }}"
|
|
|
|
|
dest: "/etc/systemd/system/{{ item }}"
|
2026-08-28 11:03:45 +00:00
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0644'
|
2026-09-07 19:50:34 +00:00
|
|
|
loop:
|
|
|
|
|
- xray-lists.service
|
|
|
|
|
- xray-lists.timer
|
|
|
|
|
notify: run xray-lists systemd timer unit
|