Merge pull request #1326 from GoMatrixHosting/gomatrixhosting-testing

GoMatrixHosting v0.6.2
This commit is contained in:
Slavi Pantaleev 2021-10-12 08:53:11 +03:00 committed by GitHub
commit 0c21b5a055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 555 additions and 367 deletions

View File

@ -8,10 +8,10 @@
"required": true, "required": true,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ sftp_auth_method | string }}", "default": "{{ awx_sftp_auth_method | string }}",
"choices": "Disabled\nPassword\nSSH Key", "choices": "Disabled\nPassword\nSSH Key",
"new_question": true, "new_question": true,
"variable": "sftp_auth_method", "variable": "awx_sftp_auth_method",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{ {
@ -20,10 +20,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 64, "max": 64,
"default": "{{ sftp_password }}", "default": "{{ awx_sftp_password }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "sftp_password", "variable": "awx_sftp_password",
"type": "password" "type": "password"
}, },
{ {
@ -32,10 +32,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 16384, "max": 16384,
"default": "{{ sftp_public_key }}", "default": "{{ awx_sftp_public_key }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "sftp_public_key", "variable": "awx_sftp_public_key",
"type": "text" "type": "text"
} }
] ]

View File

@ -8,10 +8,10 @@
"required": false, "required": false,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ matrix_awx_backup_enabled | string | lower }}", "default": "{{ awx_backup_enabled | string | lower }}",
"choices": "true\nfalse", "choices": "true\nfalse",
"new_question": true, "new_question": true,
"variable": "matrix_awx_backup_enabled", "variable": "awx_backup_enabled",
"type": "multiplechoice" "type": "multiplechoice"
} }
] ]

View File

@ -20,10 +20,10 @@
"required": true, "required": true,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ matrix_corporal_policy_provider_mode }}", "default": "{{ awx_corporal_policy_provider_mode }}",
"choices": "Simple Static File\nHTTP Pull Mode (API Enabled)\nHTTP Push Mode (API Enabled)", "choices": "Simple Static File\nHTTP Pull Mode (API Enabled)\nHTTP Push Mode (API Enabled)",
"new_question": true, "new_question": true,
"variable": "matrix_corporal_policy_provider_mode", "variable": "awx_corporal_policy_provider_mode",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{ {
@ -34,7 +34,7 @@
"max": 65536, "max": 65536,
"default": "", "default": "",
"new_question": true, "new_question": true,
"variable": "matrix_corporal_simple_static_config", "variable": "awx_corporal_simple_static_config",
"type": "textarea" "type": "textarea"
}, },
{ {
@ -43,9 +43,9 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 4096, "max": 4096,
"default": "{{ matrix_corporal_pull_mode_uri }}", "default": "{{ awx_corporal_pull_mode_uri }}",
"new_question": true, "new_question": true,
"variable": "matrix_corporal_pull_mode_uri", "variable": "awx_corporal_pull_mode_uri",
"type": "text" "type": "text"
}, },
{ {
@ -54,10 +54,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 256, "max": 256,
"default": "{{ matrix_corporal_pull_mode_token }}", "default": "{{ awx_corporal_pull_mode_token }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "matrix_corporal_pull_mode_token", "variable": "awx_corporal_pull_mode_token",
"type": "password" "type": "password"
}, },
{ {
@ -66,10 +66,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 256, "max": 256,
"default": "{{ matrix_corporal_http_api_auth_token }}", "default": "{{ awx_corporal_http_api_auth_token }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "matrix_corporal_http_api_auth_token", "variable": "awx_corporal_http_api_auth_token",
"type": "password" "type": "password"
}, },
{ {
@ -78,7 +78,7 @@
"required": false, "required": false,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ matrix_corporal_raise_ratelimits }}", "default": "{{ awx_corporal_raise_ratelimits }}",
"choices": "Normal\nRaised", "choices": "Normal\nRaised",
"new_question": true, "new_question": true,
"variable": "matrix_corporal_raise_ratelimits", "variable": "matrix_corporal_raise_ratelimits",

View File

@ -20,10 +20,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 65536, "max": 65536,
"default": {{ ext_dimension_users_raw_final | to_json }}, "default": {{ awx_dimension_users_final | to_json }},
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "ext_dimension_users_raw", "variable": "awx_dimension_users",
"type": "textarea" "type": "textarea"
} }
] ]

View File

@ -14,18 +14,6 @@
"variable": "matrix_client_element_enabled", "variable": "matrix_client_element_enabled",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{
"question_name": "Set Branding for Web Client",
"question_description": "Sets the 'branding' seen in the tab and on the welcome page to a custom value.",
"required": false,
"min": 0,
"max": 256,
"default": "{{ matrix_client_element_brand }}",
"choices": "",
"new_question": true,
"variable": "matrix_client_element_brand",
"type": "text"
},
{ {
"question_name": "Set Theme for Web Client", "question_name": "Set Theme for Web Client",
"question_description": "Sets the default theme for the web client, can be changed later by individual users.", "question_description": "Sets the default theme for the web client, can be changed later by individual users.",
@ -38,18 +26,78 @@
"variable": "matrix_client_element_default_theme", "variable": "matrix_client_element_default_theme",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{
"question_name": "Set Branding for Web Client",
"question_description": "Sets the 'branding' seen in the tab and on the welcome page to a custom value.Leaving this field blank will cause the default branding will be used: 'Element'",
"required": false,
"min": 0,
"max": 256,
"default": "{{ matrix_client_element_brand | trim }}",
"choices": "",
"new_question": true,
"variable": "matrix_client_element_brand",
"type": "text"
},
{ {
"question_name": "Set Welcome Page Background", "question_name": "Set Welcome Page Background",
"question_description": "URL to Wallpaper, shown in background of the welcome page. Must be a 'https' link, otherwise it won't be set.", "question_description": "Sets the background image on the welcome page, you should enter a URL to the image you want to use. Must be a 'https' link, otherwise it won't be set. Leaving this field blank will cause the default background to be used.",
"required": false, "required": false,
"min": 0, "min": 0,
"max": 1024, "max": 1024,
"default": "{{ matrix_client_element_branding_welcomeBackgroundUrl }}", "default": "{{ matrix_client_element_branding_welcomeBackgroundUrl | trim }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "matrix_client_element_branding_welcomeBackgroundUrl", "variable": "matrix_client_element_branding_welcomeBackgroundUrl",
"type": "text" "type": "text"
}, },
{
"question_name": "Set Welcome Page Logo",
"question_description": "Sets the logo found on the welcome and login page, must be a valid https link to your logo, the logo itself should be a square vector image (SVG). Leaving this field blank will cause the default Element logo to be used.",
"required": false,
"min": 0,
"max": 1024,
"default": "{{ matrix_client_element_welcome_logo | trim }}",
"choices": "",
"new_question": true,
"variable": "matrix_client_element_welcome_logo",
"type": "text"
},
{
"question_name": "Set Welcome Page Logo URL",
"question_description": "Sets the URL link the welcome page logo leads to, must be a valid https link. Leaving this field blank will cause this default link to be used: 'https://element.io'",
"required": false,
"min": 0,
"max": 1024,
"default": "{{ matrix_client_element_welcome_logo_link | trim }}",
"choices": "",
"new_question": true,
"variable": "matrix_client_element_welcome_logo_link",
"type": "text"
},
{
"question_name": "Set Welcome Page Headline",
"question_description": "Sets the headline seen on the welcome page. Leaving this field blank will cause this default headline to be used: 'Welcome to Element!'",
"required": false,
"min": 0,
"max": 512,
"default": "{{ awx_matrix_client_element_welcome_headline | trim }}",
"choices": "",
"new_question": true,
"variable": "awx_matrix_client_element_welcome_headline",
"type": "text"
},
{
"question_name": "Set Welcome Page Text",
"question_description": "Sets the text seen on the welcome page. Leaving this field blank will cause this default headline to be used: 'Decentralised, encrypted chat & collaboration powered by [Matrix]'",
"required": false,
"min": 0,
"max": 2048,
"default": "{{ awx_matrix_client_element_welcome_text | trim }}",
"choices": "",
"new_question": true,
"variable": "awx_matrix_client_element_welcome_text",
"type": "text"
},
{ {
"question_name": "Show Registration Button", "question_name": "Show Registration Button",
"question_description": "If you show the registration button on the welcome page.", "question_description": "If you show the registration button on the welcome page.",

View File

@ -8,10 +8,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 2048, "max": 2048,
"default": "{{ element_subdomain }}", "default": "{{ awx_element_subdomain }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "element_subdomain", "variable": "awx_element_subdomain",
"type": "text" "type": "text"
} }
] ]

View File

@ -20,10 +20,10 @@
"required": false, "required": false,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ ext_matrix_ma1sd_auth_store }}", "default": "{{ awx_matrix_ma1sd_auth_store }}",
"choices": "Synapse Internal\nLDAP/AD", "choices": "Synapse Internal\nLDAP/AD",
"new_question": true, "new_question": true,
"variable": "ext_matrix_ma1sd_auth_store", "variable": "awx_matrix_ma1sd_auth_store",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{ {
@ -32,9 +32,9 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 65536, "max": 65536,
"default": {{ ext_matrix_ma1sd_configuration_extension_yaml | to_json }}, "default": {{ awx_matrix_ma1sd_configuration_extension_yaml | to_json }},
"new_question": true, "new_question": true,
"variable": "ext_matrix_ma1sd_configuration_extension_yaml", "variable": "awx_matrix_ma1sd_configuration_extension_yaml",
"type": "textarea" "type": "textarea"
} }
] ]

View File

@ -92,10 +92,10 @@
"required": false, "required": false,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ ext_registrations_require_3pid | string | lower }}", "default": "{{ awx_registrations_require_3pid | string | lower }}",
"choices": "true\nfalse", "choices": "true\nfalse",
"new_question": true, "new_question": true,
"variable": "ext_registrations_require_3pid", "variable": "awx_registrations_require_3pid",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{ {
@ -107,7 +107,7 @@
"default": "", "default": "",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "ext_matrix_synapse_registration_shared_secret", "variable": "awx_matrix_synapse_registration_shared_secret",
"type": "password" "type": "password"
}, },
{ {
@ -119,7 +119,7 @@
"default": "{{ matrix_synapse_max_upload_size_mb }}", "default": "{{ matrix_synapse_max_upload_size_mb }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "matrix_synapse_max_upload_size_mb_raw", "variable": "awx_synapse_max_upload_size_mb",
"type": "text" "type": "text"
}, },
{ {
@ -128,10 +128,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 65536, "max": 65536,
"default": {{ ext_url_preview_accept_language_default | to_json }}, "default": {{ awx_url_preview_accept_language_default | to_json }},
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "ext_url_preview_accept_language_raw", "variable": "awx_url_preview_accept_language",
"type": "textarea" "type": "textarea"
}, },
{ {
@ -140,10 +140,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 65536, "max": 65536,
"default": {{ ext_federation_whitelist_raw | to_json }}, "default": {{ awx_federation_whitelist | to_json }},
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "ext_federation_whitelist_raw", "variable": "awx_federation_whitelist",
"type": "textarea" "type": "textarea"
}, },
{ {
@ -152,10 +152,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 65536, "max": 65536,
"default": {{ matrix_synapse_auto_join_rooms_raw | to_json }}, "default": {{ awx_synapse_auto_join_rooms | to_json }},
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "matrix_synapse_auto_join_rooms_raw", "variable": "awx_synapse_auto_join_rooms",
"type": "textarea" "type": "textarea"
}, },
{ {
@ -164,10 +164,10 @@
"required": false, "required": false,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ ext_enable_registration_captcha | string | lower }}", "default": "{{ awx_enable_registration_captcha | string | lower }}",
"choices": "true\nfalse", "choices": "true\nfalse",
"new_question": true, "new_question": true,
"variable": "ext_enable_registration_captcha", "variable": "awx_enable_registration_captcha",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{ {
@ -176,10 +176,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 40, "max": 40,
"default": "{{ ext_recaptcha_public_key }}", "default": "{{ awx_recaptcha_public_key }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "ext_recaptcha_public_key", "variable": "awx_recaptcha_public_key",
"type": "text" "type": "text"
}, },
{ {
@ -188,10 +188,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 40, "max": 40,
"default": "{{ ext_recaptcha_private_key }}", "default": "{{ awx_recaptcha_private_key }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "ext_recaptcha_private_key", "variable": "awx_recaptcha_private_key",
"type": "text" "type": "text"
} }
] ]

