Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
1.8 KiB

  1. ---
  2. - name: Fail if required settings not defined
  3. fail:
  4. msg: >-
  5. You need to define a required configuration setting (`{{ item }}`).
  6. when: "vars[item] == ''"
  7. with_items:
  8. - "matrix_mx_puppet_twitter_appservice_token"
  9. - "matrix_mx_puppet_twitter_homeserver_token"
  10. - block:
  11. - name: Check if an SQLite database already exists
  12. stat:
  13. path: "{{ matrix_mx_puppet_twitter_sqlite_data_path }}/database.db"
  14. register: matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result
  15. - name: Fail if an SQLite database already exists when using Postgres
  16. fail:
  17. msg: >-
  18. matrix_mx_puppet_twitter_database_engine has been set to `postgres` (which is our new default now).
  19. However, we've discovered an existing SQLite database in {{ matrix_mx_puppet_twitter_data_path }}/database.db.
  20. It appears that you've been using this bridge with the SQLite engine until now.
  21. To continue using SQLite, opt into it explicitly: add `matrix_mx_puppet_twitter_database_engine: sqlite` to your vars.yml file and re-run this same command.
  22. Alternatively, to migrate your existing SQLite database to Postgres:
  23. 1. Stop all services (`ansible-playbook -i inventory/hosts setup.yml --tags=stop`)
  24. 2. Import the SQLite database into Postgres (`ansible-playbook -v -i inventory/hosts setup.yml --tags=import-generic-sqlite-db --extra-vars='sqlite_database_path={{ matrix_mx_puppet_twitter_data_path }}/database.db postgres_connection_string_variable_name=matrix_mx_puppet_twitter_database_connString'`)
  25. 3. Re-run the playbook (`ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start`)
  26. when: "matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result.stat.exists"
  27. when: "matrix_mx_puppet_twitter_database_engine == 'postgres'"