diff --git a/roles/glpi/tasks/cleanup.yml b/roles/glpi/tasks/cleanup.yml index bfa9821..4b7870a 100644 --- a/roles/glpi/tasks/cleanup.yml +++ b/roles/glpi/tasks/cleanup.yml @@ -13,7 +13,6 @@ with_items: - "{{ glpi_root_dir }}/tmp/glpi" - "{{ glpi_root_dir }}/tmp/glpi-{{ glpi_version }}.tgz" - - "{{ glpi_root_dir }}/tmp/glpi.sql" - "{{ glpi_root_dir }}/db_dumps" - /etc/backup/pre.d/glpi_{{ glpi_id }}_dump_db - /etc/backup/post.d/glpi_{{ glpi_id }}_rm_dump diff --git a/roles/glpi/tasks/conf.yml b/roles/glpi/tasks/conf.yml index e50875e..f0741a5 100644 --- a/roles/glpi/tasks/conf.yml +++ b/roles/glpi/tasks/conf.yml @@ -20,6 +20,11 @@ - config_path.php tags: glpi +- name: Init database + command: "/bin/php{{ glpi_php_version }} {{ glpi_root_dir }}/web/bin/console -n -r db:install" + when: glpi_install_mode == 'install' + tags: glpi + - name: Upgrade database command: "/bin/php{{ glpi_php_version }} {{ glpi_root_dir }}/web/bin/console -n db:update" when: glpi_install_mode == 'upgrade' diff --git a/roles/glpi/tasks/install.yml b/roles/glpi/tasks/install.yml index 7c8f464..480b490 100644 --- a/roles/glpi/tasks/install.yml +++ b/roles/glpi/tasks/install.yml @@ -110,24 +110,6 @@ - set_fact: glpi_db_created={{ db_created }} tags: glpi -- name: Create a safer MySQL schema file - shell: grep -v 'DROP TABLE' {{ glpi_root_dir }}/web/install/mysql/glpi-empty.sql > {{ glpi_root_dir }}/tmp/glpi.sql - when: glpi_install_mode == 'install' - tags: glpi - -- name: Inject MySQL schema - mysql_db: - name: "{{ glpi_mysql_db }}" - state: import - target: "{{ glpi_root_dir }}/tmp/glpi.sql" - login_host: "{{ glpi_mysql_server }}" - login_user: sqladmin - login_password: "{{ mysql_admin_pass }}" - when: - - glpi_install_mode == 'install' - - glpi_db_created.changed - tags: glpi - - name: Deploy cron task cron: name: glpi_{{ glpi_id }}