View File

@ -8,10 +8,10 @@
"required": true, "required": true,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ customise_base_domain_website | string | lower }}", "default": "{{ awx_customise_base_domain_website | string | lower }}",
"choices": "true\nfalse", "choices": "true\nfalse",
"new_question": true, "new_question": true,
"variable": "customise_base_domain_website", "variable": "awx_customise_base_domain_website",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{ {
@ -20,10 +20,10 @@
"required": true, "required": true,
"min": null, "min": null,
"max": null, "max": null,
"default": "{{ sftp_auth_method | string }}", "default": "{{ awx_sftp_auth_method | string }}",
"choices": "Disabled\nPassword\nSSH Key", "choices": "Disabled\nPassword\nSSH Key",
"new_question": true, "new_question": true,
"variable": "sftp_auth_method", "variable": "awx_sftp_auth_method",
"type": "multiplechoice" "type": "multiplechoice"
}, },
{ {
@ -32,10 +32,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 64, "max": 64,
"default": "{{ sftp_password }}", "default": "{{ awx_sftp_password }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "sftp_password", "variable": "awx_sftp_password",
"type": "password" "type": "password"
}, },
{ {
@ -44,10 +44,10 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 16384, "max": 16384,
"default": "{{ sftp_public_key }}", "default": "{{ awx_sftp_public_key }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "sftp_public_key", "variable": "awx_sftp_public_key",
"type": "text" "type": "text"
} }
] ]

View File

@ -7,7 +7,7 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# AWX Settings Start' insertafter: '# AWX Settings Start'
with_dict: with_dict:
'matrix_awx_backup_enabled': '{{ matrix_awx_backup_enabled }}' 'awx_backup_enabled': '{{ awx_backup_enabled }}'
tags: use-survey tags: use-survey
- name: Save new 'Backup Server' survey.json to the AWX tower, template - name: Save new 'Backup Server' survey.json to the AWX tower, template
@ -66,7 +66,7 @@
register: _create_instances register: _create_instances
async: 3600 # Maximum runtime in seconds. async: 3600 # Maximum runtime in seconds.
poll: 0 # Fire and continue (never poll) poll: 0 # Fire and continue (never poll)
when: matrix_awx_backup_enabled|bool when: awx_backup_enabled|bool
- name: Wait for both of these jobs to finish - name: Wait for both of these jobs to finish
async_status: async_status:
@ -76,11 +76,11 @@
delay: 5 # Check every 5 seconds. delay: 5 # Check every 5 seconds.
retries: 720 # Retry for a full hour. retries: 720 # Retry for a full hour.
with_items: "{{ _create_instances.results }}" with_items: "{{ _create_instances.results }}"
when: matrix_awx_backup_enabled|bool when: awx_backup_enabled|bool
- name: Perform borg backup of postgres dump - name: Perform borg backup of postgres dump
command: borgmatic -c /root/.config/borgmatic/config_2.yaml command: borgmatic -c /root/.config/borgmatic/config_2.yaml
when: matrix_awx_backup_enabled|bool when: awx_backup_enabled|bool
- name: Delete the AWX session token for executing modules - name: Delete the AWX session token for executing modules
awx.awx.tower_token: awx.awx.tower_token:
@ -93,8 +93,8 @@
- name: Set boolean value to exit playbook - name: Set boolean value to exit playbook
set_fact: set_fact:
end_playbook: true awx_end_playbook: true
- name: End playbook if this task list is called. - name: End playbook if this task list is called.
meta: end_play meta: end_play
when: end_playbook is defined and end_playbook|bool when: awx_end_playbook is defined and awx_end_playbook|bool

View File

@ -6,22 +6,18 @@
- name: Set admin bool to zero - name: Set admin bool to zero
set_fact: set_fact:
admin_bool: 0 awx_admin_bool: 0
when: admin_access == 'false' when: awx_admin_access == 'false'
- name: Examine if server admin set - name: Examine if server admin set
set_fact: set_fact:
admin_bool: 1 awx_admin_bool: 1
when: admin_access == 'true' when: awx_admin_access == 'true'
- name: Set boolean value to exit playbook
set_fact:
end_playbook: true
- name: Create user account - name: Create user account
command: | command: |
/usr/local/bin/matrix-synapse-register-user {{ new_username | quote }} {{ new_password | quote }} {{ admin_bool }} /usr/local/bin/matrix-synapse-register-user {{ awx_new_username | quote }} {{ awx_new_password | quote }} {{ awx_admin_bool }}
register: cmd register: awx_cmd_output
- name: Delete the AWX session token for executing modules - name: Delete the AWX session token for executing modules
awx.awx.tower_token: awx.awx.tower_token:
@ -32,9 +28,13 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
- name: Set boolean value to exit playbook
set_fact:
awx_end_playbook: true
- name: Result - name: Result
debug: msg="{{ cmd.stdout }}" debug: msg="{{ awx_cmd_output.stdout }}"
- name: End playbook if this task list is called. - name: End playbook if this task list is called.
meta: end_play meta: end_play
when: end_playbook is defined and end_playbook|bool when: awx_end_playbook is defined and awx_end_playbook|bool

View File

@ -1,3 +1,4 @@
---
- name: Enable index.html creation if user doesn't wish to customise base domain - name: Enable index.html creation if user doesn't wish to customise base domain
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -8,7 +9,7 @@
insertafter: '# Base Domain Settings Start' insertafter: '# Base Domain Settings Start'
with_dict: with_dict:
'matrix_nginx_proxy_base_domain_homepage_enabled': 'true' 'matrix_nginx_proxy_base_domain_homepage_enabled': 'true'
when: (customise_base_domain_website is defined) and not customise_base_domain_website|bool when: (awx_customise_base_domain_website is defined) and not awx_customise_base_domain_website|bool
- name: Disable index.html creation to allow multi-file site if user does wish to customise base domain - name: Disable index.html creation to allow multi-file site if user does wish to customise base domain
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -19,7 +20,7 @@
insertafter: '# Base Domain Settings Start' insertafter: '# Base Domain Settings Start'
with_dict: with_dict:
'matrix_nginx_proxy_base_domain_homepage_enabled': 'false' 'matrix_nginx_proxy_base_domain_homepage_enabled': 'false'
when: (customise_base_domain_website is defined) and customise_base_domain_website|bool when: (awx_customise_base_domain_website is defined) and awx_customise_base_domain_website|bool
- name: Record custom 'Customise Website + Access Export' variables locally on AWX - name: Record custom 'Customise Website + Access Export' variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -29,9 +30,9 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Custom Settings Start' insertafter: '# Custom Settings Start'
with_dict: with_dict:
'sftp_auth_method': '"{{ sftp_auth_method }}"' 'awx_sftp_auth_method': '"{{ awx_sftp_auth_method }}"'
'sftp_password': '"{{ sftp_password }}"' 'awx_sftp_password': '"{{ awx_sftp_password }}"'
'sftp_public_key': '"{{ sftp_public_key }}"' 'awx_sftp_public_key': '"{{ awx_sftp_public_key }}"'
- name: Record custom 'Customise Website + Access Export' variables locally on AWX - name: Record custom 'Customise Website + Access Export' variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -41,8 +42,8 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Custom Settings Start' insertafter: '# Custom Settings Start'
with_dict: with_dict:
'customise_base_domain_website': '{{ customise_base_domain_website }}' 'awx_customise_base_domain_website': '{{ awx_customise_base_domain_website }}'
when: customise_base_domain_website is defined when: awx_customise_base_domain_website is defined
- name: Reload vars in matrix_vars.yml - name: Reload vars in matrix_vars.yml
include_vars: include_vars:
@ -54,28 +55,28 @@
template: template:
src: './roles/matrix-awx/surveys/configure_website_access_export.json.j2' src: './roles/matrix-awx/surveys/configure_website_access_export.json.j2'
dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_website_access_export.json' dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_website_access_export.json'
when: customise_base_domain_website is defined when: awx_customise_base_domain_website is defined
- name: Copy new 'Customise Website + Access Export' survey.json to target machine - name: Copy new 'Customise Website + Access Export' survey.json to target machine
copy: copy:
src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_website_access_export.json' src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_website_access_export.json'
dest: '/matrix/awx/configure_website_access_export.json' dest: '/matrix/awx/configure_website_access_export.json'
mode: '0660' mode: '0660'
when: customise_base_domain_website is defined when: awx_customise_base_domain_website is defined
- name: Save new 'Customise Website + Access Export' survey.json to the AWX tower, template - name: Save new 'Customise Website + Access Export' survey.json to the AWX tower, template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
template: template:
src: './roles/matrix-awx/surveys/access_export.json.j2' src: './roles/matrix-awx/surveys/access_export.json.j2'
dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/access_export.json' dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/access_export.json'
when: customise_base_domain_website is undefined when: awx_customise_base_domain_website is undefined
- name: Copy new 'Customise Website + Access Export' survey.json to target machine - name: Copy new 'Customise Website + Access Export' survey.json to target machine
copy: copy:
src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/access_export.json' src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/access_export.json'
dest: '/matrix/awx/access_export.json' dest: '/matrix/awx/access_export.json'
mode: '0660' mode: '0660'
when: customise_base_domain_website is undefined when: awx_customise_base_domain_website is undefined
- name: Recreate 'Configure Website + Access Export' job template - name: Recreate 'Configure Website + Access Export' job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -97,7 +98,7 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: customise_base_domain_website is defined when: awx_customise_base_domain_website is defined
- name: Recreate 'Access Export' job template - name: Recreate 'Access Export' job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -119,9 +120,9 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: customise_base_domain_website is undefined when: awx_customise_base_domain_website is undefined
- name: If user doesn't define a sftp_password, create a disabled 'sftp' account - name: If user doesn't define a awx_sftp_password, create a disabled 'sftp' account
user: user:
name: sftp name: sftp
comment: SFTP user to set custom web files and access servers export comment: SFTP user to set custom web files and access servers export
@ -130,18 +131,18 @@
group: matrix group: matrix
password: '*' password: '*'
update_password: always update_password: always
when: sftp_password|length == 0 when: awx_sftp_password|length == 0
- name: If user defines sftp_password, enable account and set password on 'stfp' account - name: If user defines awx_sftp_password, enable account and set password on 'stfp' account
user: user:
name: sftp name: sftp
comment: SFTP user to set custom web files and access servers export comment: SFTP user to set custom web files and access servers export
shell: /bin/false shell: /bin/false
home: /home/sftp home: /home/sftp
group: matrix group: matrix
password: "{{ sftp_password | password_hash('sha512') }}" password: "{{ awx_sftp_password | password_hash('sha512') }}"
update_password: always update_password: always
when: sftp_password|length > 0 when: awx_sftp_password|length > 0
- name: Ensure group "sftp" exists - name: Ensure group "sftp" exists
group: group:
@ -153,7 +154,7 @@
name: sftp name: sftp
groups: sftp groups: sftp
append: yes append: yes
when: customise_base_domain_website is defined when: awx_customise_base_domain_website is defined
- name: Create the ro /chroot directory with sticky bit if it doesn't exist. (/chroot/website has matrix:matrix permissions and is mounted to nginx container) - name: Create the ro /chroot directory with sticky bit if it doesn't exist. (/chroot/website has matrix:matrix permissions and is mounted to nginx container)
file: file:
@ -170,7 +171,7 @@
owner: matrix owner: matrix
group: matrix group: matrix
mode: '0770' mode: '0770'
when: customise_base_domain_website is defined when: awx_customise_base_domain_website is defined
- name: Ensure /chroot/export location exists - name: Ensure /chroot/export location exists
file: file:
@ -202,11 +203,11 @@
- name: Insert public SSH key into authorized_keys file - name: Insert public SSH key into authorized_keys file
lineinfile: lineinfile:
path: /home/sftp/.ssh/authorized_keys path: /home/sftp/.ssh/authorized_keys
line: "{{ sftp_public_key }}" line: "{{ awx_sftp_public_key }}"
owner: sftp owner: sftp
group: sftp group: sftp
mode: '0644' mode: '0644'
when: (sftp_public_key | length > 0) and (sftp_auth_method == "SSH Key") when: (awx_sftp_public_key | length > 0) and (awx_sftp_auth_method == "SSH Key")
- name: Remove any existing Subsystem lines - name: Remove any existing Subsystem lines
lineinfile: lineinfile:
@ -232,7 +233,7 @@
AllowTcpForwarding no AllowTcpForwarding no
PasswordAuthentication yes PasswordAuthentication yes
AuthorizedKeysFile /home/sftp/.ssh/authorized_keys AuthorizedKeysFile /home/sftp/.ssh/authorized_keys
when: sftp_auth_method == "Disabled" when: awx_sftp_auth_method == "Disabled"
- name: Add SSH Match User section for password auth - name: Add SSH Match User section for password auth
blockinfile: blockinfile:
@ -245,7 +246,7 @@
X11Forwarding no X11Forwarding no
AllowTcpForwarding no AllowTcpForwarding no
PasswordAuthentication yes PasswordAuthentication yes
when: sftp_auth_method == "Password" when: awx_sftp_auth_method == "Password"
- name: Add SSH Match User section for publickey auth - name: Add SSH Match User section for publickey auth
blockinfile: blockinfile:
@ -258,7 +259,7 @@
X11Forwarding no X11Forwarding no
AllowTcpForwarding no AllowTcpForwarding no
AuthorizedKeysFile /home/sftp/.ssh/authorized_keys AuthorizedKeysFile /home/sftp/.ssh/authorized_keys
when: sftp_auth_method == "SSH Key" when: awx_sftp_auth_method == "SSH Key"
- name: Restart service ssh.service - name: Restart service ssh.service
service: service:

