refactor: restructure inventory, split roles and add new services
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
---
|
||||
- name: ensure /opt/xray-core/config exists
|
||||
ansible.builtin.file:
|
||||
path: /opt/xray-core/config
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: ensure /var/log/xray-core exists
|
||||
ansible.builtin.file:
|
||||
path: /var/log/xray-core
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: deploy static xray-core config
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/opt/xray-core/config/{{ item }}"
|
||||
mode: 0744
|
||||
loop:
|
||||
- dns.jsonc
|
||||
- inbounds.jsonc
|
||||
- log.jsonc
|
||||
- policy.jsonc
|
||||
register: xray_core_static_config
|
||||
|
||||
- name: deploy dynamic xray-core config
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "/opt/xray-core/config/{{ item }}"
|
||||
mode: 0744
|
||||
loop:
|
||||
- observatory.jsonc
|
||||
- outbounds.jsonc
|
||||
- routing.jsonc
|
||||
register: xray_core_dynamic_config
|
||||
|
||||
- name: restart xray-core systemd service unit
|
||||
ansible.builtin.systemd_service:
|
||||
name: xray-core
|
||||
daemon_reload: true
|
||||
state: restarted
|
||||
enabled: true
|
||||
when: xray_core_static_config.changed or xray_core_dynamic_config.changed
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: include xray-core configurure
|
||||
ansible.builtin.include_tasks: configure.yml
|
||||
Reference in New Issue
Block a user