From 44ef9e48c93f58e8a1595a07f9cbb65697efa6af Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 5 Dec 2025 14:12:03 +0500 Subject: [PATCH] Update file main.yml --- roles/flibusta/tasks/main.yml | 61 ++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/roles/flibusta/tasks/main.yml b/roles/flibusta/tasks/main.yml index d2d6f14..7184d21 100644 --- a/roles/flibusta/tasks/main.yml +++ b/roles/flibusta/tasks/main.yml @@ -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: |