Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

35 wiersze
1.5 KiB

  1. ---
  2. # TODO - ensure `additional_db` contains all keys that we expect
  3. # The SQL statements that we'll run against Postgres are stored in a file that others can't read.
  4. # This file will be mounted into the container and fed to Postgres.
  5. # This way, we avoid passing sensitive data around in CLI commands that other users on the system can see.
  6. - name: Create additional database initialization SQL file for {{ additional_db.name }}
  7. template:
  8. src: "{{ role_path }}/templates/init-additional-db-user-and-role.sql.j2"
  9. dest: "/tmp/matrix-postgres-init-additional-db-user-and-role.sql"
  10. mode: 0600
  11. owner: "{{ matrix_user_uid }}"
  12. group: "{{ matrix_user_gid }}"
  13. - name: Execute Postgres additional database initialization SQL file for {{ additional_db.name }}
  14. command:
  15. cmd: >-
  16. {{ matrix_host_command_docker }} run
  17. --rm
  18. --user={{ matrix_user_uid }}:{{ matrix_user_gid }}
  19. --cap-drop=ALL
  20. --env-file={{ matrix_postgres_base_path }}/env-postgres-psql
  21. --network {{ matrix_docker_network }}
  22. --mount type=bind,src=/tmp/matrix-postgres-init-additional-db-user-and-role.sql,dst=/matrix-postgres-init-additional-db-user-and-role.sql,ro
  23. --entrypoint=/bin/sh
  24. {{ matrix_postgres_docker_image_to_use }}
  25. -c
  26. 'psql -h {{ matrix_postgres_connection_hostname }} --file=/matrix-postgres-init-additional-db-user-and-role.sql'
  27. - name: Delete additional database initialization SQL file for {{ additional_db.name }}
  28. file:
  29. path: /tmp/matrix-postgres-init-additional-db-user-and-role.sql
  30. state: absent