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