Ansible Azure WebApp部署部分不起作用

时间:2020-05-22 08:26:28

标签: azure .net-core azure-devops ansible devops

我想将计算机上的本地git存储库发送到azure webapp。

首先,我创建一个资源组。然后我创建了webapp和数据库项目。我的想法是将本地git存储库发送到Kudu服务。但是我写的脚本不起作用。我试图将有关Visual Studio代码的实践写到脚本中,但没有成功。

这是我的YML文件:

- hosts: localhost
  connection: local
  vars:
    resource_group: FreeRG
    webapp_name: sampleWebApp
    plan_name: free-europe
    location: westus
    sqlserver_name: alp-dev-sql
    sqldb_name: alp-dev
    admin_username: alpdevuser
    admin_password: Abcpasswordxyz12!
    path_name: /Users/Documents/_dev/api.netcore/
    username: mail@hotmail.com
    password: somepassWord
    publish_profile:
    publish_path: /Users/Documents/_dev/api.netcore/alp.api/bin/Release/netcoreapp2.2/

  tasks:
    - name: Create resource group
      azure_rm_resourcegroup:
        name: "{{ resource_group }}"
        location: westus

    - name: Create a web app 
      azure_rm_webapp:
        resource_group: "{{ resource_group }}"
        name: "{{ webapp_name }}"
        plan:
          resource_group: "{{ resource_group }}"
          name: "{{ plan_name }}"
          sku: F1                 

    - name: Create SQL Server
      azure_rm_sqlserver:
        name: "{{sqlserver_name}}"
        resource_group: "{{resource_group}}"
        version: 12.0
        admin_username: "{{admin_username}}"
        admin_password: "{{admin_password}}"


    - name: Create instance of SQL Database
      azure_rm_sqldatabase:
        resource_group: "{{resource_group}}"
        server_name: "{{sqlserver_name}}"
        name: "{{sqldb_name}}"


- name: Azure Deployment User Set
      shell: az webapp deployment user set --user-name myUserName --password somePassword
      args:
        chdir: "{{path_name}}"

    - name: Azure Deployment Source Select
      shell: az webapp deployment source config-local-git --name {{webapp_name}} --resource-group {{resource_group}}
      args:
        chdir: "{{path_name}}"

    - name: Get facts for web app by name
      azure_rm_webapp_facts:
        resource_group: "{{resource_group}}"
        name: "{{webapp_name}}"
        return_publish_profile: true

    - name: Git Remote Add Azure
      shell: 
            git remote add azure "https://testwebapp.scm.azurewebsites.net:443/mygitRepo.git"             
      args:
        chdir: "{{path_name}}"

    - name: Git Push the Azure
      shell: | 
              git config --global http.postBuffer 157286400
              git push azure:master master
      register: output
      args:
        chdir: "{{path_name}}"

但是,当我运行这段代码时,“ Git Push the Azure”部分不起作用。我在哪里做错了?

0 个答案:

没有答案