diff --git a/create-database.yml b/create-database.yml index 8a4c467..3c2d554 100644 --- a/create-database.yml +++ b/create-database.yml @@ -17,7 +17,7 @@ # tenant_id := (unique key for the tenant, e.g. customer) # cluster_name := (business name for the cluster, e.g. product, department ) # cluster_size := (WIP node count for the cluster) (Currently max is 2 master/slave) -# cluster_services := (services to setup, e.g. ['connect', 'wordpress', ...]) +# cluster_services_str := (services to setup, e.g. 'connect,wordpress') # smardigo message callback # scope_id := (scope id of the management process) # process_instance_id := (process instance id of the management process) @@ -38,6 +38,8 @@ - ansible_version.major >= 2 - ansible_version.minor >= 10 msg: "The ansible version has to be at least ({{ ansible_version.full }})" + - set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" tasks: - name: Add postgres servers to hosts if necessary @@ -46,7 +48,6 @@ groups: - "stage_{{ stage }}" - "{{ item }}" - cluster_service: "{{ item }}" changed_when: False with_items: "{{ cluster_services }}" when: item in ['connect', 'management_connect', 'keycloak', 'webdav'] @@ -57,7 +58,6 @@ groups: - "stage_{{ stage }}" - "{{ item }}" - cluster_service: "{{ item }}" changed_when: False with_items: "{{ cluster_services }}" when: item in ['connect_wordpress'] @@ -73,6 +73,9 @@ pre_tasks: - name: "Import autodiscover pre-tasks" include_tasks: tasks/autodiscover_pre_tasks.yml + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" roles: - role: connect-postgres diff --git a/create-realm.yml b/create-realm.yml index eb458dd..0ebccce 100644 --- a/create-realm.yml +++ b/create-realm.yml @@ -1,12 +1,15 @@ --- +# creates realm/clients on shared keycloak service +# - connect-realm: configuration to use with connect/wordpress + # Parameters: # playbook inventory # stage := the type of the stage (e.g. dev, int, qa, prod) # tenant_id := (unique key for the tenant, e.g. customer) # cluster_name := (business name for the cluster, e.g. product, department ) # cluster_size := (WIP node count for the cluster) -# cluster_services := (services to setup, e.g. ['connect', 'wordpress', ...]) +# cluster_services_str := (services to setup, e.g. 'connect,wordpress') # playbook roles (keycloak / oidc) # current_realm_name := # current_realm_display_name := @@ -30,14 +33,14 @@ - ansible_version.major >= 2 - ansible_version.minor >= 10 msg: "The ansible version has to be at least ({{ ansible_version.full }})" + - set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" tasks: - name: Add hosts add_host: name: "{{ stage }}-{{ tenant_id }}-{{ cluster_name }}-{{ '%02d' | format(item|int) }}" - groups: - - "stage_{{ stage }}" - - "{{ cluster_service }}" + groups: "{{ ['stage_' + stage ] + cluster_services }}" with_sequence: start=1 end={{ cluster_size | default(1) }} changed_when: False @@ -57,9 +60,13 @@ pre_tasks: - name: "Import autodiscover pre-tasks" include_tasks: tasks/autodiscover_pre_tasks.yml + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" roles: - role: connect-realm + when: '"connect" in cluster_services' ############################################################# # Sending smardigo management message to process diff --git a/create-server.yml b/create-server.yml index d2a07aa..d6454b4 100644 --- a/create-server.yml +++ b/create-server.yml @@ -106,7 +106,6 @@ ] state: 'absent' when: ansible_distribution == "Ubuntu" - - name: "Import autodiscover pre-tasks" include_tasks: tasks/autodiscover_pre_tasks.yml diff --git a/create-service.yml b/create-service.yml index f103949..b72e303 100644 --- a/create-service.yml +++ b/create-service.yml @@ -6,7 +6,7 @@ # tenant_id := (unique key for the tenant, e.g. customer) # cluster_name := (business name for the cluster, e.g. product, department ) # cluster_size := (WIP node count for the cluster) -# cluster_services := (services to setup, e.g. ['connect', 'wordpress', ...]) +# cluster_services_str := (services to setup, e.g. 'connect,wordpress') # smardigo message callback # scope_id := (scope id of the management process) # process_instance_id := (process instance id of the management process) @@ -27,6 +27,9 @@ - ansible_version.major >= 2 - ansible_version.minor >= 10 msg: "The ansible version has to be at least ({{ ansible_version.full }})" + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" tasks: - name: Add hosts @@ -64,8 +67,11 @@ remote_user: root pre_tasks: - - name: "Import autodiscover tasks" - include_tasks: "tasks/autodiscover_pre_tasks.yml" + - name: "Import autodiscover pre-tasks" + include_tasks: tasks/autodiscover_pre_tasks.yml + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" roles: - role: connect diff --git a/import-database.yml b/import-database.yml index 1e6d55d..a7136d3 100644 --- a/import-database.yml +++ b/import-database.yml @@ -6,8 +6,8 @@ # tenant_id := (unique key for the tenant, e.g. customer) # cluster_name := (business name for the cluster, e.g. product, department ) # cluster_size := (WIP node count for the cluster) (Currently max is 2 master/slave) -# cluster_services := (services to setup, e.g. ['connect', 'wordpress', ...]) -# uploaded_file := the dump file to import, has to be on the database server under /tmp (e.g. wordpress_portal.sql) +# cluster_services_str := (services to setup, e.g. 'connect,wordpress') +# database_backup_file := the dump file to import, has to be on the database server under /tmp (e.g. wordpress_portal.sql) # target_database := (optional) the database to import into ( see {{ connect_wordpress_maria_database }}) # smardigo message callback # scope_id := (scope id of the management process) @@ -29,6 +29,9 @@ - ansible_version.major >= 2 - ansible_version.minor >= 10 msg: "The ansible version has to be at least ({{ ansible_version.full }})" + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" tasks: - name: Add hosts @@ -53,19 +56,22 @@ pre_tasks: - name: "Import autodiscover pre-tasks" include_tasks: tasks/autodiscover_pre_tasks.yml + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" roles: - role: import-maria-database when: - "'connect_wordpress' in group_names" - "target_database is defined" - - "uploaded_file is defined" + - "database_backup_file is defined" - role: import-maria-database vars: target_database: "{{ connect_wordpress_maria_database }}" when: - "'connect_wordpress' in group_names" - - "uploaded_file is defined" + - "database_backup_file is defined" ############################################################# # Sending smardigo management message to process diff --git a/info.yml b/info.yml index 5d0b530..299b3be 100644 --- a/info.yml +++ b/info.yml @@ -16,8 +16,6 @@ - name: "Import autodiscover pre-tasks" include_tasks: tasks/autodiscover_pre_tasks.yml - tags: - - always - name: "Variable " debug: diff --git a/roles/awx/tasks/awx-config-cleanup.yml b/roles/awx/tasks/awx-config-cleanup.yml new file mode 100644 index 0000000..4774116 --- /dev/null +++ b/roles/awx/tasks/awx-config-cleanup.yml @@ -0,0 +1,41 @@ +--- + +- name: "Fetch all {{ awx_rest_api_type }} ids" + no_log: true + uri: + url: "{{ awx_base_url }}/api/v2/{{ awx_rest_api_type }}/" + method: GET + user: "{{ awx_rest_api_access_user }}" + password: "{{ awx_rest_api_access_pw }}" + headers: + Content-Type: "application/json" + Accept: "application/json" + body_format: "json" + force_basic_auth: true + validate_certs: false + status_code: 200 + register: response + tags: + - awx_config + +- name: "Remove all {{ awx_rest_api_type }}" + no_log: true + uri: + url: "{{ awx_base_url }}{{ item.url }}" + method: DELETE + user: "{{ awx_rest_api_access_user }}" + password: "{{ awx_rest_api_access_pw }}" + headers: + Content-Type: "application/json" + Accept: "application/json" + body_format: "json" + force_basic_auth: true + validate_certs: false + status_code: 204 + tags: + - awx_config + loop: "{{ response.json.results }}" + loop_control: + label: "{{ item.url }}" +# Ignore errors due to some elements can't be deleted + ignore_errors: true diff --git a/roles/awx/tasks/awx-config.yml b/roles/awx/tasks/awx-config.yml index 79b82ef..726b58b 100644 --- a/roles/awx/tasks/awx-config.yml +++ b/roles/awx/tasks/awx-config.yml @@ -1,5 +1,13 @@ --- +- name: "Remove all " + include_tasks: awx-config-cleanup.yml + vars: + awx_rest_api_type: job_templates + when: (awx_hetzner_ansible_project_id is not defined) + tags: + - awx_config + - name: "Printing..." debug: msg: "{{ ansible_ssh_key_private }}" @@ -80,6 +88,13 @@ tags: - awx_config +- name: "Remove all " + include_tasks: awx-config-cleanup.yml + vars: + awx_rest_api_type: credentials + tags: + - awx_config + - name: "Search credential type id for " include_tasks: awx-config-get-typ-id.yml vars: @@ -319,6 +334,13 @@ tags: - awx_config +- name: "Remove all " + include_tasks: awx-config-cleanup.yml + vars: + awx_rest_api_type: execution_environments + tags: + - awx_config + - name: "Search execution environment for " include_tasks: awx-config-get-typ-id.yml vars: @@ -380,6 +402,13 @@ tags: - awx_config +- name: "Remove all " + include_tasks: awx-config-cleanup.yml + vars: + awx_rest_api_type: inventories + tags: + - awx_config + - name: "Search inventory " include_tasks: awx-config-get-typ-id.yml vars: @@ -476,6 +505,13 @@ tags: - awx_config +- name: "Remove all " + include_tasks: awx-config-cleanup.yml + vars: + awx_rest_api_type: projects + tags: + - awx_config + - name: "Search project " include_tasks: awx-config-get-typ-id.yml vars: @@ -536,41 +572,12 @@ tags: - awx_config -- name: "Fetch all job_template ids" - uri: - url: "{{ awx_base_url }}/api/v2/job_templates/" - method: GET - user: "{{ awx_rest_api_access_user }}" - password: "{{ awx_rest_api_access_pw }}" - headers: - Content-Type: "application/json" - Accept: "application/json" - body_format: "json" - force_basic_auth: true - validate_certs: false - status_code: 200 - register: response - tags: - - awx_config - -- name: "Remove all job templates" - uri: - url: "{{ awx_base_url }}{{ item.url }}" - method: DELETE - user: "{{ awx_rest_api_access_user }}" - password: "{{ awx_rest_api_access_pw }}" - headers: - Content-Type: "application/json" - Accept: "application/json" - body_format: "json" - force_basic_auth: true - validate_certs: false - status_code: 204 +- name: "Remove all " + include_tasks: awx-config-cleanup.yml + vars: + awx_rest_api_type: job_templates tags: - awx_config - loop: "{{ response.json.results }}" - loop_control: - label: "{{ item.url }}" - name: "Create job templates" include_tasks: awx-config-job-template.yml diff --git a/roles/import-maria-database/tasks/main.yml b/roles/import-maria-database/tasks/main.yml index 860301e..6ccdb0d 100644 --- a/roles/import-maria-database/tasks/main.yml +++ b/roles/import-maria-database/tasks/main.yml @@ -9,10 +9,10 @@ config_file: "/etc/mysql/mariadb.conf.d/50-client.cnf" login_password: "{{ mysql_root_password }}" -- name: "Import database from {{ upload_directory }}/{{ uploaded_file }} to {{ target_database }}" +- name: "Import database from {{ upload_directory }}/{{ database_backup_file }} to {{ target_database }}" community.mysql.mysql_db: name: "{{ target_database }}" state: import - target: "/tmp/{{ uploaded_file }}" + target: "/tmp/{{ database_backup_file }}" config_file: "/etc/mysql/mariadb.conf.d/50-client.cnf" login_password: "{{ mysql_root_password }}" diff --git a/smardigo/provisioning/form/simple-connect.json b/smardigo/provisioning/form/simple-connect.json index 838d37d..f717c51 100644 --- a/smardigo/provisioning/form/simple-connect.json +++ b/smardigo/provisioning/form/simple-connect.json @@ -3,6 +3,196 @@ "configKey" : "simple-connect", "page" : 0, "components" : [ { + "label" : "HTML", + "labelPosition" : "left-left", + "className" : "", + "attrs" : [ { + "attr" : "", + "value" : "" + } ], + "content" : "
\n \n
\n", + "refreshOnChange" : true, + "mask" : false, + "tableView" : true, + "alwaysEnabled" : false, + "type" : "htmlelement", + "input" : false, + "key" : "html", + "validate" : { + "customMessage" : "", + "json" : "" + }, + "conditional" : { + "show" : "", + "when" : "", + "json" : "" + }, + "tabs" : null, + "encrypted" : false, + "properties" : { }, + "tags" : null, + "customConditional" : "", + "logic" : [ ], + "refreshOn" : "data", + "reorder" : false + }, { + "label" : "progress_current", + "labelPosition" : "left-left", + "hidden" : true, + "mask" : false, + "tableView" : true, + "alwaysEnabled" : false, + "type" : "number", + "input" : true, + "key" : "progress_current", + "validate" : { + "customMessage" : "", + "json" : "" + }, + "conditional" : { + "show" : "", + "when" : "", + "json" : "" + }, + "tabs" : null, + "delimiter" : false, + "requireDecimal" : false, + "encrypted" : false, + "properties" : { }, + "tags" : [ ], + "decimalLimit" : null, + "customConditional" : "", + "logic" : [ ], + "reorder" : false + }, { + "label" : "progress_max", + "labelPosition" : "left-left", + "hidden" : true, + "mask" : false, + "tableView" : true, + "alwaysEnabled" : false, + "type" : "number", + "input" : true, + "key" : "progress_max", + "validate" : { + "customMessage" : "", + "json" : "" + }, + "conditional" : { + "show" : "", + "when" : "", + "json" : "" + }, + "tabs" : null, + "delimiter" : false, + "requireDecimal" : false, + "encrypted" : false, + "decimalLimit" : null, + "properties" : { }, + "tags" : [ ], + "customConditional" : "", + "logic" : [ ], + "reorder" : false + }, { + "label" : "HTML", + "labelPosition" : "left-left", + "className" : "", + "attrs" : [ { + "attr" : "", + "value" : "" + } ], + "content" : "
\n connect-admin:connect-admin\n
\n
\n \n {{ 'https://' + (!!(data.cluster)?data.cluster.stage:'cluster.stage') + '-' + (!!(data.tenant)?data.tenant.key:'tenant.key') + '-' + (!!(data.cluster)?data.cluster.name:'cluster.name') + '-01-connect.smardigo.digital' }}\n \n
", + "refreshOnChange" : true, + "mask" : false, + "tableView" : true, + "alwaysEnabled" : false, + "type" : "htmlelement", + "input" : false, + "key" : "html2", + "validate" : { + "customMessage" : "", + "json" : "" + }, + "conditional" : { + "show" : "", + "when" : "", + "json" : "" + }, + "tabs" : null, + "encrypted" : false, + "properties" : { }, + "tags" : null, + "customConditional" : "", + "logic" : [ ], + "refreshOn" : "data", + "reorder" : false + }, { + "label" : "HTML", + "labelPosition" : "left-left", + "className" : "", + "attrs" : [ { + "attr" : "", + "value" : "" + } ], + "content" : "\n
\n \n {{ 'https://' + (!!(data.cluster)?data.cluster.stage:'cluster.stage') + '-' + (!!(data.tenant)?data.tenant.key:'tenant.key') + '-' + (!!(data.cluster)?data.cluster.name:'cluster.name') + '-01-wordpress.smardigo.digital' }}\n \n
\n
\n wordpress-admin:wordpress-admin\n
\n
\n \n {{ 'https://' + (!!(data.cluster)?data.cluster.stage:'cluster.stage') + '-' + (!!(data.tenant)?data.tenant.key:'tenant.key') + '-' + (!!(data.cluster)?data.cluster.name:'cluster.name') + '-01-wordpress.smardigo.digital/wp-admin' }}\n \n
", + "refreshOnChange" : true, + "mask" : false, + "tableView" : true, + "alwaysEnabled" : false, + "type" : "htmlelement", + "input" : false, + "key" : "html4", + "validate" : { + "customMessage" : "", + "json" : "" + }, + "conditional" : { + "show" : "", + "when" : "", + "json" : "" + }, + "tabs" : null, + "encrypted" : false, + "properties" : { }, + "tags" : null, + "customConditional" : "show = data['connect-features'].includes(\"connect_wordpress\") ", + "logic" : [ ], + "refreshOn" : "data", + "reorder" : false + }, { + "label" : "HTML", + "labelPosition" : "left-left", + "className" : "", + "attrs" : [ { + "attr" : "", + "value" : "" + } ], + "content" : "
\n connect-realm-admin:connect-realm-admin\n
\n
\n \n {{ 'https://' + (!!(data.cluster)?data.cluster.stage:'cluster.stage') + '-keycloak-01.smardigo.digital/auth/admin/' + (!!(data.tenant)?data.tenant.key:'tenant.key') + '/console' }}\n \n
", + "refreshOnChange" : true, + "mask" : false, + "tableView" : true, + "alwaysEnabled" : false, + "type" : "htmlelement", + "input" : false, + "key" : "html3", + "validate" : { + "customMessage" : "", + "json" : "" + }, + "conditional" : { + "show" : "", + "when" : "", + "json" : "" + }, + "tabs" : null, + "encrypted" : false, + "properties" : { }, + "tags" : null, + "customConditional" : "", + "logic" : [ ], + "refreshOn" : "data", + "reorder" : false + }, { "label" : "Optionale Features", "mask" : false, "tableView" : true, @@ -13,16 +203,12 @@ "defaultValue" : [ ], "validate" : { "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false + "json" : "" }, "conditional" : { "show" : "", "when" : "", - "json" : "", - "eq" : "" + "json" : "" }, "data" : { "url" : "api/v1/scopes/{{ context.scopeId }}/processes/{{ context.processId }}/datasources/connect-features/query", @@ -36,45 +222,7 @@ "customConditional" : "", "logic" : [ ], "projection" : "key", - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "protected" : false, - "unique" : false, - "persistent" : true, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelPosition" : "top", - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "dataSrc" : "url", - "filter" : true, - "filterPlaceholder" : "Tippen um zu filtern.", - "labelAll" : "Alle Werte", - "labelSelected" : "Ausgewählte Werte", - "buttonSelectAll" : "Alle auswählen", - "buttonDeselectAll" : "Alle abwählen", - "selectAll" : false, - "id" : "ecfbj1k" + "reorder" : false }, { "label" : "Cluster", "mask" : false, @@ -85,16 +233,12 @@ "key" : "cluster", "validate" : { "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false + "json" : "" }, "conditional" : { "show" : "", "when" : "", - "json" : "", - "eq" : "" + "json" : "" }, "components" : [ { "label" : "Cluster", @@ -107,8 +251,7 @@ "conditional" : { "show" : "", "when" : "", - "json" : "", - "eq" : "" + "json" : "" }, "components" : [ { "label" : "Stage", @@ -130,16 +273,12 @@ "minLength" : null, "maxLength" : null, "minWords" : null, - "maxWords" : null, - "custom" : "", - "customPrivate" : false, - "pattern" : "" + "maxWords" : null }, "conditional" : { "show" : "", "when" : "", - "json" : "", - "eq" : "" + "json" : "" }, "tabs" : null, "inputFormat" : "plain", @@ -149,42 +288,9 @@ "customConditional" : "", "logic" : [ ], "widget" : { - "type" : "", - "format" : "yyyy-MM-dd hh:mm a", - "dateFormat" : "yyyy-MM-dd hh:mm a", - "saveAs" : "text" + "type" : "" }, - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "protected" : false, - "unique" : false, - "persistent" : true, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "mask" : false, - "inputType" : "text", - "inputMask" : "", - "id" : "e757btk" + "reorder" : false }, { "label" : "Name", "labelPosition" : "left-left", @@ -204,16 +310,12 @@ "minLength" : null, "maxLength" : null, "minWords" : null, - "maxWords" : null, - "custom" : "", - "customPrivate" : false, - "pattern" : "" + "maxWords" : null }, "conditional" : { "show" : "", "when" : "", - "json" : "", - "eq" : "" + "json" : "" }, "tabs" : null, "inputFormat" : "plain", @@ -223,43 +325,9 @@ "customConditional" : "", "logic" : [ ], "widget" : { - "type" : "", - "format" : "yyyy-MM-dd hh:mm a", - "dateFormat" : "yyyy-MM-dd hh:mm a", - "saveAs" : "text" + "type" : "" }, - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "protected" : false, - "unique" : false, - "persistent" : true, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "mask" : false, - "inputType" : "text", - "inputMask" : "", - "id" : "e31r2lu8" + "reorder" : false }, { "label" : "Size", "labelPosition" : "left-left", @@ -275,17 +343,12 @@ "json" : "", "required" : true, "min" : null, - "max" : null, - "custom" : "", - "customPrivate" : false, - "step" : "any", - "integer" : "" + "max" : null }, "conditional" : { "show" : "", "when" : "", - "json" : "", - "eq" : "" + "json" : "" }, "tabs" : null, "properties" : { }, @@ -296,36 +359,7 @@ "decimalLimit" : null, "customConditional" : "", "logic" : [ ], - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : true, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "id" : "esx4ewv" + "reorder" : false }, { "label" : "Service", "labelPosition" : "left-left", @@ -346,16 +380,12 @@ "minLength" : null, "maxLength" : null, "minWords" : null, - "maxWords" : null, - "custom" : "", - "customPrivate" : false, - "pattern" : "" + "maxWords" : null }, "conditional" : { "show" : "", "when" : "", - "json" : "", - "eq" : "" + "json" : "" }, "tabs" : null, "inputFormat" : "plain", @@ -365,85 +395,16 @@ "customConditional" : "", "logic" : [ ], "widget" : { - "type" : "", - "format" : "yyyy-MM-dd hh:mm a", - "dateFormat" : "yyyy-MM-dd hh:mm a", - "saveAs" : "text" + "type" : "" }, - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "protected" : false, - "unique" : false, - "persistent" : true, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "mask" : false, - "inputType" : "text", - "inputMask" : "", - "id" : "e8wrmxk" + "reorder" : false } ], "tabs" : null, "reorder" : false, "properties" : { }, "tags" : null, "customConditional" : "", - "logic" : [ ], - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : false, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelPosition" : "top", - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "validate" : { - "required" : false, - "custom" : "", - "customPrivate" : false - }, - "id" : "etkc4bga" + "logic" : [ ] } ], "tabs" : null, "encrypted" : false, @@ -451,438 +412,6 @@ "tags" : [ ], "customConditional" : "", "logic" : [ ], - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : true, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelPosition" : "top", - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "tree" : true, - "id" : "eqym18" - }, { - "label" : "progress_current", - "labelPosition" : "left-left", - "hidden" : true, - "mask" : false, - "tableView" : true, - "alwaysEnabled" : false, - "type" : "number", - "input" : true, - "key" : "progress_current", - "validate" : { - "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false, - "min" : "", - "max" : "", - "step" : "any", - "integer" : "" - }, - "conditional" : { - "show" : "", - "when" : "", - "json" : "", - "eq" : "" - }, - "tabs" : null, - "delimiter" : false, - "requireDecimal" : false, - "encrypted" : false, - "properties" : { }, - "tags" : [ ], - "decimalLimit" : null, - "customConditional" : "", - "logic" : [ ], - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : true, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "id" : "eofa72" - }, { - "label" : "progress_max", - "labelPosition" : "left-left", - "hidden" : true, - "mask" : false, - "tableView" : true, - "alwaysEnabled" : false, - "type" : "number", - "input" : true, - "key" : "progress_max", - "validate" : { - "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false, - "min" : "", - "max" : "", - "step" : "any", - "integer" : "" - }, - "conditional" : { - "show" : "", - "when" : "", - "json" : "", - "eq" : "" - }, - "tabs" : null, - "delimiter" : false, - "requireDecimal" : false, - "encrypted" : false, - "decimalLimit" : null, - "properties" : { }, - "tags" : [ ], - "customConditional" : "", - "logic" : [ ], - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : true, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "refreshOn" : "", - "clearOnRefresh" : false, - "validateOn" : "change", - "id" : "ekfiepc" - }, { - "label" : "HTML", - "labelPosition" : "left-left", - "className" : "", - "attrs" : [ { - "attr" : "", - "value" : "" - } ], - "content" : "
\n \n
\n", - "refreshOnChange" : true, - "mask" : false, - "tableView" : true, - "alwaysEnabled" : false, - "type" : "htmlelement", - "input" : false, - "key" : "html", - "validate" : { - "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false - }, - "conditional" : { - "show" : "", - "when" : "", - "json" : "", - "eq" : "" - }, - "tabs" : null, - "encrypted" : false, - "properties" : { }, - "tags" : null, - "customConditional" : "", - "logic" : [ ], - "refreshOn" : "data", - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : false, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "clearOnRefresh" : false, - "validateOn" : "change", - "tag" : "p", - "id" : "euz92uc" - }, { - "label" : "HTML", - "labelPosition" : "left-left", - "className" : "", - "attrs" : [ { - "attr" : "", - "value" : "" - } ], - "content" : "
\n \n {{ 'https://' + (!!(data.cluster)?data.cluster.stage:'cluster.stage') + '-' + (!!(data.tenant)?data.tenant.key:'tenant.key') + '-' + (!!(data.cluster)?data.cluster.name:'cluster.name') + '-01-connect.smardigo.digital' }}\n \n
", - "refreshOnChange" : true, - "mask" : false, - "tableView" : true, - "alwaysEnabled" : false, - "type" : "htmlelement", - "input" : false, - "key" : "html2", - "validate" : { - "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false - }, - "conditional" : { - "show" : "", - "when" : "", - "json" : "", - "eq" : "" - }, - "tabs" : null, - "encrypted" : false, - "properties" : { }, - "tags" : null, - "customConditional" : "", - "logic" : [ ], - "refreshOn" : "data", - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : false, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "clearOnRefresh" : false, - "validateOn" : "change", - "tag" : "p", - "id" : "edletnj" - }, { - "label" : "HTML", - "labelPosition" : "left-left", - "className" : "", - "attrs" : [ { - "attr" : "", - "value" : "" - } ], - "content" : "
\n \n {{ 'https://' + (!!(data.cluster)?data.cluster.stage:'cluster.stage') + '-' + (!!(data.tenant)?data.tenant.key:'tenant.key') + '-' + (!!(data.cluster)?data.cluster.name:'cluster.name') + '-01-wordpress.smardigo.digital' }}\n \n
", - "refreshOnChange" : true, - "mask" : false, - "tableView" : true, - "alwaysEnabled" : false, - "type" : "htmlelement", - "input" : false, - "key" : "html4", - "validate" : { - "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false - }, - "conditional" : { - "show" : "", - "when" : "", - "json" : "", - "eq" : "" - }, - "tabs" : null, - "encrypted" : false, - "properties" : { }, - "tags" : null, - "customConditional" : "show = data['connect-features'].includes(\"wordpress\") ", - "logic" : [ ], - "refreshOn" : "data", - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : false, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "clearOnRefresh" : false, - "validateOn" : "change", - "tag" : "p", - "id" : "e53jrex" - }, { - "label" : "HTML", - "labelPosition" : "left-left", - "className" : "", - "attrs" : [ { - "attr" : "", - "value" : "" - } ], - "content" : "
\n \n {{ 'https://' + (!!(data.cluster)?data.cluster.stage:'cluster.stage') + '-keycloak-01.smardigo.digital/auth/admin/' + (!!(data.tenant)?data.tenant.key:'tenant.key') + '/console' }}\n \n
", - "refreshOnChange" : true, - "mask" : false, - "tableView" : true, - "alwaysEnabled" : false, - "type" : "htmlelement", - "input" : false, - "key" : "html3", - "validate" : { - "customMessage" : "", - "json" : "", - "required" : false, - "custom" : "", - "customPrivate" : false - }, - "conditional" : { - "show" : "", - "when" : "", - "json" : "", - "eq" : "" - }, - "tabs" : null, - "encrypted" : false, - "properties" : { }, - "tags" : null, - "customConditional" : "", - "logic" : [ ], - "refreshOn" : "data", - "reorder" : false, - "placeholder" : "", - "prefix" : "", - "customClass" : "", - "suffix" : "", - "multiple" : false, - "defaultValue" : null, - "protected" : false, - "unique" : false, - "persistent" : false, - "hidden" : false, - "clearOnHide" : true, - "dataGridLabel" : false, - "labelWidth" : 30, - "labelMargin" : 3, - "description" : "", - "errorLabel" : "", - "tooltip" : "", - "hideLabel" : false, - "tabindex" : "", - "disabled" : false, - "autofocus" : false, - "dbIndex" : false, - "customDefaultValue" : "", - "calculateValue" : "", - "allowCalculateOverride" : false, - "widget" : null, - "clearOnRefresh" : false, - "validateOn" : "change", - "tag" : "p", - "id" : "ejuaoe9" + "reorder" : false } ] } \ No newline at end of file diff --git a/smardigo/provisioning/process-search/simple-connect.json b/smardigo/provisioning/process-search/simple-connect.json index 44b0293..27d7c4e 100644 --- a/smardigo/provisioning/process-search/simple-connect.json +++ b/smardigo/provisioning/process-search/simple-connect.json @@ -65,18 +65,18 @@ "hidden" : true } ], "filters" : [ { - "name" : "Creation User", + "name" : "Ersteller", "key" : "creation_user_id", "defaultOption" : { "key" : "default", - "name" : "All" + "name" : "Alle" } }, { - "name" : "State", + "name" : "Status", "key" : "vorgang_status_text", "defaultOption" : { "key" : "default", - "name" : "All" + "name" : "Alle" } } ] } \ No newline at end of file diff --git a/smardigo/provisioning/process/simple-connect.bpmn b/smardigo/provisioning/process/simple-connect.bpmn index f627b5b..17bd2da 100644 --- a/smardigo/provisioning/process/simple-connect.bpmn +++ b/smardigo/provisioning/process/simple-connect.bpmn @@ -1,5 +1,5 @@ - + @@ -695,20 +695,7 @@ Keycloak Realm mit Administrator Account /api/v2/job_templates/${job_template_id}/launch/ - - ${contextScopeId} - ${execution.getProcessInstanceId()} - ${smardigoManagementAction} - ${cluster.name} - ${cluster.service} - ${cluster.size} - ${cluster.stage} - ${tenant.key} - ${tenant.name} - ${tenant.key} - ${cluster_services} - ${execution.getVariable('databaseBackupFilename')} - + diff --git a/smardigo/provisioning/script/ansible-start.groovy b/smardigo/provisioning/script/ansible-start.groovy index 6fd9d88..eb85a86 100644 --- a/smardigo/provisioning/script/ansible-start.groovy +++ b/smardigo/provisioning/script/ansible-start.groovy @@ -4,7 +4,7 @@ def env = [ smardigo_management_action: smardigoManagementAction, cluster_name: cluster.name, cluster_service: cluster.service, - cluster_services: [cluster.service] + execution.getVariable('connect-features'), + cluster_services_str: ([cluster.service] + execution.getVariable('connect-features')).join(','), cluster_size: cluster.size, stage: cluster.stage, current_realm_name: tenant.key, @@ -17,12 +17,7 @@ def ansibleCommand= 'ansible-playbook ' + smardigoManagementAction + '.yml --vau def ansibleEnvironment= ' -e \"' env.each { key, val -> if (val instanceof List) { - ansibleEnvironment+= key + '=[' - val.each { _val -> - ansibleEnvironment+='\'' + _val + '\',' - } - ansibleEnvironment = ansibleEnvironment.substring(0, ansibleEnvironment.length() - 1); - ansibleEnvironment+='] ' + ansibleEnvironment+= key + '=\'' + val.join(',') + '\' ' } else { ansibleEnvironment+= key + '=\'' + val + '\' ' } diff --git a/smardigo/provisioning/script/create-awx-paramaters.groovy b/smardigo/provisioning/script/create-awx-paramaters.groovy new file mode 100644 index 0000000..20780a0 --- /dev/null +++ b/smardigo/provisioning/script/create-awx-paramaters.groovy @@ -0,0 +1,14 @@ +[ + scope_id: contextScopeId, + process_instance_id: execution.getProcessInstanceId(), + smardigo_management_action: smardigoManagementAction, + cluster_name: cluster.name, + cluster_service: cluster.service, + cluster_services_str: ([cluster.service] + execution.getVariable('connect-features')).join(','), + cluster_size: cluster.size, + stage: cluster.stage, + current_realm_name: tenant.key, + current_realm_display_name: tenant.name, + uploaded_file: execution.getVariable('databaseBackupFilename'), + tenant_id: tenant.key +] \ No newline at end of file diff --git a/smardigo/provisioning/user-management/user-management.json b/smardigo/provisioning/user-management/user-management.json index 9b84976..dcc5b6a 100644 --- a/smardigo/provisioning/user-management/user-management.json +++ b/smardigo/provisioning/user-management/user-management.json @@ -1,15 +1,18 @@ { "groups" : [ { - "id" : "user", - "name" : "User" - }, { - "id" : "head", - "name" : "Head" + "id" : "administrator", + "name" : "Administrator" }, { "id" : "maintainer", "name" : "Maintainer" }, { - "id" : "administrator", - "name" : "Administrator" + "id" : "process-delete-approver", + "name" : "Aussonderungsliste anzeigen und bearbeiten" + }, { + "id" : "process-deleter", + "name" : "Löschen von Vorgängen" + }, { + "id" : "user", + "name" : "User" } ] } \ No newline at end of file diff --git a/tasks/autodiscover_pre_tasks.yml b/tasks/autodiscover_pre_tasks.yml index c6729f2..5af9d47 100644 --- a/tasks/autodiscover_pre_tasks.yml +++ b/tasks/autodiscover_pre_tasks.yml @@ -46,9 +46,7 @@ - name: "Reading hetzner private network id for <{{ stage }}>" set_fact: - stage_private_network_id: "{{ hetzner_networks.json.networks | json_query(querystr) | first }}" - vars: - querystr: "[?ip_range=='{{ shared_service_network }}'].id" + stage_private_network_id: "{{ hetzner_networks.json.networks | map(attribute='id') | first }}" delegate_to: 127.0.0.1 become: false tags: @@ -64,6 +62,33 @@ when: - debug +- name: "Reading hetzner server infos for stage <{{ stage }}>" + set_fact: + stage_server_infos: "\ + {% set list= [] %}\ + {% for server in hetzner_servers.json.servers %}\ + {% for private_net in server.private_net %}\ + {% if private_net.network == stage_private_network_id|int %}\ + {{ list.append({'service': server.labels.service, 'private_ip': private_net.ip, 'public_ip': server.public_net.ipv4.ip, 'name': server.name}) }}\ + {% endif %}\ + {% endfor %}\ + {% endfor %}\ + {{ list|list }}" + delegate_to: 127.0.0.1 + become: false + tags: + - always + +- name: "Printing hetzner server infos for stage <{{ stage }}>" + debug: + msg: "{{ stage_server_infos }}" + delegate_to: 127.0.0.1 + become: false + tags: + - always + when: + - debug + - name: "Reading private ip address for {{ inventory_hostname }}" set_fact: stage_private_server_ip: "{% for server in hetzner_servers.json.servers %}\ @@ -99,30 +124,3 @@ - always when: - debug - -- name: "Reading hetzner server infos for stage <{{ stage }}>" - set_fact: - stage_server_infos: "\ - {% set list= [] %}\ - {% for server in hetzner_servers.json.servers %}\ - {% for private_net in server.private_net %}\ - {% if private_net.network == stage_private_network_id|int %}\ - {{ list.append({'service': server.labels.service, 'private_ip': private_net.ip, 'public_ip': server.public_net.ipv4.ip, 'name': server.name}) }}\ - {% endif %}\ - {% endfor %}\ - {% endfor %}\ - {{ list|list }}" - delegate_to: 127.0.0.1 - become: false - tags: - - always - -- name: "Printing hetzner server infos for stage <{{ stage }}>" - debug: - msg: "{{ stage_server_infos }}" - delegate_to: 127.0.0.1 - become: false - tags: - - always - when: - - debug diff --git a/upload-database-dumb.yml b/upload-database-dumb.yml index 3d0dc21..84c035d 100644 --- a/upload-database-dumb.yml +++ b/upload-database-dumb.yml @@ -4,7 +4,7 @@ # How this stuff works: # If `upload_file` is defined the upload role save the binary to `upload_directory` (default /tmp) -# If `uploaded_file` and `target_database` are defined the import role imports from file basename `uploaded_file` to `target_database` +# If `database_backup_file` and `target_database` are defined the import role imports from file basename `database_backup_file` to `target_database` # If both role conditions match the upload role trigger first. # Parameters: @@ -15,7 +15,7 @@ # cluster_size := (WIP node count for the cluster) (Currently max is 2 master/slave) # cluster_services := (services to setup, e.g. ['connect', 'wordpress', ...]) # upload_file := the local file to upload (e.g. dumps/wordpress_portal.sql) -# uploaded_file := the dump file to import (e.g. wordpress_portal.sql) +# database_backup_file := the dump file to import (e.g. wordpress_portal.sql) # smardigo message callback # scope_id := (scope id of the management process) # process_instance_id := (process instance id of the management process) @@ -36,6 +36,11 @@ - ansible_version.major >= 2 - ansible_version.minor >= 10 msg: "The ansible version has to be at least ({{ ansible_version.full }})" + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" + tags: + - always tasks: - name: Add hosts @@ -44,7 +49,6 @@ groups: - "stage_{{ stage }}" - "{{ item }}" - cluster_service: "{{ item }}" changed_when: False with_items: "{{ cluster_services }}" when: item in ['connect_wordpress'] @@ -60,6 +64,11 @@ pre_tasks: - name: "Import autodiscover pre-tasks" include_tasks: tasks/autodiscover_pre_tasks.yml + - name: "Parsing cluster_services_str into cluster_services" + set_fact: + cluster_services: "{{ cluster_services_str | split(',') }}" + tags: + - always roles: - role: upload-local-file