frigate/uninstall.yaml

67 lines
2.3 KiB
YAML
Raw Normal View History

2023-05-11 19:03:34 -04:00
- name: Stop Frigate
ansible.builtin.import_playbook: stop.yaml
- name: Uninstall Frigate
hosts: Barad-dur
tasks:
- name: Remove Nginx config file for Frigate
become: true
ansible.builtin.file:
path: /data/nginx-config/frigate.conf
state: absent
- name: Remove Frigate config Docker volume
community.docker.docker_volume:
volume_name: frigate-config
state: absent
- name: Remove Frigate config Docker volume directory
become: true
ansible.builtin.file:
path: /data/frigate-config
state: absent
- name: Remove Frigate media Docker volume
community.docker.docker_volume:
volume_name: frigate-media
state: absent
- name: Remove Frigate media Docker volume directory
become: true
ansible.builtin.file:
path: /mnt/nvr_storage/frigate
state: absent
- 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: Delete from Postgres table service_data
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: 'DELETE FROM service_data WHERE service = %s;'
positional_args:
- frigate
- name: Delete from Postgres table service_port
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: 'DELETE FROM service_port WHERE service = %s;'
positional_args:
- frigate
- name: Delete from Postgres table service
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: 'DELETE FROM service WHERE name = %s;'
positional_args:
- frigate