I though I correctly followed this YAML tutorial (for formatting a YAML file) and this ansible example from official ansible document to create an Azure Network Security Group
using following ansible playbook
. But when I run the playbook in Azure Cloud Shell
, I get the error shown below:
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": "value of protocol must be one of: Udp, Tcp, *, got: TCP found in rules"}
Based on official and "latest" documentation at this URL. Notice the example, the case of the protocol is "Tcp
", not "TCP
"
Also, the error message you shared is also suggesting to use Tcp
, Udp
, *
as the possible inputs and it got TCP
.
[localhost]: FAILED! => {"changed": false, "msg": "value of protocol must be one of: Udp, Tcp, *, got: TCP found in rules"}