ansible-无法创建Azure网络安全组
我认为我正确地遵循了这一点(用于格式化YAML文件)和官方ansible文档中的这一点,使用以下ansible-无法创建Azure网络安全组,ansible,azure-cloud-shell,Ansible,Azure Cloud Shell,我认为我正确地遵循了这一点(用于格式化YAML文件)和官方ansible文档中的这一点,使用以下ansible playbook创建了Azure网络安全组。但是当我在Azure Cloud Shell中运行playbook时,我得到如下错误: 创建网络安全组。yaml: --- - hosts: localhost tasks: - azure_rm_securitygroup: resource_group: rg-cs-ansible name: nsg-c
ansible playbook
创建了Azure网络安全组。但是当我在Azure Cloud Shell中运行playbook时,我得到如下错误:
创建网络安全组。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
错误:
---
- 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]:失败!=>{“changed”:false,“msg”:“协议的值必须是规则中找到的:Udp,Tcp,*,got:Tcp中的一个”}
基于URL上的官方和“最新”文档。注意这个例子,协议的大小写是“Tcp
”,而不是“Tcp
”
此外,您共享的错误消息还建议使用Tcp
,Udp
,*
作为可能的输入,它得到了Tcp
[localhost]: FAILED! => {"changed": false, "msg": "value of protocol must be one of: Udp, Tcp, *, got: TCP found in rules"}
我改为Tcp
。但是现在我得到了类似的错误,但是一条不同的消息,尽管我确实将优先级定义为优先级:1001
和优先级:1002
:[localhost]:失败!=>{“changed”:false,“msg”:“缺少必需的参数:在规则中找到优先级”}
对于第三条规则,它不在那里,是否需要?我不期望,因此询问第三条规则allow\u powershell\u remotin
未定义优先级不期望。此外,我已经发布了一个单独的帖子,因为我认为你回答了上面发布的问题。我认为这是必要的和强制性的,请参阅