Files

37 lines
1.0 KiB
YAML
Raw Permalink Normal View History

2026-09-20 22:14:56 +00:00
---
- name: ensure /opt/xray-core/config exists
ansible.builtin.file:
path: /opt/xray-core/config
state: directory
owner: xray-core
group: xray-core
mode: "0755"
- name: ensure /var/log/xray-core exists
ansible.builtin.file:
path: /var/log/xray-core
state: directory
owner: xray-core
group: xray-core
mode: "0755"
- name: deploy xray-core static config
ansible.builtin.copy:
src: "{{ item }}"
dest: "/opt/xray-core/config/{{ item | basename }}"
owner: xray-core
group: xray-core
mode: "0644"
loop: "{{ query('ansible.builtin.fileglob', role_path + '/files/' + inventory_hostname + '/*.jsonc') }}"
notify: restart xray-core
- name: render xray-core dynamic config
ansible.builtin.template:
src: "{{ item }}"
dest: "/opt/xray-core/config/{{ item | basename | regex_replace('\\.j2$', '') }}"
owner: xray-core
group: xray-core
mode: "0644"
loop: "{{ query('ansible.builtin.fileglob', role_path + '/templates/' + inventory_hostname + '/*.jsonc.j2') }}"
notify: restart xray-core