azure.azcollection.azure_rm_webappslot (2.3.0) — module

Manage Azure Web App slot

| "added in version" 0.1.2 of azure.azcollection"

Authors: Yunge Zhu(@yungezz)

Install collection

Install with ansible-galaxy collection install azure.azcollection:==2.3.0


Add to requirements.yml

  collections:
    - name: azure.azcollection
      version: 2.3.0

Description

Create, update and delete Azure Web App slot.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a webapp slot
  azure_rm_webappslot:
    resource_group: myResourceGroup
    webapp_name: myJavaWebApp
    name: stage
    configuration_source: myJavaWebApp
    app_settings:
      testkey: testvalue
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: swap the slot with production slot
  azure_rm_webappslot:
    resource_group: myResourceGroup
    webapp_name: myJavaWebApp
    name: stage
    swap:
      action: swap
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: stop the slot
  azure_rm_webappslot:
    resource_group: myResourceGroup
    webapp_name: myJavaWebApp
    name: stage
    app_state: stopped
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: udpate a webapp slot app settings
  azure_rm_webappslot:
    resource_group: myResourceGroup
    webapp_name: myJavaWebApp
    name: stage
    app_settings:
      testkey: testvalue2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: udpate a webapp slot frameworks
  azure_rm_webappslot:
    resource_group: myResourceGroup
    webapp_name: myJavaWebApp
    name: stage
    frameworks:
      - name: "node"
        version: "10.1"

Inputs

    
name:
    description:
    - Unique name of the deployment slot to create or update.
    required: true
    type: str

swap:
    description:
    - Swap deployment slots of a web app.
    suboptions:
      action:
        choices:
        - preview
        - swap
        - reset
        default: preview
        description:
        - Swap types.
        - C(preview) is to apply target slot settings on source slot first.
        - C(swap) is to complete swapping.
        - C(reset) is to reset the swap.
        type: str
      preserve_vnet:
        default: true
        description:
        - C(True) to preserve virtual network to the slot during swap. Otherwise C(False).
        type: bool
      target_slot:
        description:
        - Name of target slot to swap. If set to None, then swap with production slot.
        type: str
    type: dict

tags:
    description:
    - Dictionary of string:string pairs to assign as metadata to the object.
    - Metadata tags on the object will be updated with any provided values.
    - To remove tags set append_tags option to false.
    - Currently, Azure DNS zones and Traffic Manager services also don't allow the use
      of spaces in the tag.
    - Azure Front Door doesn't support the use of
    - Azure Automation and Azure CDN only support 15 tags on resources.
    type: dict

state:
    choices:
    - absent
    - present
    default: present
    description:
    - State of the Web App deployment slot.
    - Use C(present) to create or update a  slot and C(absent) to delete it.
    type: str

secret:
    description:
    - Azure client secret. Use when authenticating with a Service Principal.
    type: str

tenant:
    description:
    - Azure tenant ID. Use when authenticating with a Service Principal.
    type: str

ad_user:
    description:
    - Active Directory username. Use when authenticating with an Active Directory user
      rather than service principal.
    type: str

profile:
    description:
    - Security profile found in ~/.azure/credentials file.
    type: str

location:
    description:
    - Resource location. If not set, location from the resource group will be used as
      default.
    type: str

log_mode:
    description:
    - Parent argument.
    type: str

log_path:
    description:
    - Parent argument.
    type: str

password:
    description:
    - Active Directory user password. Use when authenticating with an Active Directory
      user rather than service principal.
    type: str

app_state:
    choices:
    - started
    - stopped
    - restarted
    default: started
    description:
    - Start/Stop/Restart the slot.
    type: str

client_id:
    description:
    - Azure client ID. Use when authenticating with a Service Principal or Managed Identity
      (msi).
    - Can also be set via the C(AZURE_CLIENT_ID) environment variable.
    type: str

