Azure / Ansible

Ansible Solution Template on Azure
MIT License
7 stars 10 forks source link

Create Inbound NAT Rule (availability set / vm) #16

Open rience opened 4 years ago

rience commented 4 years ago

When creating inbound nat rule in load balancer that is associated to availability set - I'm missing an option to specify target virtual machine. It's possible to do that via portal.

rpm192 commented 3 years ago

Seems as if this really isn't an option with Ansible-azure itself.

I instead used the Azure-CLI with an SPN and ran the command through Ansible using shell.

$ sudo apt-get install azure-cli

Within Ansible I used the code below to set the target VM after creating the inbound nat rule.

- name: Create inbound NAT rules
    shell: az network nic ip-config inbound-nat-rule add --ip-config-name <name>  --resource-group <name> --lb-name <name> --nic-name <name> --inbound-nat-rule <name>