Ansible中的Azure模块

时间:2017-03-21 05:05:32

标签: azure ansible

我正在尝试使用Ansible在Azure中创建资源组。但是我得到了以下错误:

ERROR! no action detected in task

The error appears to have been in '/home/alam/azure/rg.yml': line 6, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - azure_rm_resourcegroup:
      ^ here

这是我的yml剧本:

- name: Test the inventory script  
  hosts: azure   
  connection: local  
  gather_facts: no  
  tasks:  

    - name: "Create a resource group"  
      azure_rm_resourcegroup:   
        location: westus  
        name: Testing  
        state: present  
        tags:   
          delete: never  
          testing: testing

命令:

ansible-playbook -i ./ansible/contrib/inventory/azure_rm.py rg.yml

2 个答案:

答案 0 :(得分:0)

将Ansible升级到至少2.1版(最好还是最新版本)。 docs明确要求:

  

azure_rm_resourcegroup - 管理Azure资源组。

     

2.1版中的新功能。

如果您使用旧版本,则无法识别模块名称,并且Ansible将引发错误:“在任务中未检测到任何操作。”

答案 1 :(得分:0)

升级到2.2已解决了这个问题。但是要创建资源" hosts"不应该是" Azure"。将其更改为" localhost"