# Specifies that APIcast is self managed (if a public staging and/or
# production URL is given), or hosted
threescale_cicd_api_deployment_type:'{{ ''self_managed'' if threescale_cicd_apicast_sandbox_endpoint is defined or threescale_cicd_apicast_production_endpoint is defined else ''hosted'' }}'
- name:Compute the system_name suffix to append to the generated system_name
set_fact:
threescale_cicd_api_system_name_suffix:'{{ (threescale_cicd_api_system_name is not defined)|ternary("_" ~ (threescale_cicd_api_version_major|regex_replace(''[^a-zA-Z0-9_]+'', ''_'')), "") }}'
- name:Compute the system_name prefix to prepend to the generated system_name
set_fact:
threescale_cicd_api_system_name_prefix:'{{ (threescale_cicd_api_system_name is not defined and threescale_cicd_api_environment_name is defined)|ternary((threescale_cicd_api_environment_name|default("")|regex_replace(''[^a-zA-Z0-9_]+'', ''_'')) ~ "_", "") }}'
- name:Extract the wanted system_name from OpenAPI
msg:'You have {{ threescale_cicd_api_security_requirements|length }} global security requirements. There must be one and only one security requirement.'
- name:Make sure the security scheme is consistent with 3scale
assert:
that:
- 'threescale_cicd_api_security_scheme.type == ''apiKey'' or (threescale_cicd_api_security_scheme.type == ''oauth2'' and threescale_cicd_sso_issuer_endpoint is defined)'
when:threescale_cicd_api_backend_hostname is defined and threescale_cicd_private_base_url is not defined
- '''type'' in threescale_cicd_api_security_scheme and threescale_cicd_api_security_scheme.type == ''apiKey'' or (threescale_cicd_api_security_scheme.type == ''oauth2'' and threescale_cicd_sso_issuer_endpoint is defined)'
msg:|-
The embedded security definition {{ threescale_cicd_api_security_scheme_name }} is not compatible with 3scale.
Please make sure you chose an "apiKey" or "oauth2" scheme.
Also, if you chose "oauth2", you will need to pass the threescale_cicd_sso_issuer_endpoint extra variable.
The security definition you chose:{{threescale_cicd_api_security_scheme|to_nice_json }}
- assert:
that:
- 'threescale_cicd_private_base_url is defined'
msg:'Either the private base url or the tuple backend hostname/scheme must be declared as extra variables (either threescale_cicd_private_base_url or threescale_cicd_api_backend_scheme / threescale_cicd_api_backend_hostname)'
- threescale_cicd_access_token that contains an Access Token with Read/Write privileges on the 3scale Account Management API. This variable is usually set in your inventory file.
- threescale_cicd_openapi_file that is the path to the OpenAPI file you want to deploy in 3scale. This variable is usually passed as an extra variable (-e threescale_cicd_openapi_file=...)
- name:Make sure the OpenAPI File Format is YAML or JSON
assert:
that:
- threescale_cicd_openapi_file_format|upper == 'JSON' or threescale_cicd_openapi_file_format|upper == 'YAML'
msg:|-
The threescale_cicd_openapi_file_format parameter needs to be either 'JSON' or 'YAML'
- name:Verify that Ansible version is >= 2.4
assert:
that:"ansible_version.full is version_compare('2.4', '>=')"
when:'threescale_cicd_sso_issuer_endpoint is not defined and ''sso'' in groups and groups[''sso''] > 0'
- name:Abort on deprecated feature -> the "sso" inventory group
fail:
msg:>
You are currently using a deprecated feature (the 'sso' group in your inventory).
Please replace it with the 'threescale_cicd_sso_issuer_endpoint' variable.
Alternatively, you can also bypass this warning by setting the 'threescale_cicd_deprecated_features'
extra variable to 'true'.
when:'threescale_cicd_sso_issuer_endpoint|default("")|length > 0 and ''sso'' in groups and groups[''sso''] > 0 and threescale_cicd_api_backend_version == ''oidc'' and not threescale_cicd_deprecated_features|default(false)|bool'
- name:Set the threescale_cicd_sso_realm_endpoint variable from the threescale_cicd_sso_issuer_endpoint
when:'threescale_cicd_sso_realm_endpoint is not defined and threescale_cicd_sso_issuer_endpoint is defined'
- name:Abort on deprecated feature -> the "apicast-sandbox" inventory group
fail:
msg:>
You are currently using a deprecated feature (the 'apicast-sandbox' group in your inventory).
Please replace it with the 'threescale_cicd_apicast_sandbox_endpoint' variable.
Alternatively, you can also bypass this warning by setting the 'threescale_cicd_deprecated_features'
extra variable to 'true'.
when:'threescale_cicd_apicast_sandbox_endpoint|default("")|length > 0 and ''apicast-sandbox'' in groups and groups[''apicast-sandbox''] > 0 and not threescale_cicd_deprecated_features|default(false)|bool'
- name:Set the threescale_cicd_sso_admin_endpoint variable from the threescale_cicd_sso_realm_endpoint
when:'threescale_cicd_apicast_production_endpoint is not defined and ''apicast-production'' in groups and groups[''apicast-production''] > 0'
- name:Abort on deprecated feature -> the "apicast-production" inventory group
fail:
msg:>
You are currently using a deprecated feature (the 'apicast-production' group in your inventory).
Please replace it with the 'threescale_cicd_apicast_production_endpoint' variable.
Alternatively, you can also bypass this warning by setting the 'threescale_cicd_deprecated_features'
extra variable to 'true'.
when:'threescale_cicd_apicast_production_endpoint|default("")|length > 0 and ''apicast-production'' in groups and groups[''apicast-production''] > 0 and not threescale_cicd_deprecated_features|default(false)|bool'
threescale_cicd_api_security_scheme:'{{ threescale_cicd_api_security_definitions[threescale_cicd_api_security_scheme_name] if threescale_cicd_api_security_scheme_name in threescale_cicd_api_security_definitions else {} }}'