【问题标题】:ansible playbook for Azure network security group - Error: missing required argumentsAzure 网络安全组的 ansible playbook - 错误:缺少必需的参数
【发布时间】:2020-10-29 20:46:08
【问题描述】:

在 YAML playbook 之后创建 Azure Network Security Group 确实指定了 priority 参数。但是在Azure Cloud Shell 中运行剧本时仍然出现以下错误。错误的原因可能是什么?我们该如何解决?

备注:我在GitHubhere看到一个类似的问题。

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

错误:

[本地主机]:失败! => {"changed": false, "msg": "missing required arguments: priority found in rules"}

【问题讨论】:

    标签: ansible azure-cloud-shell


    【解决方案1】:

    根据位于here的官方文档,定义的每个规则都需要优先级。

    【讨论】:

    • 您的建议奏效了。感谢您花时间搜索与该问题相关的文档,并在此处分享。
    • 很高兴,它有帮助。
    【解决方案2】:

    规则列表有一些强制/必需的属性。

    ---
    - 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
    

    【讨论】:

      猜你喜欢
      • 2016-02-08
      • 2021-04-24
      • 2022-01-01
      • 2021-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多