View File

@ -1,3 +1,4 @@
---
- name: Delete the AWX session token for executing modules - name: Delete the AWX session token for executing modules
awx.awx.tower_token: awx.awx.tower_token:

View File

@ -1,21 +1,22 @@
---
- name: Run export of /matrix/ and snapshot the database simultaneously - name: Run export of /matrix/ and snapshot the database simultaneously
command: "{{ item }}" command: "{{ item }}"
with_items: with_items:
- /bin/sh /usr/local/bin/awx-export-service.sh 1 0 - /bin/sh /usr/local/bin/awx-export-service.sh 1 0
- /bin/sh /usr/local/bin/awx-export-service.sh 0 1 - /bin/sh /usr/local/bin/awx-export-service.sh 0 1
register: _create_instances register: awx_create_instances
async: 3600 # Maximum runtime in seconds. async: 3600 # Maximum runtime in seconds.
poll: 0 # Fire and continue (never poll) poll: 0 # Fire and continue (never poll)
- name: Wait for both of these jobs to finish - name: Wait for both of these jobs to finish
async_status: async_status:
jid: "{{ item.ansible_job_id }}" jid: "{{ item.ansible_job_id }}"
register: _jobs register: awx_jobs
until: _jobs.finished until: awx_jobs.finished
delay: 5 # Check every 5 seconds. delay: 5 # Check every 5 seconds.
retries: 720 # Retry for a full hour. retries: 720 # Retry for a full hour.
with_items: "{{ _create_instances.results }}" with_items: "{{ awx_create_instances.results }}"
- name: Schedule deletion of the export in 24 hours - name: Schedule deletion of the export in 24 hours
at: at:
@ -35,8 +36,8 @@
- name: Set boolean value to exit playbook - name: Set boolean value to exit playbook
set_fact: set_fact:
end_playbook: true awx_end_playbook: true
- name: End playbook if this task list is called. - name: End playbook if this task list is called.
meta: end_play meta: end_play
when: end_playbook is defined and end_playbook|bool when: awx_end_playbook is defined and awx_end_playbook|bool

View File

@ -1,7 +1,7 @@
---
- name: Ensure correct ownership of /matrix/awx - name: Ensure correct ownership of /matrix/awx
shell: chown -R matrix:matrix /matrix/awx shell: chown -R matrix:matrix /matrix/awx
- name: Ensure correct ownership of /matrix/synapse - name: Ensure correct ownership of /matrix/synapse
shell: chown -R matrix:matrix /matrix/synapse shell: chown -R matrix:matrix /matrix/synapse

View File

@ -1,3 +1,4 @@
---
- name: Include vars in organisation.yml - name: Include vars in organisation.yml
include_vars: include_vars:

View File

@ -1,3 +1,4 @@
---
- name: Include new vars in matrix_vars.yml - name: Include new vars in matrix_vars.yml
include_vars: include_vars:

View File

@ -1,10 +1,11 @@
---
- name: Collect entire room list into stdout - name: Collect entire room list into stdout
shell: | shell: |
curl -X GET --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" '{{ synapse_container_ip.stdout }}:8008/_synapse/admin/v1/rooms?from={{ item }}' curl -X GET --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" '{{ synapse_container_ip.stdout }}:8008/_synapse/admin/v1/rooms?from={{ item }}'
register: rooms_output register: awx_rooms_output
- name: Print stdout to file - name: Print stdout to file
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
echo '{{ rooms_output.stdout }}' >> /tmp/{{ subscription_id }}_room_list_complete.json echo '{{ awx_rooms_output.stdout }}' >> /tmp/{{ subscription_id }}_room_list_complete.json

View File

