diff --git a/roles/deploy/tasks/deploy.yml b/roles/deploy/tasks/deploy.yml index 6d3c0b468..c1968d6c7 100644 --- a/roles/deploy/tasks/deploy.yml +++ b/roles/deploy/tasks/deploy.yml @@ -115,8 +115,13 @@ tags: rake - name: prepare database for the first time - include_tasks: prepare_database.yml + command: bash -lc "bundle exec rails db:setup RAILS_ENV={{ rails_env }} I_AM_SURE=1" + args: + chdir: "{{ build_path }}" when: table_exists.stdout.find('0 rows') != -1 + tags: + - rake + - skip_ansible_lint - name: clear transient data command: bash -lc "bundle exec rake ofn:data:remove_transient_data RAILS_ENV={{ rails_env }}" diff --git a/roles/deploy/tasks/prepare_database.yml b/roles/deploy/tasks/prepare_database.yml deleted file mode 100644 index 0e7144943..000000000 --- a/roles/deploy/tasks/prepare_database.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# Ensure the database is created, migrated and seeded (first deployment only) - -- name: load database schema - command: bash -lc "bundle exec rake db:schema:load RAILS_ENV={{ rails_env }} I_AM_SURE=1" - args: - chdir: "{{ build_path }}" - tags: - - rake - - skip_ansible_lint - -- name: migrate database - command: bash -lc "bundle exec rake db:migrate RAILS_ENV={{ rails_env }}" - args: - chdir: "{{ build_path }}" - tags: - - rake - - skip_ansible_lint - notify: restart puma - -- name: seed database - command: bash -lc "bundle exec rake db:seed RAILS_ENV={{ rails_env }}" - args: - chdir: "{{ build_path }}" - tags: - - seed - - skip_ansible_lint - notify: restart puma