playbooks/roles/vhosts/acp_server_codex/tasks/config.yml

76 lines
1.9 KiB
YAML

---
- name: Ensure local Codex ACP build directory exists
ansible.builtin.file:
path: "{{ acp_codex_bridge_local_build_dir }}"
state: directory
mode: "0755"
delegate_to: localhost
become: false
- name: Build XWorkmate Go ACP server locally
ansible.builtin.command:
cmd: go build -o "{{ acp_codex_bridge_local_binary_path }}" .
chdir: "{{ acp_codex_bridge_local_source_dir }}"
environment:
GOOS: "{{ acp_codex_bridge_build_goos }}"
GOARCH: "{{ acp_codex_bridge_build_goarch }}"
CGO_ENABLED: "0"
delegate_to: localhost
become: false
check_mode: false
- name: Upload XWorkmate Go ACP server binary
ansible.builtin.copy:
src: "{{ acp_codex_bridge_local_binary_path }}"
dest: "{{ acp_codex_bridge_binary_path }}"
owner: root
group: root
mode: "0755"
- name: Remove deprecated standalone Codex Caddy fragments
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop: "{{ acp_codex_obsolete_caddy_fragment_paths }}"
notify: Reload caddy
- name: Deploy Caddy main file
ansible.builtin.template:
src: Caddyfile.j2
dest: "{{ acp_codex_caddyfile_path }}"
owner: root
group: root
mode: "0644"
notify: Reload caddy
when:
- acp_codex_manage_caddy | bool
- name: Deploy Codex ACP systemd service
ansible.builtin.template:
src: codex-app-server.service.j2
dest: "/etc/systemd/system/{{ acp_codex_service_name }}.service"
owner: root
group: root
mode: "0644"
notify: Restart acp codex
- name: Reload systemd manager configuration
ansible.builtin.systemd:
daemon_reload: true
- name: Ensure Caddy is enabled and running
ansible.builtin.systemd:
name: caddy
enabled: true
state: started
when:
- acp_codex_manage_caddy | bool
- name: Ensure Codex ACP service is enabled and running
ansible.builtin.systemd:
name: "{{ acp_codex_service_name }}"
enabled: true
state: started
when:
- not ansible_check_mode