Files
ouranos/ansible/lobechat/deploy.yml
Robert Helewka b4d60f2f38 docs: rewrite README with structured overview and quick start guide
Replaces the minimal project description with a comprehensive README
including a component overview table, quick start instructions, common
Ansible operations, and links to detailed documentation. Aligns with
Red Panda Approval™ standards.
2026-03-03 12:49:06 +00:00

83 lines
2.2 KiB
YAML

---
- name: Deploy LobeChat to Dev Environment
hosts: ubuntu
tasks:
- name: Check if host has lobechat service
ansible.builtin.set_fact:
has_lobechat_service: "{{ 'lobechat' in services | default([]) }}"
- name: Skip hosts without lobechat service
ansible.builtin.meta: end_host
when: not has_lobechat_service
- name: Create lobechat group
become: true
ansible.builtin.group:
name: "{{lobechat_user}}"
- name: Create lobechat user
become: true
ansible.builtin.user:
name: "{{lobechat_user}}"
comment: "{{lobechat_user}}"
group: "{{lobechat_group}}"
system: true
- name: Add group lobechat to user ponos
become: true
ansible.builtin.user:
name: ponos
groups: "{{lobechat_group}}"
append: true
- name: Create lobechat directory
become: true
ansible.builtin.file:
path: "{{lobechat_directory}}"
owner: "{{lobechat_user}}"
group: "{{lobechat_group}}"
state: directory
mode: '750'
- name: Template docker-compose file
become: true
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{lobechat_directory}}/docker-compose.yml"
owner: "{{lobechat_user}}"
group: "{{lobechat_group}}"
mode: '550'
register: lobechat_compose
- name: Reset SSH connection to apply group changes
meta: reset_connection
- name: Start LobeChat service
become: true
community.docker.docker_compose_v2:
project_src: "{{lobechat_directory}}"
state: present
pull: always
- name: Restart LobeChat if configuration changed
become: true
community.docker.docker_compose_v2:
project_src: "{{lobechat_directory}}"
state: restarted
when: lobechat_compose.changed
- name: Wait for LobeChat to be healthy
ansible.builtin.uri:
url: "http://localhost:{{lobechat_port}}/chat"
method: GET
status_code: 200
register: lobechat_health
until: lobechat_health.status == 200
retries: 30
delay: 5
delegate_to: "{{inventory_hostname}}"
- name: Display LobeChat status
ansible.builtin.debug:
msg: "LobeChat is running at http://{{inventory_hostname}}:{{lobechat_port}}"