ansible playbook for Azure network security group - Error: missing required arguments

随声附和 提交于 2020-12-15 05:31:40

问题


Following YAML playbook for creating Azure Network Security Group DOES specify the priority arguments. But I still get the following error when running the playbook in Azure Cloud Shell. What may be the cause of the error and how can we fix it?

Remark: I see a similar issue posted on GitHub here.

Create_network_security_group.yaml:

---
- hosts: localhost

  tasks:
  - azure_rm_securitygroup:
      resource_group: rg-cs-ansible
      name: nsg-cs-web
      rules:
          - name: 'allow_rdp'
            protocol: Tcp
            destination_port_range: 3389
            access: Allow
            priority: 1001
            direction: Inbound
          - name: 'allow_web_traffic'
            protocol: Tcp
            destination_port_range:
              - 80
              - 443
            access: Allow
            priority: 1002
            direction: Inbound
          - name: 'allow_powershell_remoting'
            protocol: Tcp
            destination_port_range:
              - 5985
              - 5986

Error:

[localhost]: FAILED! => {"changed": false, "msg": "missing required arguments: priority found in rules"}


回答1:


As per the official document located here, priority is required for each rule defined.




回答2:


The rules list have some mandatory/rerequired property.

---
- hosts: localhost

  tasks:
  - azure_rm_securitygroup:
      resource_group: rg-cs-ansible
      name: nsg-cs-web
      rules:
          - name: 'allow_rdp'     <--- required
            priority: 1001        <--- required
            protocol: Tcp
            destination_port_range: 3389
            access: Allow
            direction: Inbound


来源:https://stackoverflow.com/questions/64598994/ansible-playbook-for-azure-network-security-group-error-missing-required-argu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!