--- - 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 - name: create python venv for xray-lists command: python3 -m venv /opt/xray-lists/venv args: creates: /opt/xray-lists/venv/bin/pip - name: clone xray-lists repository git: repo: "http://10.1.0.104:3000/pyrschtjag/xray-lists.git" 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: src: update.sh dest: /var/lib/xray-lists/update.sh owner: root group: root mode: '0755' - name: deploy systemd service and timer unit copy: src: "{{ item }}" dest: "/etc/systemd/system/{{ item }}" owner: root group: root mode: '0644' loop: - xray-lists.service - xray-lists.timer notify: run xray-lists systemd timer unit