new-site/infra/ansible/roles/workers/tasks/main.yml
justin f8cd37ac8c Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers,
document generators, FCC compliance tools, Canada CRTC formation,
Ansible infrastructure, and deployment scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 06:54:22 -05:00

42 lines
1.2 KiB
YAML

---
# Performance West — Python workers role
# Starts the document generation + formation automation workers container.
- name: Ensure workers container is running
community.docker.docker_compose_v2:
project_src: "{{ project_dir }}"
services:
- workers
- ollama
state: present
register: workers_compose
- name: Pull Ollama model (first run only)
ansible.builtin.command:
cmd: >-
docker compose exec -T ollama
ollama pull {{ ollama_model }}
chdir: "{{ project_dir }}"
args:
creates: "{{ project_dir }}/ollama-model-pulled"
register: ollama_pull
changed_when: ollama_pull.rc == 0
- name: Mark Ollama model as pulled
ansible.builtin.file:
path: "{{ project_dir }}/ollama-model-pulled"
state: touch
when: ollama_pull.changed
- name: Verify workers job server is accepting connections
ansible.builtin.command:
cmd: >-
docker compose exec -T workers
python -c "import urllib.request; urllib.request.urlopen('http://localhost:8090/health')"
chdir: "{{ project_dir }}"
register: workers_health
retries: 10
delay: 5
until: workers_health.rc == 0
changed_when: false
failed_when: false