GoMatrixHosting v0.6.6pull/1419/head
| @@ -1,11 +0,0 @@ | |||||
| --- | |||||
| - name: Collect entire room list into stdout | |||||
| shell: | | |||||
| curl -X GET --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" '{{ synapse_container_ip.stdout }}:{{ matrix_synapse_container_client_api_port }}/_synapse/admin/v1/rooms?from={{ item }}' | |||||
| register: awx_rooms_output | |||||
| - name: Print stdout to file | |||||
| delegate_to: 127.0.0.1 | |||||
| shell: | | |||||
| echo '{{ awx_rooms_output.stdout }}' >> /tmp/{{ subscription_id }}_room_list_complete.json | |||||
| @@ -29,9 +29,9 @@ | |||||
| when: (awx_purge_mode.find("No local users [recommended]") != -1) or (awx_purge_mode.find("Number of users [slower]") != -1) or (awx_purge_mode.find("Number of events [slower]") != -1) | when: (awx_purge_mode.find("No local users [recommended]") != -1) or (awx_purge_mode.find("Number of users [slower]") != -1) or (awx_purge_mode.find("Number of events [slower]") != -1) | ||||
| register: awx_synapse_container_ip | register: awx_synapse_container_ip | ||||
| - name: Collect access token for janitor user | |||||
| - name: Collect access token for @_janitor user | |||||
| shell: | | shell: | | ||||
| curl -X POST -d '{"type":"m.login.password", "user":"janitor", "password":"{{ awx_janitor_user_password }}"}' "{{ awx_synapse_container_ip.stdout }}:{{ matrix_synapse_container_client_api_port }}/_matrix/client/r0/login" | jq '.access_token' | |||||
| curl -X POST -d '{"type":"m.login.password", "user":"_janitor", "password":"{{ awx_janitor_user_password }}"}' "{{ awx_synapse_container_ip.stdout }}:{{ matrix_synapse_container_client_api_port }}/_matrix/client/r0/login" | jq '.access_token' | |||||
| when: (awx_purge_mode.find("No local users [recommended]") != -1) or (awx_purge_mode.find("Number of users [slower]") != -1) or (awx_purge_mode.find("Number of events [slower]") != -1) | when: (awx_purge_mode.find("No local users [recommended]") != -1) or (awx_purge_mode.find("Number of users [slower]") != -1) or (awx_purge_mode.find("Number of events [slower]") != -1) | ||||
| register: awx_janitors_token | register: awx_janitors_token | ||||
| no_log: True | no_log: True | ||||
| @@ -21,21 +21,22 @@ | |||||
| shell: "/usr/bin/docker inspect --format '{''{range.NetworkSettings.Networks}''}{''{.IPAddress}''}{''{end}''}' matrix-synapse" | shell: "/usr/bin/docker inspect --format '{''{range.NetworkSettings.Networks}''}{''{.IPAddress}''}{''{end}''}' matrix-synapse" | ||||
| register: awx_synapse_container_ip | register: awx_synapse_container_ip | ||||
| - name: Collect access token for janitor user | |||||
| - name: Collect access token for @_janitor user | |||||
| shell: | | shell: | | ||||
| curl -XPOST -d '{"type":"m.login.password", "user":"janitor", "password":"{{ awx_janitor_user_password }}"}' "{{ awx_synapse_container_ip.stdout }}:{{ matrix_synapse_container_client_api_port }}/_matrix/client/r0/login" | jq '.access_token' | |||||
| curl -XPOST -d '{"type":"m.login.password", "user":"_janitor", "password":"{{ awx_janitor_user_password }}"}' "{{ awx_synapse_container_ip.stdout }}:{{ matrix_synapse_container_client_api_port }}/_matrix/client/r0/login" | jq '.access_token' | |||||
| register: awx_janitors_token | register: awx_janitors_token | ||||
| no_log: True | no_log: True | ||||
| - name: Generate list of dates to purge to | - name: Generate list of dates to purge to | ||||
| delegate_to: 127.0.0.1 | delegate_to: 127.0.0.1 | ||||
| shell: "dateseq {{ matrix_purge_from_date }} {{ matrix_purge_to_date }}" | |||||
| shell: "dateseq {{ awx_purge_from_date }} {{ awx_purge_to_date }}" | |||||
| register: awx_purge_dates | register: awx_purge_dates | ||||
| - name: Calculate initial size of local media repository | - name: Calculate initial size of local media repository | ||||
| shell: du -sh /matrix/synapse/storage/media-store/local* | shell: du -sh /matrix/synapse/storage/media-store/local* | ||||
| register: awx_local_media_size_before | register: awx_local_media_size_before | ||||
| when: awx_purge_media_type == "Local Media" | when: awx_purge_media_type == "Local Media" | ||||
| async: 600 | |||||
| ignore_errors: yes | ignore_errors: yes | ||||
| no_log: True | no_log: True | ||||
| @@ -43,6 +44,7 @@ | |||||
| shell: du -sh /matrix/synapse/storage/media-store/remote* | shell: du -sh /matrix/synapse/storage/media-store/remote* | ||||
| register: awx_remote_media_size_before | register: awx_remote_media_size_before | ||||
| when: awx_purge_media_type == "Remote Media" | when: awx_purge_media_type == "Remote Media" | ||||
| async: 600 | |||||
| ignore_errors: yes | ignore_errors: yes | ||||
| no_log: True | no_log: True | ||||
| @@ -12,9 +12,9 @@ | |||||
| - curl | - curl | ||||
| state: present | state: present | ||||
| - name: Collect access token of Dimension user | |||||
| - name: Collect access token of @_dimension user | |||||
| shell: | | shell: | | ||||
| curl -X POST --header 'Content-Type: application/json' -d '{ "identifier": { "type": "m.id.user","user": "dimension" }, "password": "{{ awx_dimension_user_password }}", "type": "m.login.password"}' 'https://matrix.{{ matrix_domain }}/_matrix/client/r0/login' | jq -c '. | {access_token}' | sed 's/.*\":\"//' | sed 's/\"}//' | |||||
| curl -X POST --header 'Content-Type: application/json' -d '{ "identifier": { "type": "m.id.user","user": "_dimension" }, "password": "{{ awx_dimension_user_password }}", "type": "m.login.password"}' 'https://matrix.{{ matrix_domain }}/_matrix/client/r0/login' | jq -c '. | {access_token}' | sed 's/.*\":\"//' | sed 's/\"}//' | |||||
| register: awx_dimension_user_access_token | register: awx_dimension_user_access_token | ||||
| - name: Record Synapse variables locally on AWX | - name: Record Synapse variables locally on AWX | ||||
| @@ -1,8 +1,8 @@ | |||||
| --- | --- | ||||
| - name: Create user account @janitor | |||||
| - name: Create user account @_janitor | |||||
| command: | | command: | | ||||
| /usr/local/bin/matrix-synapse-register-user janitor {{ awx_janitor_user_password | quote }} 1 | |||||
| /usr/local/bin/matrix-synapse-register-user _janitor {{ awx_janitor_user_password | quote }} 1 | |||||
| register: cmd | register: cmd | ||||
| when: not awx_janitor_user_created|bool | when: not awx_janitor_user_created|bool | ||||
| no_log: True | no_log: True | ||||
| @@ -18,9 +18,9 @@ | |||||
| 'awx_janitor_user_created': 'true' | 'awx_janitor_user_created': 'true' | ||||
| when: not awx_janitor_user_created|bool | when: not awx_janitor_user_created|bool | ||||
| - name: Create user account @dimension | |||||
| - name: Create user account @_dimension | |||||
| command: | | command: | | ||||
| /usr/local/bin/matrix-synapse-register-user dimension {{ awx_dimension_user_password | quote }} 0 | |||||
| /usr/local/bin/matrix-synapse-register-user _dimension {{ awx_dimension_user_password | quote }} 0 | |||||
| register: cmd | register: cmd | ||||
| when: not awx_dimension_user_created|bool | when: not awx_dimension_user_created|bool | ||||
| no_log: True | no_log: True | ||||
| @@ -36,9 +36,9 @@ | |||||
| 'awx_dimension_user_created': 'true' | 'awx_dimension_user_created': 'true' | ||||
| when: not awx_dimension_user_created|bool | when: not awx_dimension_user_created|bool | ||||
| - name: Create user account @mjolnir | |||||
| - name: Create user account @_mjolnir | |||||
| command: | | command: | | ||||
| /usr/local/bin/matrix-synapse-register-user mjolnir {{ awx_mjolnir_user_password | quote }} 0 | |||||
| /usr/local/bin/matrix-synapse-register-user _mjolnir {{ awx_mjolnir_user_password | quote }} 0 | |||||
| register: cmd | register: cmd | ||||
| when: not awx_mjolnir_user_created|bool | when: not awx_mjolnir_user_created|bool | ||||
| no_log: True | no_log: True | ||||