frigate/start.yaml

56 lines
2.2 KiB
YAML
Raw Normal View History

2023-05-11 19:03:34 -04:00
- 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:
2023-07-11 07:32:12 -04:00
IPGEOLOCATION_API_KEY: '{{frigate_config.ipgeolocation.api_key}}'
WYZE_EMAIL: '{{frigate_config.wyze.email}}'
WYZE_PASSWORD: '{{frigate_config.wyze.password}}'
2023-05-11 19:03:34 -04:00
FRIGATE_GARAGE_RTSP_PASSWORD: '{{frigate_config.rtsp.garage.password}}'
FRIGATE_FRONT_DOOR_RTSP_PASSWORD: '{{frigate_config.rtsp.front_door.password}}'
2023-07-23 16:41:00 -04:00
FRIGATE_DOORBELL_RTSP_PASSWORD: '{{frigate_config.rtsp.doorbell.password}}'
2023-07-18 16:23:21 -04:00
FRIGATE_DRIVEWAY_RTSP_PASSWORD: '{{frigate_config.rtsp.driveway.password}}'
2023-05-11 19:03:34 -04:00
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