ansible playbook for Azure network security group - Error: missing required arguments
ansible playbook for Azure network security group - Error: missing required arguments
按照 YAML playbook
创建 Azure Network Security Group
确实指定了 priority
参数。但是当 运行 Azure Cloud Shell
中的剧本时,我仍然收到以下错误。错误的原因可能是什么?我们该如何解决?
备注:我在 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
错误:
[localhost]: FAILED! => {"changed": false, "msg": "missing required arguments: priority found in rules"}
根据位于 here 的官方文档,定义的每个规则都需要优先级。
规则列表有一些 mandatory/rerequired 属性.
---
- 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
按照 YAML playbook
创建 Azure Network Security Group
确实指定了 priority
参数。但是当 运行 Azure Cloud Shell
中的剧本时,我仍然收到以下错误。错误的原因可能是什么?我们该如何解决?
备注:我在 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
错误:
[localhost]: FAILED! => {"changed": false, "msg": "missing required arguments: priority found in rules"}
根据位于 here 的官方文档,定义的每个规则都需要优先级。
规则列表有一些 mandatory/rerequired 属性.
---
- 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