Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

95 řádky
3.0 KiB

  1. - name: Ensure dateutils and curl is installed in AWX
  2. delegate_to: 127.0.0.1
  3. yum:
  4. name: dateutils
  5. state: latest
  6. - name: Include vars in matrix_vars.yml
  7. include_vars:
  8. file: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/matrix_vars.yml'
  9. no_log: True
  10. - name: Ensure curl and jq intalled on target machine
  11. apt:
  12. pkg:
  13. - curl
  14. - jq
  15. state: present
  16. - name: Collect access token for janitor user
  17. shell: |
  18. curl -XPOST -d '{"type":"m.login.password", "user":"janitor", "password":"{{ matrix_awx_janitor_user_password }}"}' "https://matrix.{{ matrix_domain }}/_matrix/client/r0/login" | jq '.access_token'
  19. register: janitors_token
  20. - name: Generate list of dates to purge to
  21. delegate_to: 127.0.0.1
  22. shell: "dateseq {{ matrix_purge_from_date }} {{ matrix_purge_to_date }}"
  23. register: purge_dates
  24. - name: Calculate initial size of local media repository
  25. shell: du -sh /matrix/synapse/storage/media-store/local*
  26. register: local_media_size_before
  27. when: matrix_purge_media_type == "Local Media"
  28. ignore_errors: yes
  29. no_log: True
  30. - name: Calculate initial size of remote media repository
  31. shell: du -sh /matrix/synapse/storage/media-store/remote*
  32. register: remote_media_size_before
  33. when: matrix_purge_media_type == "Remote Media"
  34. ignore_errors: yes
  35. no_log: True
  36. - name: Purge local media with loop
  37. include_tasks: purge_media_local.yml
  38. loop: "{{ purge_dates.stdout_lines | flatten(levels=1) }}"
  39. when: matrix_purge_media_type == "Local Media"
  40. - name: Purge remote media with loop
  41. include_tasks: purge_media_remote.yml
  42. loop: "{{ purge_dates.stdout_lines | flatten(levels=1) }}"
  43. when: matrix_purge_media_type == "Remote Media"
  44. - name: Calculate final size of local media repository
  45. shell: du -sh /matrix/synapse/storage/media-store/local*
  46. register: local_media_size_after
  47. when: matrix_purge_media_type == "Local Media"
  48. ignore_errors: yes
  49. no_log: True
  50. - name: Calculate final size of remote media repository
  51. shell: du -sh /matrix/synapse/storage/media-store/remote*
  52. register: remote_media_size_after
  53. when: matrix_purge_media_type == "Remote Media"
  54. ignore_errors: yes
  55. no_log: True
  56. - name: Print size of local media repository before purge
  57. debug:
  58. msg: "{{ local_media_size_before.stdout.split('\n') }}"
  59. when: matrix_purge_media_type == "Local Media"
  60. - name: Print size of local media repository after purge
  61. debug:
  62. msg: "{{ local_media_size_after.stdout.split('\n') }}"
  63. when: matrix_purge_media_type == "Local Media"
  64. - name: Print size of remote media repository before purge
  65. debug:
  66. msg: "{{ remote_media_size_before.stdout.split('\n') }}"
  67. when: matrix_purge_media_type == "Remote Media"
  68. - name: Print size of remote media repository after purge
  69. debug:
  70. msg: "{{ remote_media_size_after.stdout.split('\n') }}"
  71. when: matrix_purge_media_type == "Remote Media"
  72. - name: Set boolean value to exit playbook
  73. set_fact:
  74. end_playbook: true
  75. - name: End playbook early if this task is called.
  76. meta: end_play
  77. when: end_playbook is defined and end_playbook|bool