编写用于创建Azure实例的playbook

时间:2017-11-30 10:31:21

标签: ansible

我正在使用Playbook创建Azure实例的Ansible,我得到以下错误可以解决这个问题。

 [WARNING]: Found both group and host with same name: localhost

[DEPRECATION WARNING]: azure is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this
 rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

PLAY [localhost] ********************************************************************************************************************************************

TASK [create VM] ********************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Unsupported parameters for (azure) module: Subscription_ID Supported parameters include: auto_updates,enable_winrm,endpoints,hostname,image,location,management_cert_path,name,os_type,password,role_size,ssh_cert_path,state,storage_account,subscription_id,user,virtual_network_name,wait,wait_timeout,wait_timeout_redirects"}
        to retry, use: --limit @/etc/ansible/int.retry

PLAY RECAP **************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1

1 个答案:

答案 0 :(得分:0)

有一条错误消息:

  

(azure)模块不支持的参数: Subscription_ID

请查看azure模块和azure guide的文档。

如果您想通过env变量提供凭据,您可以尝试:

- azure:
    name: my-virtual-machine
    role_size: Small
    image: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-precise-12_04_3-LTS-amd64-server-20131205-en-us-30GB
    ...  
  environment:
    AZURE_SUBSCRIPTION_ID: xxxxx

但是你应该在你的剧本之外遵循azure指南和设置凭据。