# Azure IP ASG

**URL:** <https://forum.ansible.com/t/azure-ip-asg/36416>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [March 9, 2022, 8:20pm UTC](https://forum.ansible.com/t/azure-ip-asg/36416 "2022-03-09T20:20:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitrous](https://avatars.discourse-cdn.com/v4/letter/n/dfb087/32.png) [@Nitrous](https://forum.ansible.com/u/Nitrous)\
**Post date:** [March 9, 2022, 8:20pm UTC](https://forum.ansible.com/t/azure-ip-asg/36416/1 "2022-03-09T20:20:01Z")

</div>

How would you make this work, only if ASG is provided:

ip\_configurations:

- name:xxxx  
primary: True  
private\_ip\_allocation\_method: Static  
private\_ip\_address: ‘{{ server.az\_vm\_ipaddress }}’  
#application\_security\_groups: ‘{{ server.az\_vm\_asg }}’

If in my az\_vm\_asg is not defined as a variable in my yaml file for the build, it errors out, saying:

“The error was: ‘dict object’ has no attribute ‘az\_vm\_asg’”

So I have to comment out the asg section in the module for azure\_rm\_networkinterface, for the build to run. Is it possible to not have that commented out and still have a null variable accepted for az\_vm\_asg,  
in my yaml build file? Thanks

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 9, 2022, 10:50pm UTC](https://forum.ansible.com/t/azure-ip-asg/36416/2 "2022-03-09T22:50:01Z")

</div>

[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_filters.html#making-variables-optional](https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#making-variables-optional)
