Update file main.yml

This commit is contained in:
Administrator 2025-12-05 14:12:03 +05:00
parent 89f6833efe
commit 44ef9e48c9

View File

@ -23,6 +23,7 @@
- "Flibusta.Net"
- "FlibustaSQL"
- "blob"
- "application/tools"
- name: Copy SQL files from source directory
copy:
@ -54,22 +55,44 @@
loop:
- "cache"
- "FlibustaSQL"
- "blob"
- name: Set execute permissions for scripts
file:
path: "{{ flibusta_base_dir }}/{{ item }}"
mode: 0755
loop:
- "getcovers.sh"
- "getsql.sh"
- "update_daily.sh"
when: lookup('file', flibusta_base_dir + '/' + item, errors='ignore') != ''
- name: Set execute permissions for scripts (if exist)
block:
- name: Check which scripts exist
find:
paths: "{{ flibusta_base_dir }}"
patterns: "*.sh"
file_type: file
register: found_scripts
- name: Check and set execute permissions for import.php
file:
path: "{{ flibusta_base_dir }}/application/tools/import.php"
mode: 0755
when: lookup('file', flibusta_base_dir + '/application/tools/import.php', errors='ignore') != ''
- name: Set permissions for found scripts
file:
path: "{{ item.path }}"
mode: 0755
loop: "{{ found_scripts.files }}"
loop_control:
label: "{{ item.path | basename }}"
when: flibusta_base_dir is defined
- name: Set execute permissions for PHP tools (if exist)
block:
- name: Find PHP tools
find:
paths: "{{ flibusta_base_dir }}/application/tools"
patterns: "*.php"
file_type: file
register: php_tools
ignore_errors: yes
- name: Set permissions for PHP tools
file:
path: "{{ item.path }}"
mode: 0755
loop: "{{ php_tools.files | default([]) }}"
loop_control:
label: "{{ item.path | basename }}"
when: flibusta_base_dir is defined
- name: Deploy Flibusta docker-compose.yml
template:
@ -96,15 +119,17 @@
pause:
seconds: 30
- name: Check if database needs initialization
- name: Check if database is accessible
shell: |
docker exec flibusta_postgres psql -U {{ flibusta_db_user }} -d {{ flibusta_db_name }} -c "SELECT COUNT(*) FROM pg_tables WHERE schemaname = 'public';"
register: db_tables
timeout 30 sh -c 'until docker exec flibusta_postgres pg_isready -U {{ flibusta_db_user }}; do sleep 2; done'
args:
executable: /bin/bash
register: db_ready
ignore_errors: yes
- name: Display database status
debug:
msg: "Database tables count: {{ db_tables.stdout | default('Database not ready') }}"
msg: "Database is {{ 'ready' if db_ready.rc == 0 else 'not ready yet' }}"
- name: Check Flibusta services status
shell: |