如何使用Ansible添加Azure VM(Windows)扩展

时间:2018-02-05 15:13:02

标签: azure ansible

我正在努力在Windows主机上安装/添加Azure VM扩展。对互联网的研究向我指出了Azure_rm_deployment模块,但到目前为止我还没有能够使它工作。

以下是我的剧本

的例子
    - name: Install Anti-Malware
      hosts: localhost
      gather_facts: false
      vars:
        sec: 'YK/xxxxxxxxxx/JnCsPTj4kRdsWblc='
      tasks:
      - name: Create Azure clear
        azure_rm_deployment:
        state: present
        subscription_id: 'b1514ce2-xxxx-xxxxxx-xxxxx-xxxxxx'
        client_id: 'xxxxxxx-cae7-45a3-xxxxxx-9b37bce64746'
        secret: '{{ sec }}'
        tenant: "78e60c0f-xxxx-xxxx-xxxxx-63fe13a30962"
        location: 'uk west'
        resource_group_name: 'AnsibleRG'
        template_link: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/octopus-deploy-tentacle-windows/azuredeploy.json
  #template: "{{ lookup('file', '/etc/ansible/playbooks/OctopusDeployTentacle.json') | from_json }}"

        parameters:
          vmAdminUserName:
            value: adminUser
          vmAdminPassword:
            value: mYpAss
          vmDnsName:
            value: WinVM01
          tentacleOctopusServerUrl:
            value: https://octopus.example.com
          tentacleCommunicationMode:
            value: Listen
          tentacleApiKey:
            value: XXX-ABC-DDE-DDJD-GGGJ
          tentacleRoles:
            value: web
          tentacleEnvironments:
            value: Test
          tentaclePort:
            value: 10933

我尝试过使用增加超时         ansible_winrm_operation_timeout_sec         ansible_winrm_read_timeout_sec

但到目前为止还没有运气。

任何人都可以让我知道我在这里做错了吗?

感谢。

RFD

1 个答案:

答案 0 :(得分:0)

将主机更改为localhost,这应该在localhost上运行,最有可能的情况。