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.
 
 

56 lines
3.1 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_appservice_irc_appservice_token"
  9. - "matrix_appservice_irc_homeserver_token"
  10. # Our base configuration (`matrix_appservice_irc_configuration_yaml`) is not enough to
  11. # let the playbook run without errors.
  12. #
  13. # Unless the final configuration (`matrix_appservice_irc_configuration`) contains an `ircService` definition,
  14. # we'd fail generating the registration.yaml file with a non-helpful error.
  15. #
  16. # This is a safety check to ensure we fail earlier and in a nicer way.
  17. - name: Fail if no additional configuration provided
  18. fail:
  19. msg: >-
  20. Your Appservice IRC configuration is incomplete (lacking an `ircService.servers` configuration).
  21. You need to define one or more servers by either using `matrix_appservice_irc_ircService_servers`
  22. or by extending the base configuration with additional configuration in `matrix_appservice_irc_configuration_extension_yaml`.
  23. Overriding the whole bridge's configuration (`matrix_appservice_irc_configuration`) is yet another possibility.
  24. when: "matrix_appservice_irc_configuration.ircService.servers|length == 0"
  25. - name: (Deprecation) Catch and report renamed appservice-irc variables
  26. fail:
  27. msg: >-
  28. Your configuration contains a variable, which now has a different name.
  29. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
  30. when: "item.old in vars"
  31. with_items:
  32. - {'old': 'matrix_appservice_irc_container_expose_client_server_api_port', 'new': '<superseded by matrix_appservice_irc_container_http_host_bind_port>'}
  33. - block:
  34. - name: Check if a neDB database already exists
  35. stat:
  36. path: "{{ matrix_appservice_irc_data_path }}/"
  37. register: matrix_appservice_irc_nedb_stat_result
  38. - name: Fail if an neDB database already exists when using Postgres
  39. fail:
  40. msg: >-2
  41. matrix_appservice_irc_database_engine has been set to `postgres` (which is our new default now).
  42. However, we've discovered an existing neDB database in {{ matrix_appservice_irc_data_path }}/.
  43. It appears that you've been using this bridge with the neDB engine until now.
  44. To continue using neDB, opt into it explicitly: add `matrix_appservice_irc_database_engine: nedb` to your vars.yml file and re-run this same command.
  45. Alternatively, to migrate your existing neDB database to Postgres:
  46. 1. Stop all services (`ansible-playbook -i inventory/hosts setup.yml --tags=stop`)
  47. 2. Import the neDB database into Postgres (`ansible-playbook -v -i inventory/hosts setup.yml --tags=import-irc-nedb --extra-vars='nedb_database_path={{ matrix_appservice_irc_data_path }} postgres_connection_string_variable_name=matrix_appservice_irc_database_connString'`)
  48. 3. Re-run the playbook (`ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start`)
  49. when: "matrix_appservice_irc_nedb_stat_result.stat.exists"
  50. when: "matrix_appservice_irc_database_engine == 'postgres'"