01_manager_ops.ymlΒΆ

---
- name: "πŸ“„ Render OpenTalk controller config '{{ application_id }}'"
  stack_host_template:
    src: controller.toml.j2
    dest: "{{ [lookup('container', application_id, 'directories.volumes'), 'controller.toml'] | path_join }}"
    mode: "0644"
  notify:
    - compose-up

- name: "πŸ“„ Render LiveKit config '{{ application_id }}'"
  stack_host_template:
    src: livekit.yaml.j2
    dest: "{{ [lookup('container', application_id, 'directories.volumes'), 'livekit.yaml'] | path_join }}"
    mode: "0644"
  notify:
    - compose-up

- name: "πŸ“„ Render RabbitMQ config '{{ application_id }}'"
  stack_host_template:
    src: rabbitmq.conf.j2
    dest: "{{ [lookup('container', application_id, 'directories.volumes'), 'rabbitmq.conf'] | path_join }}"
    mode: "0644"
  notify:
    - compose-up

- name: "πŸ“„ Render OpenTalk recorder config '{{ application_id }}'"
  stack_host_template:
    src: recorder.toml.j2
    dest: "{{ [lookup('container', application_id, 'directories.volumes'), 'recorder.toml'] | path_join }}"
    mode: "0644"
  notify:
    - compose-up

- name: "πŸ“‚ Provision the OpenTalk Keycloak clients"
  include_tasks: 02_keycloak_client.yml
  when: OPENTALK_OIDC_ENABLED | bool

- name: "🚿 Flush handlers for '{{ application_id }}' so compose up sees rendered configs"
  meta: flush_handlers

- name: "πŸͺ£ Provision the embedded object store for '{{ application_id }}'"
  when: lookup('objstore', application_id, 'local') | bool
  block:
    - name: "⏳ Wait until the embedded object store answers"
      ansible.builtin.shell: >
        container exec {{ OPENTALK_OBJSTORE_CONTAINER_ADDRESS }}
        wget -q -O - http://127.0.0.1:{{ lookup('objstore', application_id, 'port') }}/status
      args:
        executable: /bin/bash
      register: objstore_ready
      retries: 60
      delay: 3
      until: objstore_ready.rc == 0
      changed_when: false

    - name: "πŸ“‹ List embedded object-store buckets"
      ansible.builtin.shell: |
        set -euo pipefail
        echo 's3.bucket.list' | container exec -i {{ OPENTALK_OBJSTORE_CONTAINER_ADDRESS }} weed shell -master=localhost:9333
      args:
        executable: /bin/bash
      register: objstore_buckets
      changed_when: false

    - name: "βœ… Ensure the OpenTalk bucket exists (embedded)"
      ansible.builtin.shell: |
        set -euo pipefail
        echo 's3.bucket.create -name {{ lookup('objstore', application_id, 'bucket') }}' | container exec -i {{ OPENTALK_OBJSTORE_CONTAINER_ADDRESS }} weed shell -master=localhost:9333
      args:
        executable: /bin/bash
      changed_when: true
      when: lookup('objstore', application_id, 'bucket') not in objstore_buckets.stdout