@ -1,12 +1,13 @@
---
- name: Purge all rooms with more then N events - name: Purge all rooms with more then N events
shell: | shell: |
curl --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" -X POST -H "Content-Type: application/json" -d '{ "delete_local_events": false, "purge_up_to_ts": {{ purge_epoche_time.stdout }}000 }' "{{ synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_history/{{ item[1:-1] }}" curl --header "Authorization: Bearer {{ awx_janitors_token.stdout[1:-1] }}" -X POST -H "Content-Type: application/json" -d '{ "delete_local_events": false, "purge_up_to_ts": {{ awx_purge_epoche_time.stdout }}000 }' "{{ awx_synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_history/{{ item[1:-1] }}"
register: purge_command register: awx_purge_command
- name: Print output of purge command - name: Print output of purge command
debug: debug:
msg: "{{ purge_command.stdout }}" msg: "{{ awx_purge_command.stdout }}"
- name: Pause for 5 seconds to let Synapse breathe - name: Pause for 5 seconds to let Synapse breathe
pause: pause:

View File

@ -1,3 +1,4 @@
---
- name: Ensure dateutils and curl is installed in AWX - name: Ensure dateutils and curl is installed in AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -19,20 +20,20 @@
- name: Collect before shrink size of Synapse database - name: Collect before shrink size of Synapse database
shell: du -sh /matrix/postgres/data shell: du -sh /matrix/postgres/data
register: db_size_before_stat register: awx_db_size_before_stat
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
no_log: True no_log: True
- name: Collect the internal IP of the matrix-synapse container - name: Collect the internal IP of the matrix-synapse container
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"
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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: 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":"{{ matrix_awx_janitor_user_password }}"}' "{{ synapse_container_ip.stdout }}:8008/_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 }}:8008/_matrix/client/r0/login" | jq '.access_token'
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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: janitors_token register: awx_janitors_token
no_log: True no_log: True
- name: Copy build_room_list.py script to target machine - name: Copy build_room_list.py script to target machine
@ -42,107 +43,107 @@
owner: matrix owner: matrix
group: matrix group: matrix
mode: '0755' mode: '0755'
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Run build_room_list.py script - name: Run build_room_list.py script
shell: | shell: |
runuser -u matrix -- python3 /usr/local/bin/matrix_build_room_list.py {{ janitors_token.stdout[1:-1] }} {{ synapse_container_ip.stdout }} runuser -u matrix -- python3 /usr/local/bin/matrix_build_room_list.py {{ awx_janitors_token.stdout[1:-1] }} {{ awx_synapse_container_ip.stdout }}
register: rooms_total register: awx_rooms_total
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Fetch complete room list from target machine - name: Fetch complete room list from target machine
fetch: fetch:
src: /tmp/room_list_complete.json src: /tmp/room_list_complete.json
dest: "/tmp/{{ subscription_id }}_room_list_complete.json" dest: "/tmp/{{ subscription_id }}_room_list_complete.json"
flat: yes flat: yes
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Remove complete room list from target machine - name: Remove complete room list from target machine
file: file:
path: /tmp/room_list_complete.json path: /tmp/room_list_complete.json
state: absent state: absent
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Generate list of rooms with no local users - name: Generate list of rooms with no local users
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
jq 'try .rooms[] | select(.joined_local_members == 0) | .room_id' < /tmp/{{ subscription_id }}_room_list_complete.json > /tmp/{{ subscription_id }}_room_list_no_local_users.txt jq 'try .rooms[] | select(.joined_local_members == 0) | .room_id' < /tmp/{{ subscription_id }}_room_list_complete.json > /tmp/{{ subscription_id }}_room_list_no_local_users.txt
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Count number of rooms with no local users - name: Count number of rooms with no local users
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
wc -l /tmp/{{ subscription_id }}_room_list_no_local_users.txt | awk '{ print $1 }' wc -l /tmp/{{ subscription_id }}_room_list_no_local_users.txt | awk '{ print $1 }'
register: rooms_no_local_total register: awx_rooms_no_local_total
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Setting host fact room_list_no_local_users - name: Setting host fact awx_room_list_no_local_users
set_fact: set_fact:
room_list_no_local_users: "{{ lookup('file', '/tmp/{{ subscription_id }}_room_list_no_local_users.txt') }}" awx_room_list_no_local_users: "{{ lookup('file', '/tmp/{{ subscription_id }}_room_list_no_local_users.txt') }}"
no_log: True no_log: True
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Purge all rooms with no local users - name: Purge all rooms with no local users
include_tasks: purge_database_no_local.yml include_tasks: awx_purge_database_no_local.yml
loop: "{{ room_list_no_local_users.splitlines() | flatten(levels=1) }}" loop: "{{ awx_room_list_no_local_users.splitlines() | flatten(levels=1) }}"
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Collect epoche time from date - name: Collect epoche time from date
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
date -d '{{ purge_date }}' +"%s" date -d '{{ awx_purge_date }}' +"%s"
when: (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1) when: (awx_purge_mode.find("Number of users [slower]") != -1) or (awx_purge_mode.find("Number of events [slower]") != -1)
register: purge_epoche_time register: awx_purge_epoche_time
- name: Generate list of rooms with more then N users - name: Generate list of rooms with more then N users
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
jq 'try .rooms[] | select(.joined_members > {{ purge_metric_value }}) | .room_id' < /tmp/{{ subscription_id }}_room_list_complete.json > /tmp/{{ subscription_id }}_room_list_joined_members.txt jq 'try .rooms[] | select(.joined_members > {{ awx_purge_metric_value }}) | .room_id' < /tmp/{{ subscription_id }}_room_list_complete.json > /tmp/{{ subscription_id }}_room_list_joined_members.txt
when: purge_mode.find("Number of users [slower]") != -1 when: awx_purge_mode.find("Number of users [slower]") != -1
- name: Count number of rooms with more then N users - name: Count number of rooms with more then N users
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
wc -l /tmp/{{ subscription_id }}_room_list_joined_members.txt | awk '{ print $1 }' wc -l /tmp/{{ subscription_id }}_room_list_joined_members.txt | awk '{ print $1 }'
register: rooms_join_members_total register: awx_rooms_join_members_total
when: purge_mode.find("Number of users [slower]") != -1 when: awx_purge_mode.find("Number of users [slower]") != -1
- name: Setting host fact room_list_joined_members - name: Setting host fact awx_room_list_joined_members
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
set_fact: set_fact:
room_list_joined_members: "{{ lookup('file', '/tmp/{{ subscription_id }}_room_list_joined_members.txt') }}" awx_room_list_joined_members: "{{ lookup('file', '/tmp/{{ subscription_id }}_room_list_joined_members.txt') }}"
when: purge_mode.find("Number of users [slower]") != -1 when: awx_purge_mode.find("Number of users [slower]") != -1
no_log: True no_log: True
- name: Purge all rooms with more then N users - name: Purge all rooms with more then N users
include_tasks: purge_database_users.yml include_tasks: awx_purge_database_users.yml
loop: "{{ room_list_joined_members.splitlines() | flatten(levels=1) }}" loop: "{{ awx_room_list_joined_members.splitlines() | flatten(levels=1) }}"
when: purge_mode.find("Number of users [slower]") != -1 when: awx_purge_mode.find("Number of users [slower]") != -1
- name: Generate list of rooms with more then N events - name: Generate list of rooms with more then N events
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
jq 'try .rooms[] | select(.state_events > {{ purge_metric_value }}) | .room_id' < /tmp/{{ subscription_id }}_room_list_complete.json > /tmp/{{ subscription_id }}_room_list_state_events.txt jq 'try .rooms[] | select(.state_events > {{ awx_purge_metric_value }}) | .room_id' < /tmp/{{ subscription_id }}_room_list_complete.json > /tmp/{{ subscription_id }}_room_list_state_events.txt
when: purge_mode.find("Number of events [slower]") != -1 when: awx_purge_mode.find("Number of events [slower]") != -1
- name: Count number of rooms with more then N events - name: Count number of rooms with more then N events
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
wc -l /tmp/{{ subscription_id }}_room_list_state_events.txt | awk '{ print $1 }' wc -l /tmp/{{ subscription_id }}_room_list_state_events.txt | awk '{ print $1 }'
register: rooms_state_events_total register: awx_rooms_state_events_total
when: purge_mode.find("Number of events [slower]") != -1 when: awx_purge_mode.find("Number of events [slower]") != -1
- name: Setting host fact room_list_state_events - name: Setting host fact awx_room_list_state_events
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
set_fact: set_fact:
room_list_state_events: "{{ lookup('file', '/tmp/{{ subscription_id }}_room_list_state_events.txt') }}" awx_room_list_state_events: "{{ lookup('file', '/tmp/{{ subscription_id }}_room_list_state_events.txt') }}"
when: purge_mode.find("Number of events [slower]") != -1 when: awx_purge_mode.find("Number of events [slower]") != -1
no_log: True no_log: True
- name: Purge all rooms with more then N events - name: Purge all rooms with more then N events
include_tasks: purge_database_events.yml include_tasks: awx_purge_database_events.yml
loop: "{{ room_list_state_events.splitlines() | flatten(levels=1) }}" loop: "{{ awx_room_list_state_events.splitlines() | flatten(levels=1) }}"
when: purge_mode.find("Number of events [slower]") != -1 when: awx_purge_mode.find("Number of events [slower]") != -1
- name: Adjust 'Deploy/Update a Server' job template - name: Adjust 'Deploy/Update a Server' job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -161,7 +162,7 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1) or (purge_mode.find("Skip purging rooms [faster]") != -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) or (awx_purge_mode.find("Skip purging rooms [faster]") != -1)
- name: Execute rust-synapse-compress-state job template - name: Execute rust-synapse-compress-state job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -171,7 +172,7 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1) or (purge_mode.find("Skip purging rooms [faster]") != -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) or (awx_purge_mode.find("Skip purging rooms [faster]") != -1)
- name: Revert 'Deploy/Update a Server' job template - name: Revert 'Deploy/Update a Server' job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -190,25 +191,25 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1) or (purge_mode.find("Skip purging rooms [faster]") != -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) or (awx_purge_mode.find("Skip purging rooms [faster]") != -1)
- name: Ensure matrix-synapse is stopped - name: Ensure matrix-synapse is stopped
service: service:
name: matrix-synapse name: matrix-synapse
state: stopped state: stopped
daemon_reload: yes daemon_reload: yes
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
- name: Re-index Synapse database - name: Re-index Synapse database
shell: docker exec -i matrix-postgres psql "host=127.0.0.1 port=5432 dbname=synapse user=synapse password={{ matrix_synapse_connection_password }}" -c 'REINDEX (VERBOSE) DATABASE synapse' shell: docker exec -i matrix-postgres psql "host=127.0.0.1 port=5432 dbname=synapse user=synapse password={{ matrix_synapse_connection_password }}" -c 'REINDEX (VERBOSE) DATABASE synapse'
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
- name: Ensure matrix-synapse is started - name: Ensure matrix-synapse is started
service: service:
name: matrix-synapse name: matrix-synapse
state: started state: started
daemon_reload: yes daemon_reload: yes
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
- name: Adjust 'Deploy/Update a Server' job template - name: Adjust 'Deploy/Update a Server' job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -227,7 +228,7 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
- name: Execute run-postgres-vacuum job template - name: Execute run-postgres-vacuum job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -237,7 +238,7 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
- name: Revert 'Deploy/Update a Server' job template - name: Revert 'Deploy/Update a Server' job template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -256,50 +257,50 @@
tower_host: "https://{{ awx_host }}" tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
validate_certs: yes validate_certs: yes
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
- name: Cleanup room_list files - name: Cleanup room_list files
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
shell: | shell: |
rm /tmp/{{ subscription_id }}_room_list* rm /tmp/{{ subscription_id }}_room_list*
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
ignore_errors: yes ignore_errors: yes
- name: Collect after shrink size of Synapse database - name: Collect after shrink size of Synapse database
shell: du -sh /matrix/postgres/data shell: du -sh /matrix/postgres/data
register: db_size_after_stat register: awx_db_size_after_stat
when: (purge_mode.find("Perform final shrink") != -1) when: (awx_purge_mode.find("Perform final shrink") != -1)
no_log: True no_log: True
- name: Print total number of rooms processed - name: Print total number of rooms processed
debug: debug:
msg: '{{ rooms_total.stdout }}' msg: '{{ awx_rooms_total.stdout }}'
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Print the number of rooms purged with no local users - name: Print the number of rooms purged with no local users
debug: debug:
msg: '{{ rooms_no_local_total.stdout }}' msg: '{{ awx_rooms_no_local_total.stdout }}'
when: (purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (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)
- name: Print the number of rooms purged with more then N users - name: Print the number of rooms purged with more then N users
debug: debug:
msg: '{{ rooms_join_members_total.stdout }}' msg: '{{ awx_rooms_join_members_total.stdout }}'
when: purge_mode.find("Number of users") != -1 when: awx_purge_mode.find("Number of users") != -1
- name: Print the number of rooms purged with more then N events - name: Print the number of rooms purged with more then N events
debug: debug:
msg: '{{ rooms_state_events_total.stdout }}' msg: '{{ awx_rooms_state_events_total.stdout }}'
when: purge_mode.find("Number of events") != -1 when: awx_purge_mode.find("Number of events") != -1
- name: Print before purge size of Synapse database - name: Print before purge size of Synapse database
debug: debug:
msg: "{{ db_size_before_stat.stdout.split('\n') }}" msg: "{{ awx_db_size_before_stat.stdout.split('\n') }}"
when: (db_size_before_stat is defined) and (purge_mode.find("Perform final shrink") != -1) when: ( awx_db_size_before_stat is defined ) and ( awx_purge_mode.find("Perform final shrink" ) != -1 )
- name: Print after purge size of Synapse database - name: Print after purge size of Synapse database
debug: debug:
msg: "{{ db_size_after_stat.stdout.split('\n') }}" msg: "{{ awx_db_size_after_stat.stdout.split('\n') }}"
when: (db_size_after_stat is defined) and (purge_mode.find("Perform final shrink") != -1) when: (awx_db_size_after_stat is defined) and (awx_purge_mode.find("Perform final shrink") != -1)
- name: Delete the AWX session token for executing modules - name: Delete the AWX session token for executing modules
awx.awx.tower_token: awx.awx.tower_token:
@ -312,8 +313,8 @@
- name: Set boolean value to exit playbook - name: Set boolean value to exit playbook
set_fact: set_fact:
end_playbook: true awx_end_playbook: true
- name: End playbook early if this task is called. - name: End playbook early if this task is called.
meta: end_play meta: end_play
when: end_playbook is defined and end_playbook|bool when: awx_end_playbook is defined and awx_end_playbook|bool

View File

@ -1,12 +1,13 @@
---
- name: Purge all rooms with no local users - name: Purge all rooms with no local users
shell: | shell: |
curl --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" -X POST -H "Content-Type: application/json" -d '{ "room_id": {{ item }} }' '{{ synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_room' curl --header "Authorization: Bearer {{ awx_janitors_token.stdout[1:-1] }}" -X POST -H "Content-Type: application/json" -d '{ "room_id": {{ item }} }' '{{ awx_synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_room'
register: purge_command register: awx_purge_command
- name: Print output of purge command - name: Print output of purge command
debug: debug:
msg: "{{ purge_command.stdout }}" msg: "{{ awx_purge_command.stdout }}"
- name: Pause for 5 seconds to let Synapse breathe - name: Pause for 5 seconds to let Synapse breathe
pause: pause:

View File

@ -1,12 +1,13 @@
---
- name: Purge all rooms with more then N users - name: Purge all rooms with more then N users
shell: | shell: |
curl --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" -X POST -H "Content-Type: application/json" -d '{ "delete_local_events": false, "purge_up_to_ts": {{ purge_epoche_time.stdout }}000 }' "{{ synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_history/{{ item[1:-1] }}" curl --header "Authorization: Bearer {{ awx_janitors_token.stdout[1:-1] }}" -X POST -H "Content-Type: application/json" -d '{ "delete_local_events": false, "purge_up_to_ts": {{ awx_purge_epoche_time.stdout }}000 }' "{{ awx_synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_history/{{ item[1:-1] }}"
register: purge_command register: awx_purge_command
- name: Print output of purge command - name: Print output of purge command
debug: debug:
msg: "{{ purge_command.stdout }}" msg: "{{ awx_purge_command.stdout }}"
- name: Pause for 5 seconds to let Synapse breathe - name: Pause for 5 seconds to let Synapse breathe
pause: pause:

View File

@ -1,17 +1,18 @@
---
- name: Collect epoche time from date - name: Collect epoche time from date
shell: | shell: |
date -d '{{ item }}' +"%s" date -d '{{ item }}' +"%s"
register: epoche_time register: awx_epoche_time
- name: Purge local media to specific date - name: Purge local media to specific date
shell: | shell: |
curl -X POST --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" '{{ synapse_container_ip.stdout }}:8008/_synapse/admin/v1/media/matrix.{{ matrix_domain }}/delete?before_ts={{ epoche_time.stdout }}000' curl -X POST --header "Authorization: Bearer {{ awx_janitors_token.stdout[1:-1] }}" '{{ awx_synapse_container_ip.stdout }}:8008/_synapse/admin/v1/media/matrix.{{ matrix_domain }}/delete?before_ts={{ awx_epoche_time.stdout }}000'
register: purge_command register: awx_purge_command
- name: Print output of purge command - name: Print output of purge command
debug: debug:
msg: "{{ purge_command.stdout }}" msg: "{{ awx_purge_command.stdout }}"
- name: Pause for 5 seconds to let Synapse breathe - name: Pause for 5 seconds to let Synapse breathe
pause: pause:

View File

@ -19,76 +19,76 @@
- name: Collect the internal IP of the matrix-synapse container - name: Collect the internal IP of the matrix-synapse container
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: 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":"{{ matrix_awx_janitor_user_password }}"}' "{{ synapse_container_ip.stdout }}:8008/_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 }}:8008/_matrix/client/r0/login" | jq '.access_token'
register: 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 {{ matrix_purge_from_date }} {{ matrix_purge_to_date }}"
register: 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: local_media_size_before register: awx_local_media_size_before
when: matrix_purge_media_type == "Local Media" when: awx_purge_media_type == "Local Media"
ignore_errors: yes ignore_errors: yes
no_log: True no_log: True
- name: Calculate initial size of remote media repository - name: Calculate initial size of remote media repository
shell: du -sh /matrix/synapse/storage/media-store/remote* shell: du -sh /matrix/synapse/storage/media-store/remote*
register: remote_media_size_before register: awx_remote_media_size_before
when: matrix_purge_media_type == "Remote Media" when: awx_purge_media_type == "Remote Media"
ignore_errors: yes ignore_errors: yes
no_log: True no_log: True
- name: Purge local media with loop - name: Purge local media with loop
include_tasks: purge_media_local.yml include_tasks: purge_media_local.yml
loop: "{{ purge_dates.stdout_lines | flatten(levels=1) }}" loop: "{{ awx_purge_dates.stdout_lines | flatten(levels=1) }}"
when: matrix_purge_media_type == "Local Media" when: awx_purge_media_type == "Local Media"
- name: Purge remote media with loop - name: Purge remote media with loop
include_tasks: purge_media_remote.yml include_tasks: purge_media_remote.yml
loop: "{{ purge_dates.stdout_lines | flatten(levels=1) }}" loop: "{{ awx_purge_dates.stdout_lines | flatten(levels=1) }}"
when: matrix_purge_media_type == "Remote Media" when: awx_purge_media_type == "Remote Media"
- name: Calculate final size of local media repository - name: Calculate final size of local media repository
shell: du -sh /matrix/synapse/storage/media-store/local* shell: du -sh /matrix/synapse/storage/media-store/local*
register: local_media_size_after register: awx_local_media_size_after
when: matrix_purge_media_type == "Local Media" when: awx_purge_media_type == "Local Media"
ignore_errors: yes ignore_errors: yes
no_log: True no_log: True
- name: Calculate final size of remote media repository - name: Calculate final size of remote media repository
shell: du -sh /matrix/synapse/storage/media-store/remote* shell: du -sh /matrix/synapse/storage/media-store/remote*
register: remote_media_size_after register: awx_remote_media_size_after
when: matrix_purge_media_type == "Remote Media" when: awx_purge_media_type == "Remote Media"
ignore_errors: yes ignore_errors: yes
no_log: True no_log: True
- name: Print size of local media repository before purge - name: Print size of local media repository before purge
debug: debug:
msg: "{{ local_media_size_before.stdout.split('\n') }}" msg: "{{ awx_local_media_size_before.stdout.split('\n') }}"
when: matrix_purge_media_type == "Local Media" when: awx_purge_media_type == "Local Media"
- name: Print size of local media repository after purge - name: Print size of local media repository after purge
debug: debug:
msg: "{{ local_media_size_after.stdout.split('\n') }}" msg: "{{ awx_local_media_size_after.stdout.split('\n') }}"
when: matrix_purge_media_type == "Local Media" when: awx_purge_media_type == "Local Media"
- name: Print size of remote media repository before purge - name: Print size of remote media repository before purge
debug: debug:
msg: "{{ remote_media_size_before.stdout.split('\n') }}" msg: "{{ awx_remote_media_size_before.stdout.split('\n') }}"
when: matrix_purge_media_type == "Remote Media" when: awx_purge_media_type == "Remote Media"
- name: Print size of remote media repository after purge - name: Print size of remote media repository after purge
debug: debug:
msg: "{{ remote_media_size_after.stdout.split('\n') }}" msg: "{{ awx_remote_media_size_after.stdout.split('\n') }}"
when: matrix_purge_media_type == "Remote Media" when: awx_purge_media_type == "Remote Media"
- name: Delete the AWX session token for executing modules - name: Delete the AWX session token for executing modules
awx.awx.tower_token: awx.awx.tower_token:
@ -101,8 +101,8 @@
- name: Set boolean value to exit playbook - name: Set boolean value to exit playbook
set_fact: set_fact:
end_playbook: true awx_end_playbook: true
- name: End playbook early if this task is called. - name: End playbook early if this task is called.
meta: end_play meta: end_play
when: end_playbook is defined and end_playbook|bool when: awx_end_playbook is defined and awx_end_playbook|bool

View File

@ -1,17 +1,18 @@
---
- name: Collect epoche time from date - name: Collect epoche time from date
shell: | shell: |
date -d '{{ item }}' +"%s" date -d '{{ item }}' +"%s"
register: epoche_time register: awx_epoche_time
- name: Purge remote media to specific date - name: Purge remote media to specific date
shell: | shell: |
curl -X POST --header "Authorization: Bearer {{ janitors_token.stdout[1:-1] }}" '{{ synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_media_cache?before_ts={{ epoche_time.stdout }}000' curl -X POST --header "Authorization: Bearer {{ awx_janitors_token.stdout[1:-1] }}" '{{ awx_synapse_container_ip.stdout }}:8008/_synapse/admin/v1/purge_media_cache?before_ts={{ awx_epoche_time.stdout }}000'
register: purge_command register: awx_purge_command
- name: Print output of purge command - name: Print output of purge command
debug: debug:
msg: "{{ purge_command.stdout }}" msg: "{{ awx_purge_command.stdout }}"
- name: Pause for 5 seconds to let Synapse breathe - name: Pause for 5 seconds to let Synapse breathe
pause: pause:

View File

@ -1,3 +1,4 @@
---
- name: Rename synapse presence variable - name: Rename synapse presence variable
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -1,3 +1,4 @@
---
- name: Set the new authorized key taken from file - name: Set the new authorized key taken from file
authorized_key: authorized_key:

View File

@ -1,3 +1,4 @@
---
- name: Install prerequisite apt packages on target - name: Install prerequisite apt packages on target
apt: apt:
@ -23,83 +24,83 @@
- name: Calculate MAU value - name: Calculate MAU value
shell: | shell: |
curl -s localhost:9000 | grep "^synapse_admin_mau_current " curl -s localhost:9000 | grep "^synapse_admin_mau_current "
register: mau_stat register: awx_mau_stat
no_log: True no_log: True
- name: Print MAU value
debug:
msg: "{{ mau_stat.stdout.split('\n') }}"
when: mau_stat is defined
- name: Calculate CPU usage statistics - name: Calculate CPU usage statistics
shell: iostat -c shell: iostat -c
register: cpu_usage_stat register: awx_cpu_usage_stat
no_log: True no_log: True
- name: Print CPU usage statistics
debug:
msg: "{{ cpu_usage_stat.stdout.split('\n') }}"
when: cpu_usage_stat is defined
- name: Calculate RAM usage statistics - name: Calculate RAM usage statistics
shell: free -mh shell: free -mh
register: ram_usage_stat register: awx_ram_usage_stat
no_log: True no_log: True
- name: Print RAM usage statistics
debug:
msg: "{{ ram_usage_stat.stdout.split('\n') }}"
when: ram_usage_stat is defined
- name: Calculate free disk space - name: Calculate free disk space
shell: df -h shell: df -h
register: disk_space_stat register: awx_disk_space_stat
no_log: True no_log: True
- name: Print free disk space
debug:
msg: "{{ disk_space_stat.stdout.split('\n') }}"
when: disk_space_stat is defined
- name: Calculate size of Synapse database - name: Calculate size of Synapse database
shell: du -sh /matrix/postgres/data shell: du -sh /matrix/postgres/data
register: db_size_stat register: awx_db_size_stat
no_log: True no_log: True
- name: Print size of Synapse database
debug:
msg: "{{ db_size_stat.stdout.split('\n') }}"
when: db_size_stat is defined
- name: Calculate size of local media repository - name: Calculate size of local media repository
shell: du -sh /matrix/synapse/storage/media-store/local* shell: du -sh /matrix/synapse/storage/media-store/local*
register: local_media_size_stat register: awx_local_media_size_stat
ignore_errors: yes ignore_errors: yes
no_log: True no_log: True
- name: Print size of local media repository
debug:
msg: "{{ local_media_size_stat.stdout.split('\n') }}"
when: local_media_size_stat is defined
- name: Calculate size of remote media repository - name: Calculate size of remote media repository
shell: du -sh /matrix/synapse/storage/media-store/remote* shell: du -sh /matrix/synapse/storage/media-store/remote*
register: remote_media_size_stat register: awx_remote_media_size_stat
ignore_errors: yes
no_log: True
- name: Calculate docker container statistics
shell: docker stats --all --no-stream
register: awx_docker_stats
ignore_errors: yes ignore_errors: yes
no_log: True no_log: True
- name: Print size of remote media repository - name: Print size of remote media repository
debug: debug:
msg: "{{ remote_media_size_stat.stdout.split('\n') }}" msg: "{{ awx_remote_media_size_stat.stdout.split('\n') }}"
when: remote_media_size_stat is defined when: awx_remote_media_size_stat is defined
- name: Print size of local media repository
debug:
msg: "{{ awx_local_media_size_stat.stdout.split('\n') }}"
when: awx_local_media_size_stat is defined
- name: Calculate docker container statistics - name: Print size of Synapse database
shell: docker stats --all --no-stream debug:
register: docker_stats msg: "{{ awx_db_size_stat.stdout.split('\n') }}"
ignore_errors: yes when: awx_db_size_stat is defined
no_log: True
- name: Print free disk space
debug:
msg: "{{ awx_disk_space_stat.stdout.split('\n') }}"
when: awx_disk_space_stat is defined
- name: Print RAM usage statistics
debug:
msg: "{{ awx_ram_usage_stat.stdout.split('\n') }}"
when: awx_ram_usage_stat is defined
- name: Print CPU usage statistics
debug:
msg: "{{ awx_cpu_usage_stat.stdout.split('\n') }}"
when: awx_cpu_usage_stat is defined
- name: Print MAU value
debug:
msg: "{{ awx_mau_stat.stdout.split('\n') }}"
when: awx_mau_stat is defined
- name: Print docker container statistics - name: Print docker container statistics
debug: debug:
msg: "{{ docker_stats.stdout.split('\n') }}" msg: "{{ awx_docker_stats.stdout.split('\n') }}"
when: docker_stats is defined when: awx_docker_stats is defined

View File

@ -1,3 +1,4 @@
---
- name: Record Corporal Enabled/Disabled variable - name: Record Corporal Enabled/Disabled variable
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -62,7 +63,7 @@
insertafter: '# Corporal Settings Start' insertafter: '# Corporal Settings Start'
with_dict: with_dict:
'matrix_corporal_http_api_enabled': 'false' 'matrix_corporal_http_api_enabled': 'false'
when: (matrix_corporal_policy_provider_mode == "Simple Static File") or (not matrix_corporal_enabled|bool) when: (awx_corporal_policy_provider_mode == "Simple Static File") or (not matrix_corporal_enabled|bool)
- name: Enable Corporal API if Push/Pull mode delected - name: Enable Corporal API if Push/Pull mode delected
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -73,7 +74,7 @@
insertafter: '# Corporal Settings Start' insertafter: '# Corporal Settings Start'
with_dict: with_dict:
'matrix_corporal_http_api_enabled': 'true' 'matrix_corporal_http_api_enabled': 'true'
when: (matrix_corporal_policy_provider_mode != "Simple Static File") and (matrix_corporal_enabled|bool) when: (awx_corporal_policy_provider_mode != "Simple Static File") and (matrix_corporal_enabled|bool)
- name: Record Corporal API Access Token if it's defined - name: Record Corporal API Access Token if it's defined
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -83,8 +84,8 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Corporal Settings Start' insertafter: '# Corporal Settings Start'
with_dict: with_dict:
'matrix_corporal_http_api_auth_token': '{{ matrix_corporal_http_api_auth_token }}' 'awx_corporal_http_api_auth_token': '{{ awx_corporal_http_api_auth_token }}'
when: matrix_corporal_http_api_auth_token|length > 0 when: awx_corporal_http_api_auth_token|length > 0
- name: Record 'Simple Static File' configuration variables in matrix_vars.yml - name: Record 'Simple Static File' configuration variables in matrix_vars.yml
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -97,7 +98,7 @@
"Type": "static_file", "Type": "static_file",
"Path": "/etc/matrix-corporal/corporal-policy.json" "Path": "/etc/matrix-corporal/corporal-policy.json"
} }
when: matrix_corporal_policy_provider_mode == "Simple Static File" when: awx_corporal_policy_provider_mode == "Simple Static File"
- name: Touch the /matrix/corporal/ directory - name: Touch the /matrix/corporal/ directory
file: file:
@ -141,12 +142,12 @@
- name: Record 'Simple Static File' configuration content in corporal-policy.json - name: Record 'Simple Static File' configuration content in corporal-policy.json
copy: copy:
content: "{{ matrix_corporal_simple_static_config | string }}" content: "{{ awx_corporal_simple_static_config | string }}"
dest: "/matrix/corporal/config/corporal-policy.json" dest: "/matrix/corporal/config/corporal-policy.json"
owner: matrix owner: matrix
group: matrix group: matrix
mode: '660' mode: '660'
when: (matrix_corporal_policy_provider_mode == "Simple Static File") and (matrix_corporal_simple_static_config|length > 0) when: (awx_corporal_policy_provider_mode == "Simple Static File") and (awx_corporal_simple_static_config|length > 0)
- name: Record 'HTTP Pull Mode' configuration variables in matrix_vars.yml - name: Record 'HTTP Pull Mode' configuration variables in matrix_vars.yml
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -157,13 +158,13 @@
matrix_corporal_policy_provider_config: | matrix_corporal_policy_provider_config: |
{ {
"Type": "http", "Type": "http",
"Uri": "{{ matrix_corporal_pull_mode_uri }}", "Uri": "{{ awx_corporal_pull_mode_uri }}",
"AuthorizationBearerToken": "{{ matrix_corporal_pull_mode_token }}", "AuthorizationBearerToken": "{{ awx_corporal_pull_mode_token }}",
"CachePath": "/var/cache/matrix-corporal/last-policy.json", "CachePath": "/var/cache/matrix-corporal/last-policy.json",
"ReloadIntervalSeconds": 1800, "ReloadIntervalSeconds": 1800,
"TimeoutMilliseconds": 30000 "TimeoutMilliseconds": 30000
} }
when: (matrix_corporal_policy_provider_mode == "HTTP Pull Mode (API Enabled)") and (matrix_corporal_pull_mode_uri|length > 0) and (matrix_corporal_pull_mode_token|length > 0) when: (awx_corporal_policy_provider_mode == "HTTP Pull Mode (API Enabled)") and (matrix_corporal_pull_mode_uri|length > 0) and (awx_corporal_pull_mode_token|length > 0)
- name: Record 'HTTP Push Mode' configuration variables in matrix_vars.yml - name: Record 'HTTP Push Mode' configuration variables in matrix_vars.yml
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -176,7 +177,7 @@
"Type": "last_seen_store_policy", "Type": "last_seen_store_policy",
"CachePath": "/var/cache/matrix-corporal/last-policy.json" "CachePath": "/var/cache/matrix-corporal/last-policy.json"
} }
when: (matrix_corporal_policy_provider_mode == "HTTP Push Mode (API Enabled)") when: (awx_corporal_policy_provider_mode == "HTTP Push Mode (API Enabled)")
- name: Lower RateLimit if set to 'Normal' - name: Lower RateLimit if set to 'Normal'
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -184,7 +185,7 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: ' address:\n per_second: 50\n burst_count: 300\n account:\n per_second: 0.17\n burst_count: 300' regexp: ' address:\n per_second: 50\n burst_count: 300\n account:\n per_second: 0.17\n burst_count: 300'
replace: ' address:\n per_second: 0.17\n burst_count: 3\n account:\n per_second: 0.17\n burst_count: 3' replace: ' address:\n per_second: 0.17\n burst_count: 3\n account:\n per_second: 0.17\n burst_count: 3'
when: matrix_corporal_raise_ratelimits == "Normal" when: awx_corporal_raise_ratelimits == "Normal"
- name: Raise RateLimit if set to 'Raised' - name: Raise RateLimit if set to 'Raised'
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -192,7 +193,7 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: ' address:\n per_second: 0.17\n burst_count: 3\n account:\n per_second: 0.17\n burst_count: 3' regexp: ' address:\n per_second: 0.17\n burst_count: 3\n account:\n per_second: 0.17\n burst_count: 3'
replace: ' address:\n per_second: 50\n burst_count: 300\n account:\n per_second: 0.17\n burst_count: 300' replace: ' address:\n per_second: 50\n burst_count: 300\n account:\n per_second: 0.17\n burst_count: 300'
when: matrix_corporal_raise_ratelimits == "Raised" when: awx_corporal_raise_ratelimits == "Raised"
- name: Save new 'Configure Corporal' survey.json to the AWX tower - name: Save new 'Configure Corporal' survey.json to the AWX tower
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -1,3 +1,4 @@
---
- name: Include vars in matrix_vars.yml - name: Include vars in matrix_vars.yml
include_vars: include_vars:
@ -13,8 +14,8 @@
- 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": "{{ matrix_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: dimension_user_access_token register: awx_dimension_user_access_token
- name: Record Synapse variables locally on AWX - name: Record Synapse variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -25,17 +26,17 @@
insertafter: '# Dimension Settings Start' insertafter: '# Dimension Settings Start'
with_dict: with_dict:
'matrix_dimension_enabled': '{{ matrix_dimension_enabled }}' 'matrix_dimension_enabled': '{{ matrix_dimension_enabled }}'
'matrix_dimension_access_token': '"{{ dimension_user_access_token.stdout }}"' 'matrix_dimension_access_token': '"{{ awx_dimension_user_access_token.stdout }}"'
- name: Set final users list if users are defined - name: Set final users list if users are defined
set_fact: set_fact:
ext_dimension_users_raw_final: "{{ ext_dimension_users_raw }}" awx_dimension_users_final: "{{ awx_dimension_users }}"
when: ext_dimension_users_raw|length > 0 when: awx_dimension_users | length > 0
- name: Set final users list if no users are defined - name: Set final users list if no users are defined
set_fact: set_fact:
ext_dimension_users_raw_final: '@dimension:{{ matrix_domain }}' awx_dimension_users_final: '@dimension:{{ matrix_domain }}'
when: ext_dimension_users_raw|length == 0 when: awx_dimension_users | length == 0
- name: Remove Dimension Users - name: Remove Dimension Users
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -58,7 +59,7 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
insertafter: '^matrix_dimension_admins:' insertafter: '^matrix_dimension_admins:'
line: ' - "{{ item }}"' line: ' - "{{ item }}"'
with_items: "{{ ext_dimension_users_raw_final.splitlines() }}" with_items: "{{ awx_dimension_users_final.splitlines() }}"
- name: Record Dimension Custom variables locally on AWX - name: Record Dimension Custom variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -66,9 +67,9 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:" regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Custom Settings Start' insertbefore: '# Dimension Settings End'
with_dict: with_dict:
'ext_dimension_users_raw': '{{ ext_dimension_users_raw.splitlines() | to_json }}' 'awx_dimension_users': '{{ awx_dimension_users.splitlines() | to_json }}'
- name: Save new 'Configure Dimension' survey.json to the AWX tower, template - name: Save new 'Configure Dimension' survey.json to the AWX tower, template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -1,3 +1,4 @@
---
- name: Record Element-Web variables locally on AWX - name: Record Element-Web variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -8,25 +9,142 @@
insertafter: '# Element Settings Start' insertafter: '# Element Settings Start'
with_dict: with_dict:
'matrix_client_element_enabled': '{{ matrix_client_element_enabled }}' 'matrix_client_element_enabled': '{{ matrix_client_element_enabled }}'
'matrix_client_element_jitsi_preferredDomain': '{{ matrix_client_element_jitsi_preferredDomain }}' 'matrix_client_element_jitsi_preferredDomain': 'jitsi.{{ matrix_domain }}'
'matrix_client_element_brand': '{{ matrix_client_element_brand }}'
'matrix_client_element_default_theme': '{{ matrix_client_element_default_theme }}' 'matrix_client_element_default_theme': '{{ matrix_client_element_default_theme }}'
'matrix_client_element_registration_enabled': '{{ matrix_client_element_registration_enabled }}' 'matrix_client_element_registration_enabled': '{{ matrix_client_element_registration_enabled }}'
'matrix_client_element_brand': '{{ matrix_client_element_brand | trim }}'
'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl | trim }}'
'matrix_client_element_welcome_logo': '{{ matrix_client_element_welcome_logo | trim }}'
'matrix_client_element_welcome_logo_link': '{{ matrix_client_element_welcome_logo_link | trim }}'
- name: Record Element-Web custom variables locally on AWX
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: '{{ item.value }}'"
insertbefore: '# Element Settings End'
with_dict:
'awx_matrix_client_element_welcome_headline': '{{ awx_matrix_client_element_welcome_headline | trim }}'
'awx_matrix_client_element_welcome_text': '{{ awx_matrix_client_element_welcome_text | trim }}'
- name: Set Element-Web custom branding locally on AWX
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: '{{ item.value }}'"
insertafter: '# Element Settings Start'
with_dict:
'matrix_client_element_brand': "{{ matrix_client_element_brand }}"
when: matrix_client_element_brand | trim | length > 0
- name: Remove Element-Web custom branding locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_brand: "
state: absent
when: matrix_client_element_brand | trim | length == 0
- name: Set fact for 'https' string - name: Set fact for 'https' string
set_fact: set_fact:
awx_https_string: "https" awx_https_string: "https"
- name: Record Element-Web Background variable locally on AWX - name: Set Element-Web custom logo locally on AWX if defined
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
lineinfile: lineinfile:
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:" regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: '{{ item.value }}'"
insertafter: '# Element Settings Start'
with_dict:
'matrix_client_element_welcome_logo': '{{ matrix_client_element_welcome_logo }}'
when: ( awx_https_string in matrix_client_element_welcome_logo ) and ( matrix_client_element_welcome_logo | trim | length > 0 )
- name: Remove Element-Web custom logo locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_logo: "
state: absent
when: matrix_client_element_welcome_logo | trim | length == 0
- name: Set Element-Web custom logo link locally on AWX if defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: '{{ item.value }}'"
insertafter: '# Element Settings Start'
with_dict:
'matrix_client_element_welcome_logo_link': '{{ matrix_client_element_welcome_logo_link }}'
when: ( awx_https_string in matrix_client_element_welcome_logo_link ) and ( matrix_client_element_welcome_logo_link | trim | length > 0 )
- name: Remove Element-Web custom logo link locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_logo_link: "
state: absent
when: matrix_client_element_welcome_logo_link | trim | length == 0
- name: Set Element-Web custom headline locally on AWX if defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: '{{ item.value }}'"
insertafter: '# Element Settings Start'
with_dict:
'matrix_client_element_welcome_headline': '{{ awx_matrix_client_element_welcome_headline }}'
when: awx_matrix_client_element_welcome_headline | trim | length > 0
- name: Remove Element-Web custom headline locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_headline: "
state: absent
when: awx_matrix_client_element_welcome_headline | trim | length == 0
- name: Set Element-Web custom text locally on AWX if defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: '{{ item.value }}'"
insertafter: '# Element Settings Start'
with_dict:
'matrix_client_element_welcome_text': '{{ awx_matrix_client_element_welcome_text }}'
when: awx_matrix_client_element_welcome_text | trim | length > 0
- name: Remove Element-Web custom text locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_text: "
state: absent
when: awx_matrix_client_element_welcome_text | trim | length == 0
- name: Set Element-Web background locally on AWX if defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: '{{ item.value }}'"
insertafter: '# Element Settings Start' insertafter: '# Element Settings Start'
with_dict: with_dict:
'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl }}' 'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl }}'
when: (awx_https_string in matrix_client_element_branding_welcomeBackgroundUrl) and ( matrix_client_element_branding_welcomeBackgroundUrl|length > 0 ) when: matrix_client_element_branding_welcomeBackgroundUrl | trim | length > 0
- name: Remove Element-Web background locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_branding_welcomeBackgroundUrl: "
state: absent
when: matrix_client_element_branding_welcomeBackgroundUrl | trim | length == 0
- name: Save new 'Configure Element' survey.json to the AWX tower, template - name: Save new 'Configure Element' survey.json to the AWX tower, template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -1,3 +1,4 @@
---
- name: Record Element-Web variables locally on AWX - name: Record Element-Web variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -7,7 +8,7 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Element Settings Start' insertafter: '# Element Settings Start'
with_dict: with_dict:
'matrix_server_fqn_element': "{{ element_subdomain }}.{{ matrix_domain }}" 'matrix_server_fqn_element': "{{ awx_element_subdomain | trim }}.{{ matrix_domain }}"
- name: Save new 'Configure Element Subdomain' survey.json to the AWX tower, template - name: Save new 'Configure Element Subdomain' survey.json to the AWX tower, template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -1,3 +1,4 @@
---
- name: Record Jitsi variables locally on AWX - name: Record Jitsi variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -8,7 +9,7 @@
insertafter: '# Jitsi Settings Start' insertafter: '# Jitsi Settings Start'
with_dict: with_dict:
'matrix_jitsi_enabled': '{{ matrix_jitsi_enabled }}' 'matrix_jitsi_enabled': '{{ matrix_jitsi_enabled }}'
'matrix_jitsi_web_config_defaultLanguage': '{{ matrix_jitsi_web_config_defaultLanguage }}' 'matrix_jitsi_web_config_defaultLanguage': '{{ matrix_jitsi_web_config_defaultLanguage | trim }}'
- name: Save new 'Configure Jitsi' survey.json to the AWX tower, template - name: Save new 'Configure Jitsi' survey.json to the AWX tower, template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -1,3 +1,4 @@
---
- name: Record ma1sd variables locally on AWX - name: Record ma1sd variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -17,8 +18,8 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Synapse Extension Start' insertafter: '# Synapse Extension Start'
with_dict: with_dict:
'matrix_synapse_ext_password_provider_rest_auth_enabled': 'false' 'matrix_synapse_awx_password_provider_rest_auth_enabled': 'false'
when: ext_matrix_ma1sd_auth_store == 'Synapse Internal' when: awx_matrix_ma1sd_auth_store == 'Synapse Internal'
- name: Enable REST auth if using external LDAP/AD with ma1sd - name: Enable REST auth if using external LDAP/AD with ma1sd
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -28,9 +29,9 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Synapse Extension Start' insertafter: '# Synapse Extension Start'
with_dict: with_dict:
'matrix_synapse_ext_password_provider_rest_auth_enabled': 'true' 'matrix_synapse_awx_password_provider_rest_auth_enabled': 'true'
'matrix_synapse_ext_password_provider_rest_auth_endpoint': '"http://matrix-ma1sd:8090"' 'matrix_synapse_awx_password_provider_rest_auth_endpoint': '"http://matrix-ma1sd:8090"'
when: ext_matrix_ma1sd_auth_store == 'LDAP/AD' when: awx_matrix_ma1sd_auth_store == 'LDAP/AD'
- name: Remove entire ma1sd configuration extension - name: Remove entire ma1sd configuration extension
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -53,7 +54,7 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
marker: "# {mark} ma1sd ANSIBLE MANAGED BLOCK" marker: "# {mark} ma1sd ANSIBLE MANAGED BLOCK"
insertafter: '# Start ma1sd Extension' insertafter: '# Start ma1sd Extension'
block: '{{ ext_matrix_ma1sd_configuration_extension_yaml }}' block: '{{ awx_matrix_ma1sd_configuration_extension_yaml }}'
- name: Record ma1sd Custom variables locally on AWX - name: Record ma1sd Custom variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -61,10 +62,10 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:" regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertbefore: '# Custom Settings Start' insertbefore: '# ma1sd Settings End'
with_dict: with_dict:
'ext_matrix_ma1sd_auth_store': '{{ ext_matrix_ma1sd_auth_store }}' 'awx_matrix_ma1sd_auth_store': '{{ awx_matrix_ma1sd_auth_store }}'
'ext_matrix_ma1sd_configuration_extension_yaml': '{{ ext_matrix_ma1sd_configuration_extension_yaml.splitlines() | to_json }}' 'awx_matrix_ma1sd_configuration_extension_yaml': '{{ awx_matrix_ma1sd_configuration_extension_yaml.splitlines() | to_json }}'
no_log: True no_log: True
- name: Save new 'Configure ma1sd' survey.json to the AWX tower, template - name: Save new 'Configure ma1sd' survey.json to the AWX tower, template

View File

@ -1,3 +1,4 @@
---
- name: Record Mailer variables locally on AWX - name: Record Mailer variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -2,12 +2,12 @@
- name: Limit max upload size to 200MB part 1 - name: Limit max upload size to 200MB part 1
set_fact: set_fact:
matrix_synapse_max_upload_size_mb: "200" matrix_synapse_max_upload_size_mb: "200"
when: matrix_synapse_max_upload_size_mb_raw|int >= 200 when: awx_synapse_max_upload_size_mb | int >= 200
- name: Limit max upload size to 200MB part 2 - name: Limit max upload size to 200MB part 2
set_fact: set_fact:
matrix_synapse_max_upload_size_mb: "{{ matrix_synapse_max_upload_size_mb_raw }}" matrix_synapse_max_upload_size_mb: "{{ awx_synapse_max_upload_size_mb }}"
when: matrix_synapse_max_upload_size_mb_raw|int < 200 when: awx_synapse_max_upload_size_mb | int < 200
- name: Record Synapse variables locally on AWX - name: Record Synapse variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -32,13 +32,13 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_synapse_auto_join_rooms: .*$" regexp: "^matrix_synapse_auto_join_rooms: .*$"
replace: "matrix_synapse_auto_join_rooms: []" replace: "matrix_synapse_auto_join_rooms: []"
when: matrix_synapse_auto_join_rooms_raw|length == 0 when: awx_synapse_auto_join_rooms | length == 0
- name: If the raw inputs is not empty start constructing parsed auto_join_rooms list - name: If the raw inputs is not empty start constructing parsed auto_join_rooms list
set_fact: set_fact:
matrix_synapse_auto_join_rooms_array: |- awx_synapse_auto_join_rooms_array: |-
{{ matrix_synapse_auto_join_rooms_raw.splitlines() | to_json }} {{ awx_synapse_auto_join_rooms.splitlines() | to_json }}
when: matrix_synapse_auto_join_rooms_raw|length > 0 when: awx_synapse_auto_join_rooms|length > 0
- name: Record Synapse variable 'matrix_synapse_auto_join_rooms' locally on AWX, if it's not blank - name: Record Synapse variable 'matrix_synapse_auto_join_rooms' locally on AWX, if it's not blank
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -48,8 +48,8 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Synapse Settings Start' insertafter: '# Synapse Settings Start'
with_dict: with_dict:
"matrix_synapse_auto_join_rooms": "{{ matrix_synapse_auto_join_rooms_array }}" "matrix_synapse_auto_join_rooms": "{{ awx_synapse_auto_join_rooms_array }}"
when: matrix_synapse_auto_join_rooms_raw|length > 0 when: awx_synapse_auto_join_rooms|length > 0
- name: Record Synapse Shared Secret if it's defined - name: Record Synapse Shared Secret if it's defined
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -59,8 +59,8 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Synapse Settings Start' insertafter: '# Synapse Settings Start'
with_dict: with_dict:
'matrix_synapse_registration_shared_secret': '{{ ext_matrix_synapse_registration_shared_secret }}' 'matrix_synapse_registration_shared_secret': '{{ awx_matrix_synapse_registration_shared_secret }}'
when: ext_matrix_synapse_registration_shared_secret|length > 0 when: awx_matrix_synapse_registration_shared_secret | length > 0
- name: Record registations_require_3pid extra variable if true - name: Record registations_require_3pid extra variable if true
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -72,7 +72,7 @@
with_items: with_items:
- " registrations_require_3pid:" - " registrations_require_3pid:"
- " - email" - " - email"
when: ext_registrations_require_3pid|bool when: awx_registrations_require_3pid | bool
- name: Remove registrations_require_3pid extra variable if false - name: Remove registrations_require_3pid extra variable if false
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -85,7 +85,7 @@
with_items: with_items:
- " registrations_require_3pid:" - " registrations_require_3pid:"
- " - email" - " - email"
when: not ext_registrations_require_3pid|bool when: not awx_registrations_require_3pid | bool
- name: Remove URL Languages - name: Remove URL Languages
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -97,21 +97,21 @@
- name: Set URL languages default if raw inputs empty - name: Set URL languages default if raw inputs empty
set_fact: set_fact:
ext_url_preview_accept_language_default: 'en' awx_url_preview_accept_language_default: 'en'
when: ext_url_preview_accept_language_raw|length == 0 when: awx_url_preview_accept_language | length == 0
- name: Set URL languages default if raw inputs not empty - name: Set URL languages default if raw inputs not empty
set_fact: set_fact:
ext_url_preview_accept_language_default: "{{ ext_url_preview_accept_language_raw }}" awx_url_preview_accept_language_default: "{{ awx_url_preview_accept_language }}"
when: ext_url_preview_accept_language_raw|length > 0 when: awx_url_preview_accept_language|length > 0
- name: Set URL languages if raw inputs empty - name: Set URL languages if raw inputs empty
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
lineinfile: lineinfile:
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
insertafter: '^ url_preview_accept_language:' insertafter: '^ url_preview_accept_language:'
line: " - {{ ext_url_preview_accept_language_default }}" line: " - {{ awx_url_preview_accept_language_default }}"
when: ext_url_preview_accept_language_raw|length == 0 when: awx_url_preview_accept_language|length == 0
- name: Set URL languages if raw inputs not empty - name: Set URL languages if raw inputs not empty
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -119,8 +119,8 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
insertafter: '^ url_preview_accept_language:' insertafter: '^ url_preview_accept_language:'
line: " - {{ item }}" line: " - {{ item }}"
with_items: "{{ ext_url_preview_accept_language_raw.splitlines() }}" with_items: "{{ awx_url_preview_accept_language.splitlines() }}"
when: ext_url_preview_accept_language_raw|length > 0 when: awx_url_preview_accept_language | length > 0
- name: Remove Federation Whitelisting 1 - name: Remove Federation Whitelisting 1
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -143,7 +143,7 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
insertafter: '^matrix_synapse_configuration_extension_yaml: \|' insertafter: '^matrix_synapse_configuration_extension_yaml: \|'
line: " federation_domain_whitelist:" line: " federation_domain_whitelist:"
when: ext_federation_whitelist_raw|length > 0 when: awx_federation_whitelist | length > 0
- name: Set Federation Whitelisting 2 - name: Set Federation Whitelisting 2
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -151,16 +151,16 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
insertafter: '^ federation_domain_whitelist:' insertafter: '^ federation_domain_whitelist:'
line: " - {{ item }}" line: " - {{ item }}"
with_items: "{{ ext_federation_whitelist_raw.splitlines() }}" with_items: "{{ awx_federation_whitelist.splitlines() }}"
when: ext_federation_whitelist_raw|length > 0 when: awx_federation_whitelist | length > 0
- name: Set ext_recaptcha_public_key to a 'public-key' if undefined - name: Set awx_recaptcha_public_key to a 'public-key' if undefined
set_fact: ext_recaptcha_public_key="public-key" set_fact: awx_recaptcha_public_key="public-key"
when: (ext_recaptcha_public_key is not defined) or (ext_recaptcha_public_key|length == 0) when: (awx_recaptcha_public_key is not defined) or (awx_recaptcha_public_key|length == 0)
- name: Set ext_recaptcha_private_key to a 'private-key' if undefined - name: Set awx_recaptcha_private_key to a 'private-key' if undefined
set_fact: ext_recaptcha_private_key="private-key" set_fact: awx_recaptcha_private_key="private-key"
when: (ext_recaptcha_private_key is not defined) or (ext_recaptcha_private_key|length == 0) when: (awx_recaptcha_private_key is not defined) or (awx_recaptcha_private_key|length == 0)
- name: Record Synapse Extension variables locally on AWX - name: Record Synapse Extension variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -170,9 +170,9 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertbefore: '# Synapse Extension End' insertbefore: '# Synapse Extension End'
with_dict: with_dict:
' enable_registration_captcha': '{{ ext_enable_registration_captcha }}' ' enable_registration_captcha': '{{ awx_enable_registration_captcha }}'
' recaptcha_public_key': '{{ ext_recaptcha_public_key }}' ' recaptcha_public_key': '{{ awx_recaptcha_public_key }}'
' recaptcha_private_key': '{{ ext_recaptcha_private_key }}' ' recaptcha_private_key': '{{ awx_recaptcha_private_key }}'
- name: Record Synapse Custom variables locally on AWX - name: Record Synapse Custom variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -180,13 +180,13 @@
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:" regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Custom Settings Start' insertbefore: '# Synapse Settings End'
with_dict: with_dict:
'ext_federation_whitelist_raw': '{{ ext_federation_whitelist_raw.splitlines() | to_json }}' 'awx_federation_whitelist': '{{ awx_federation_whitelist.splitlines() | to_json }}'
'ext_url_preview_accept_language_default': '{{ ext_url_preview_accept_language_default.splitlines() | to_json }}' 'awx_url_preview_accept_language_default': '{{ awx_url_preview_accept_language_default.splitlines() | to_json }}'
'ext_enable_registration_captcha': '{{ ext_enable_registration_captcha }}' 'awx_enable_registration_captcha': '{{ awx_enable_registration_captcha }}'
'ext_recaptcha_public_key': '"{{ ext_recaptcha_public_key }}"' 'awx_recaptcha_public_key': '"{{ awx_recaptcha_public_key }}"'
'ext_recaptcha_private_key': '"{{ ext_recaptcha_private_key }}"' 'awx_recaptcha_private_key': '"{{ awx_recaptcha_private_key }}"'
- name: Save new 'Configure Synapse' survey.json to the AWX tower, template - name: Save new 'Configure Synapse' survey.json to the AWX tower, template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -1,3 +1,4 @@
---
- name: Record Synapse Admin variables locally on AWX - name: Record Synapse Admin variables locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1

View File

@ -2,9 +2,9 @@
- name: Create user account @janitor - name: Create user account @janitor
command: | command: |
/usr/local/bin/matrix-synapse-register-user janitor {{ matrix_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 matrix_awx_janitor_user_created|bool when: not awx_janitor_user_created|bool
no_log: True no_log: True
- name: Update AWX janitor user created variable - name: Update AWX janitor user created variable
@ -15,14 +15,14 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: 'AWX Settings' insertafter: 'AWX Settings'
with_dict: with_dict:
'matrix_awx_janitor_user_created': 'true' 'awx_janitor_user_created': 'true'
when: not matrix_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 {{ matrix_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 matrix_awx_dimension_user_created|bool when: not awx_dimension_user_created|bool
no_log: True no_log: True
- name: Update AWX dimension user created variable - name: Update AWX dimension user created variable
@ -33,14 +33,14 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: 'AWX Settings' insertafter: 'AWX Settings'
with_dict: with_dict:
'matrix_awx_dimension_user_created': 'true' 'awx_dimension_user_created': 'true'
when: not matrix_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 {{ matrix_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 matrix_awx_mjolnir_user_created|bool when: not awx_mjolnir_user_created|bool
no_log: True no_log: True
- name: Update AWX dimension user created variable - name: Update AWX dimension user created variable
@ -51,8 +51,8 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: 'AWX Settings' insertafter: 'AWX Settings'
with_dict: with_dict:
'matrix_awx_mjolnir_user_created': 'true' 'awx_mjolnir_user_created': 'true'
when: not matrix_awx_mjolnir_user_created|bool when: not awx_mjolnir_user_created|bool
- name: Ensure /chroot/website location has correct permissions - name: Ensure /chroot/website location has correct permissions
file: file:
@ -61,4 +61,4 @@
owner: matrix owner: matrix
group: matrix group: matrix
mode: '0770' mode: '0770'
when: customise_base_domain_website is defined when: awx_customise_base_domain_website is defined