From dd6e6435817a6a5f9978a04910064f40e39fc6a6 Mon Sep 17 00:00:00 2001 From: Michael Collins Date: Sun, 10 Oct 2021 14:10:06 +0800 Subject: [PATCH] first round of variable name changes --- .../surveys/configure_corporal.json.j2 | 20 ++++---- .../surveys/configure_dimension.json.j2 | 4 +- .../surveys/configure_synapse.json.j2 | 12 ++--- .../tasks/set_variables_corporal.yml | 26 +++++------ .../tasks/set_variables_dimension.yml | 14 +++--- .../matrix-awx/tasks/set_variables_ma1sd.yml | 2 +- .../tasks/set_variables_synapse.yml | 46 +++++++++---------- 7 files changed, 62 insertions(+), 62 deletions(-) diff --git a/roles/matrix-awx/surveys/configure_corporal.json.j2 b/roles/matrix-awx/surveys/configure_corporal.json.j2 index 14e417ce..7b782fd0 100755 --- a/roles/matrix-awx/surveys/configure_corporal.json.j2 +++ b/roles/matrix-awx/surveys/configure_corporal.json.j2 @@ -20,10 +20,10 @@ "required": true, "min": 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)", "new_question": true, - "variable": "matrix_corporal_policy_provider_mode", + "variable": "awx_corporal_policy_provider_mode", "type": "multiplechoice" }, { @@ -34,7 +34,7 @@ "max": 65536, "default": "", "new_question": true, - "variable": "matrix_corporal_simple_static_config", + "variable": "awx_corporal_simple_static_config", "type": "textarea" }, { @@ -43,9 +43,9 @@ "required": false, "min": 0, "max": 4096, - "default": "{{ matrix_corporal_pull_mode_uri }}", + "default": "{{ awx_corporal_pull_mode_uri }}", "new_question": true, - "variable": "matrix_corporal_pull_mode_uri", + "variable": "awx_corporal_pull_mode_uri", "type": "text" }, { @@ -54,10 +54,10 @@ "required": false, "min": 0, "max": 256, - "default": "{{ matrix_corporal_pull_mode_token }}", + "default": "{{ awx_corporal_pull_mode_token }}", "choices": "", "new_question": true, - "variable": "matrix_corporal_pull_mode_token", + "variable": "awx_corporal_pull_mode_token", "type": "password" }, { @@ -66,10 +66,10 @@ "required": false, "min": 0, "max": 256, - "default": "{{ matrix_corporal_http_api_auth_token }}", + "default": "{{ awx_corporal_http_api_auth_token }}", "choices": "", "new_question": true, - "variable": "matrix_corporal_http_api_auth_token", + "variable": "awx_corporal_http_api_auth_token", "type": "password" }, { @@ -78,7 +78,7 @@ "required": false, "min": null, "max": null, - "default": "{{ matrix_corporal_raise_ratelimits }}", + "default": "{{ awx_corporal_raise_ratelimits }}", "choices": "Normal\nRaised", "new_question": true, "variable": "matrix_corporal_raise_ratelimits", diff --git a/roles/matrix-awx/surveys/configure_dimension.json.j2 b/roles/matrix-awx/surveys/configure_dimension.json.j2 index 961d137c..5f79cfd0 100644 --- a/roles/matrix-awx/surveys/configure_dimension.json.j2 +++ b/roles/matrix-awx/surveys/configure_dimension.json.j2 @@ -20,10 +20,10 @@ "required": false, "min": 0, "max": 65536, - "default": {{ awx_dimension_users_raw_final | to_json }}, + "default": {{ awx_dimension_users_final | to_json }}, "choices": "", "new_question": true, - "variable": "awx_dimension_users_raw", + "variable": "awx_dimension_users", "type": "textarea" } ] diff --git a/roles/matrix-awx/surveys/configure_synapse.json.j2 b/roles/matrix-awx/surveys/configure_synapse.json.j2 index 029b1fbe..7a4e711d 100755 --- a/roles/matrix-awx/surveys/configure_synapse.json.j2 +++ b/roles/matrix-awx/surveys/configure_synapse.json.j2 @@ -119,7 +119,7 @@ "default": "{{ matrix_synapse_max_upload_size_mb }}", "choices": "", "new_question": true, - "variable": "matrix_synapse_max_upload_size_mb_raw", + "variable": "awx_synapse_max_upload_size_mb", "type": "text" }, { @@ -131,7 +131,7 @@ "default": {{ awx_url_preview_accept_language_default | to_json }}, "choices": "", "new_question": true, - "variable": "awx_url_preview_accept_language_raw", + "variable": "awx_url_preview_accept_language", "type": "textarea" }, { @@ -140,10 +140,10 @@ "required": false, "min": 0, "max": 65536, - "default": {{ awx_federation_whitelist_raw | to_json }}, + "default": {{ awx_federation_whitelist | to_json }}, "choices": "", "new_question": true, - "variable": "awx_federation_whitelist_raw", + "variable": "awx_federation_whitelist", "type": "textarea" }, { @@ -152,10 +152,10 @@ "required": false, "min": 0, "max": 65536, - "default": {{ matrix_synapse_auto_join_rooms_raw | to_json }}, + "default": {{ awx_synapse_auto_join_rooms | to_json }}, "choices": "", "new_question": true, - "variable": "matrix_synapse_auto_join_rooms_raw", + "variable": "awx_synapse_auto_join_rooms", "type": "textarea" }, { diff --git a/roles/matrix-awx/tasks/set_variables_corporal.yml b/roles/matrix-awx/tasks/set_variables_corporal.yml index c27ff485..3558f717 100755 --- a/roles/matrix-awx/tasks/set_variables_corporal.yml +++ b/roles/matrix-awx/tasks/set_variables_corporal.yml @@ -63,7 +63,7 @@ insertafter: '# Corporal Settings Start' with_dict: '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 delegate_to: 127.0.0.1 @@ -74,7 +74,7 @@ insertafter: '# Corporal Settings Start' with_dict: '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 delegate_to: 127.0.0.1 @@ -84,8 +84,8 @@ line: "{{ item.key }}: {{ item.value }}" insertafter: '# Corporal Settings Start' with_dict: - 'matrix_corporal_http_api_auth_token': '{{ matrix_corporal_http_api_auth_token }}' - when: matrix_corporal_http_api_auth_token|length > 0 + 'awx_corporal_http_api_auth_token': '{{ awx_corporal_http_api_auth_token }}' + when: awx_corporal_http_api_auth_token|length > 0 - name: Record 'Simple Static File' configuration variables in matrix_vars.yml delegate_to: 127.0.0.1 @@ -98,7 +98,7 @@ "Type": "static_file", "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 file: @@ -142,12 +142,12 @@ - name: Record 'Simple Static File' configuration content in corporal-policy.json copy: - content: "{{ matrix_corporal_simple_static_config | string }}" + content: "{{ awx_corporal_simple_static_config | string }}" dest: "/matrix/corporal/config/corporal-policy.json" owner: matrix group: matrix 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 delegate_to: 127.0.0.1 @@ -158,13 +158,13 @@ matrix_corporal_policy_provider_config: | { "Type": "http", - "Uri": "{{ matrix_corporal_pull_mode_uri }}", - "AuthorizationBearerToken": "{{ matrix_corporal_pull_mode_token }}", + "Uri": "{{ awx_corporal_pull_mode_uri }}", + "AuthorizationBearerToken": "{{ awx_corporal_pull_mode_token }}", "CachePath": "/var/cache/matrix-corporal/last-policy.json", "ReloadIntervalSeconds": 1800, "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 delegate_to: 127.0.0.1 @@ -177,7 +177,7 @@ "Type": "last_seen_store_policy", "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' delegate_to: 127.0.0.1 @@ -185,7 +185,7 @@ 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' 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' delegate_to: 127.0.0.1 @@ -193,7 +193,7 @@ 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' 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 delegate_to: 127.0.0.1 diff --git a/roles/matrix-awx/tasks/set_variables_dimension.yml b/roles/matrix-awx/tasks/set_variables_dimension.yml index c3273761..65400bbc 100644 --- a/roles/matrix-awx/tasks/set_variables_dimension.yml +++ b/roles/matrix-awx/tasks/set_variables_dimension.yml @@ -30,13 +30,13 @@ - name: Set final users list if users are defined set_fact: - awx_dimension_users_raw_final: "{{ awx_dimension_users_raw }}" - when: awx_dimension_users_raw|length > 0 + awx_dimension_users_final: "{{ awx_dimension_users }}" + when: awx_dimension_users|length > 0 - name: Set final users list if no users are defined set_fact: - awx_dimension_users_raw_final: '@dimension:{{ matrix_domain }}' - when: awx_dimension_users_raw|length == 0 + awx_dimension_users_final: '@dimension:{{ matrix_domain }}' + when: awx_dimension_users|length == 0 - name: Remove Dimension Users delegate_to: 127.0.0.1 @@ -59,7 +59,7 @@ path: '{{ awx_cached_matrix_vars }}' insertafter: '^matrix_dimension_admins:' line: ' - "{{ item }}"' - with_items: "{{ awx_dimension_users_raw_final.splitlines() }}" + with_items: "{{ awx_dimension_users_final.splitlines() }}" - name: Record Dimension Custom variables locally on AWX delegate_to: 127.0.0.1 @@ -67,9 +67,9 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^#? *{{ item.key | regex_escape() }}:" line: "{{ item.key }}: {{ item.value }}" - insertafter: '# Custom Settings Start' + insertbefore: '# Dimension Settings End' with_dict: - 'awx_dimension_users_raw': '{{ awx_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 delegate_to: 127.0.0.1 diff --git a/roles/matrix-awx/tasks/set_variables_ma1sd.yml b/roles/matrix-awx/tasks/set_variables_ma1sd.yml index 2501d191..0f4234f1 100755 --- a/roles/matrix-awx/tasks/set_variables_ma1sd.yml +++ b/roles/matrix-awx/tasks/set_variables_ma1sd.yml @@ -62,7 +62,7 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^#? *{{ item.key | regex_escape() }}:" line: "{{ item.key }}: {{ item.value }}" - insertbefore: '# Custom Settings Start' + insertbefore: '# ma1sd Settings End' with_dict: 'awx_matrix_ma1sd_auth_store': '{{ awx_matrix_ma1sd_auth_store }}' 'awx_matrix_ma1sd_configuration_extension_yaml': '{{ awx_matrix_ma1sd_configuration_extension_yaml.splitlines() | to_json }}' diff --git a/roles/matrix-awx/tasks/set_variables_synapse.yml b/roles/matrix-awx/tasks/set_variables_synapse.yml index 7ec51069..df6b2798 100755 --- a/roles/matrix-awx/tasks/set_variables_synapse.yml +++ b/roles/matrix-awx/tasks/set_variables_synapse.yml @@ -2,12 +2,12 @@ - name: Limit max upload size to 200MB part 1 set_fact: 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 set_fact: - matrix_synapse_max_upload_size_mb: "{{ matrix_synapse_max_upload_size_mb_raw }}" - when: matrix_synapse_max_upload_size_mb_raw|int < 200 + matrix_synapse_max_upload_size_mb: "{{ awx_synapse_max_upload_size_mb }}" + when: awx_synapse_max_upload_size_mb | int < 200 - name: Record Synapse variables locally on AWX delegate_to: 127.0.0.1 @@ -32,13 +32,13 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^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 set_fact: - matrix_synapse_auto_join_rooms_array: |- - {{ matrix_synapse_auto_join_rooms_raw.splitlines() | to_json }} - when: matrix_synapse_auto_join_rooms_raw|length > 0 + awx_synapse_auto_join_rooms_array: |- + {{ awx_synapse_auto_join_rooms.splitlines() | to_json }} + 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 delegate_to: 127.0.0.1 @@ -48,8 +48,8 @@ line: "{{ item.key }}: {{ item.value }}" insertafter: '# Synapse Settings Start' with_dict: - "matrix_synapse_auto_join_rooms": "{{ matrix_synapse_auto_join_rooms_array }}" - when: matrix_synapse_auto_join_rooms_raw|length > 0 + "matrix_synapse_auto_join_rooms": "{{ awx_synapse_auto_join_rooms_array }}" + when: awx_synapse_auto_join_rooms|length > 0 - name: Record Synapse Shared Secret if it's defined delegate_to: 127.0.0.1 @@ -60,7 +60,7 @@ insertafter: '# Synapse Settings Start' with_dict: 'matrix_synapse_registration_shared_secret': '{{ awx_matrix_synapse_registration_shared_secret }}' - when: awx_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 delegate_to: 127.0.0.1 @@ -72,7 +72,7 @@ with_items: - " registrations_require_3pid:" - " - email" - when: awx_registrations_require_3pid|bool + when: awx_registrations_require_3pid | bool - name: Remove registrations_require_3pid extra variable if false delegate_to: 127.0.0.1 @@ -85,7 +85,7 @@ with_items: - " registrations_require_3pid:" - " - email" - when: not awx_registrations_require_3pid|bool + when: not awx_registrations_require_3pid | bool - name: Remove URL Languages delegate_to: 127.0.0.1 @@ -98,12 +98,12 @@ - name: Set URL languages default if raw inputs empty set_fact: awx_url_preview_accept_language_default: 'en' - when: awx_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 set_fact: - awx_url_preview_accept_language_default: "{{ awx_url_preview_accept_language_raw }}" - when: awx_url_preview_accept_language_raw|length > 0 + awx_url_preview_accept_language_default: "{{ awx_url_preview_accept_language }}" + when: awx_url_preview_accept_language|length > 0 - name: Set URL languages if raw inputs empty delegate_to: 127.0.0.1 @@ -111,7 +111,7 @@ path: '{{ awx_cached_matrix_vars }}' insertafter: '^ url_preview_accept_language:' line: " - {{ awx_url_preview_accept_language_default }}" - when: awx_url_preview_accept_language_raw|length == 0 + when: awx_url_preview_accept_language|length == 0 - name: Set URL languages if raw inputs not empty delegate_to: 127.0.0.1 @@ -119,8 +119,8 @@ path: '{{ awx_cached_matrix_vars }}' insertafter: '^ url_preview_accept_language:' line: " - {{ item }}" - with_items: "{{ awx_url_preview_accept_language_raw.splitlines() }}" - when: awx_url_preview_accept_language_raw|length > 0 + with_items: "{{ awx_url_preview_accept_language.splitlines() }}" + when: awx_url_preview_accept_language | length > 0 - name: Remove Federation Whitelisting 1 delegate_to: 127.0.0.1 @@ -143,7 +143,7 @@ path: '{{ awx_cached_matrix_vars }}' insertafter: '^matrix_synapse_configuration_extension_yaml: \|' line: " federation_domain_whitelist:" - when: awx_federation_whitelist_raw|length > 0 + when: awx_federation_whitelist | length > 0 - name: Set Federation Whitelisting 2 delegate_to: 127.0.0.1 @@ -151,8 +151,8 @@ path: '{{ awx_cached_matrix_vars }}' insertafter: '^ federation_domain_whitelist:' line: " - {{ item }}" - with_items: "{{ awx_federation_whitelist_raw.splitlines() }}" - when: awx_federation_whitelist_raw|length > 0 + with_items: "{{ awx_federation_whitelist.splitlines() }}" + when: awx_federation_whitelist | length > 0 - name: Set awx_recaptcha_public_key to a 'public-key' if undefined set_fact: awx_recaptcha_public_key="public-key" @@ -180,9 +180,9 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^#? *{{ item.key | regex_escape() }}:" line: "{{ item.key }}: {{ item.value }}" - insertafter: '# Custom Settings Start' + insertbefore: '# Synapse Settings End' with_dict: - 'awx_federation_whitelist_raw': '{{ awx_federation_whitelist_raw.splitlines() | to_json }}' + 'awx_federation_whitelist': '{{ awx_federation_whitelist.splitlines() | to_json }}' 'awx_url_preview_accept_language_default': '{{ awx_url_preview_accept_language_default.splitlines() | to_json }}' 'awx_enable_registration_captcha': '{{ awx_enable_registration_captcha }}' 'awx_recaptcha_public_key': '"{{ awx_recaptcha_public_key }}"'