frameworks:
    description:
    - Set of run time framework settings. Each setting is a dictionary.
    - See U(https://docs.microsoft.com/en-us/azure/app-service/app-service-web-overview)
      for more info.
    elements: dict
    suboptions:
      name:
        choices:
        - java
        - net_framework
        - php
        - python
        - ruby
        - dotnetcore
        - node
        description:
        - Name of the framework.
        - Supported framework list for Windows web app and Linux web app is different.
        - Windows web apps support C(java), C(net_framework), C(php), C(python), and C(node)
          from June 2018.
        - Windows web apps support multiple framework at same time.
        - Linux web apps support C(java), C(ruby), C(php), C(dotnetcore), and C(node)
          from June 2018.
        - Linux web apps support only one framework.
        - Java framework is mutually exclusive with others.
        required: true
        type: str
      settings:
        description:
        - List of settings of the framework.
        suboptions:
          java_container:
            description:
            - Name of Java container. This is supported by specific framework C(java)
              onlys, for example C(Tomcat), C(Jetty).
            required: true
            type: str
          java_container_version:
            description:
            - Version of Java container. This is supported by specific framework C(java)
              only.
            - For C(Tomcat), for example C(8.0), C(8.5), C(9.0). For C(Jetty), for example
              C(9.1), C(9.3).
            required: true
            type: str
        type: dict
      version:
        description:
        - Version of the framework. For Linux web app supported value, see U(https://aka.ms/linux-stacks)
          for more info.
        - C(net_framework) supported value sample, C(v4.0) for .NET 4.6 and C(v3.0) for
          .NET 3.5.
        - C(php) supported value sample, C(5.5), C(5.6), C(7.0).
        - C(python) supported value sample, C(5.5), C(5.6), C(7.0).
        - C(node) supported value sample, C(6.6), C(6.9).
        - C(dotnetcore) supported value sample, C(1.0), C(1.1), C(1.2).
        - C(ruby) supported value sample, 2.3.
        - C(java) supported value sample, C(1.9) for Windows web app. C(1.8) for Linux
          web app.
        required: true
        type: str
    type: list

thumbprint:
    description:
    - The thumbprint of the private key specified in I(x509_certificate_path).
    - Use when authenticating with a Service Principal.
    - Required if I(x509_certificate_path) is defined.
    type: str
    version_added: 1.14.0
    version_added_collection: azure.azcollection

api_profile:
    default: latest
    description:
    - Selects an API profile to use when communicating with Azure services. Default value
      of C(latest) is appropriate for public clouds; future values will allow use with
      Azure Stack.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

append_tags:
    default: true
    description:
    - Use to control if tags field is canonical or just appends to existing tags.
    - When canonical, any tags not found in the tags parameter will be removed from the
      object's metadata.
    type: bool

auth_source:
    choices:
    - auto
    - cli
    - credential_file
    - env
    - msi
    default: auto
    description:
    - Controls the source of the credentials to use for authentication.
    - Can also be set via the C(ANSIBLE_AZURE_AUTH_SOURCE) environment variable.
    - When set to C(auto) (the default) the precedence is module parameters -> C(env)
      -> C(credential_file) -> C(cli).
    - When set to C(env), the credentials will be read from the environment variables
    - When set to C(credential_file), it will read the profile from C(~/.azure/credentials).
    - When set to C(cli), the credentials will be sources from the Azure CLI profile.
      C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used
      to identify the subscription ID if more than one is present otherwise the default
      az cli subscription is used.
    - When set to C(msi), the host machine must be an azure resource with an enabled MSI
      extension. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID)
      can be used to identify the subscription ID if the resource is granted access to
      more than one subscription, otherwise the first subscription is chosen.
    - The C(msi) was added in Ansible 2.6.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

webapp_name:
    description:
    - Web app name which this deployment slot belongs to.
    required: true
    type: str

app_settings:
    description:
    - Configure web app slot application settings. Suboptions are in key value pair format.
    type: dict

startup_file:
    description:
    - The slot startup file.
    - This only applies for Linux web app slot.
    type: str

resource_group:
    description:
    - Name of the resource group to which the resource belongs.
    required: true
    type: str

subscription_id:
    description:
    - Your Azure subscription Id.
    type: str

cloud_environment:
    default: AzureCloud
    description:
    - For cloud environments other than the US public cloud, the environment name (as
      defined by Azure Python SDK, eg, C(AzureChinaCloud), C(AzureUSGovernment)), or a
      metadata discovery endpoint URL (required for Azure Stack). Can also be set via
      credential file profile or the C(AZURE_CLOUD_ENVIRONMENT) environment variable.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

deployment_source:
    description:
    - Deployment source for git.
    suboptions:
      branch:
        description:
        - The branch name of the repository.
        type: str
      url:
        description:
        - Repository URL of deployment source.
        type: str
    type: dict

adfs_authority_url:
    description:
    - Azure AD authority url. Use when authenticating with Username/password, and has
      your own ADFS authority.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

container_settings:
    description:
    - Web app slot container settings.
    suboptions:
      name:
        description:
        - Name of container, for example C(imagename:tag).
        required: true
        type: str
      registry_server_password:
        description:
        - The container registry server password.
        type: str
      registry_server_url:
        description:
        - Container registry server URL, for example C(mydockerregistry.io).
        type: str
      registry_server_user:
        description:
        - The container registry server user name.
        type: str
    type: dict

purge_app_settings:
    default: false
    description:
    - Purge any existing application settings. Replace slot application settings with
      app_settings.
    type: bool

auto_swap_slot_name:
    description:
    - Used to configure target slot name to auto swap, or disable auto swap.
    - Set it target slot name to auto swap.
    - Set it to False to disable auto slot swap.
    type: raw

cert_validation_mode:
    choices:
    - ignore
    - validate
    description:
    - Controls the certificate validation behavior for Azure endpoints. By default, all
      modules will validate the server certificate, but when an HTTPS proxy is in use,
      or against Azure Stack, it may be necessary to disable this behavior by passing
      C(ignore). Can also be set via credential file profile or the C(AZURE_CERT_VALIDATION)
      environment variable.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

configuration_source:
    description:
    - Source slot to clone configurations from when creating slot. Use webapp's name to
      refer to the production slot.
    type: str

x509_certificate_path:
    description:
    - Path to the X509 certificate used to create the service principal in PEM format.
    - The certificate must be appended to the private key.
    - Use when authenticating with a Service Principal.
    type: path
    version_added: 1.14.0
    version_added_collection: azure.azcollection

disable_instance_discovery:
    default: false
    description:
    - Determines whether or not instance discovery is performed when attempting to authenticate.
      Setting this to true will completely disable both instance discovery and authority
      validation. This functionality is intended for use in scenarios where the metadata
      endpoint cannot be reached such as in private clouds or Azure Stack. The process
      of instance discovery entails retrieving authority metadata from https://login.microsoft.com/
      to validate the authority. By setting this to **True**, the validation of the authority
      is disabled. As a result, it is crucial to ensure that the configured authority
      host is valid and trustworthy.
    - Set via credential file profile or the C(AZURE_DISABLE_INSTANCE_DISCOVERY) environment
      variable.
    type: bool
    version_added: 2.3.0
    version_added_collection: azure.azcollection

Outputs

id:
  description:
  - ID of current slot.
  returned: always
  sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/sites/testapp/slots/stage1
  type: str

See also