ansible.builtin.azure_rm_webappslot (v2.9.17) — module

Manage Azure Web App slot

| "added in version" 2.8 of ansible.builtin"

Authors: Yunge Zhu(@yungezz)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.17

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

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.
      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.

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.
    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.

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.

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.
    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.
    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.
      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).
          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).
      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.

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

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

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

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

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.
      url:
        description:
        - Repository URL of deployment source.

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).
      registry_server_password:
        description:
        - The container registry server password.
      registry_server_url:
        description:
        - Container registry server URL, for example C(mydockerregistry.io).
      registry_server_user:
        description:
        - The container registry server user name.

purge_app_settings:
    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.

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.

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