61 lines
2.3 KiB
YAML
61 lines
2.3 KiB
YAML
- name: Start Frigate
|
|
hosts: Barad-dur
|
|
tasks:
|
|
- name: Create temporary Docker Compose directory
|
|
ansible.builtin.tempfile:
|
|
state: directory
|
|
register: docker_compose_dir
|
|
- name: Copy docker-compose.yaml
|
|
ansible.builtin.copy:
|
|
src: conf/docker-compose.yaml
|
|
dest: '{{docker_compose_dir.path}}/docker-compose.yaml'
|
|
mode: preserve
|
|
|
|
- name: Read homelab config
|
|
ansible.builtin.slurp:
|
|
src: '{{ansible_user_dir}}/.homelab.json'
|
|
register: homelab_config_file
|
|
- name: Set homelab_config variable
|
|
ansible.builtin.set_fact:
|
|
homelab_config: '{{homelab_config_file.content|b64decode|from_json}}'
|
|
|
|
- name: Get Frigate config
|
|
community.postgresql.postgresql_query:
|
|
login_host: '{{homelab_config.database.host}}'
|
|
login_user: '{{homelab_config.database.user}}'
|
|
login_password: '{{homelab_config.database.password}}'
|
|
db: '{{homelab_config.database.name}}'
|
|
query: 'SELECT config FROM service WHERE name = %s;'
|
|
positional_args:
|
|
- frigate
|
|
register: frigate_config_query
|
|
- name: Set frigate_config variable
|
|
ansible.builtin.set_fact:
|
|
frigate_config: '{{frigate_config_query.query_result[0].config}}'
|
|
|
|
- name: Docker Compose up Frigate
|
|
environment:
|
|
MQTT_PASSWORD: '{{frigate_config.mqtt.password}}'
|
|
IPGEOLOCATION_API_KEY: '{{frigate_config.ipgeolocation.api_key}}'
|
|
FRIGATE_GARAGE_RTSP_PASSWORD: '{{frigate_config.rtsp.garage.password}}'
|
|
FRIGATE_FRONT_DOOR_RTSP_PASSWORD: '{{frigate_config.rtsp.front_door.password}}'
|
|
FRIGATE_DOORBELL_RTSP_PASSWORD: '{{frigate_config.rtsp.doorbell.password}}'
|
|
FRIGATE_DRIVEWAY_RTSP_PASSWORD: '{{frigate_config.rtsp.driveway.password}}'
|
|
FRIGATE_BACK_DOOR_RTSP_PASSWORD: '{{frigate_config.rtsp.back_door.password}}'
|
|
FRIGATE_FAMILY_ROOM_RTSP_PASSWORD: '{{frigate_config.rtsp.family_room.password}}'
|
|
community.docker.docker_compose:
|
|
project_name: frigate
|
|
project_src: '{{docker_compose_dir.path}}'
|
|
state: present
|
|
|
|
- name: Remove temporary Docker Compose directory
|
|
ansible.builtin.file:
|
|
path: '{{docker_compose_dir.path}}'
|
|
state: absent
|
|
|
|
- name: Update CA certificates
|
|
community.docker.docker_container_exec:
|
|
container: frigate-notify
|
|
command: update-ca-certificates
|
|
user: root
|