0

Pls help ! I need create some web app from ansible, and add this web app to an existing VNet.

For create WebApp i use ansible module - azure_rm_webapp, and all work fine but i can`t find any way configuring network for created web app.

Can i do it from ansible? How can i do this ? I read about ansible module for creating network (may be there i can add , but also not find )

Sergey
  • 179
  • 6
  • 17

1 Answers1

1

I am afraid that we can not do VNet integration using ansible module. Here are all modules for Azure by using ansible and ansible-playbooks samples.

In this case, you may consider using some shell, script, or win_shell modules to execute some commands on target hosts after the VM provision. Here is an arm template for deploying a web app with VNet integration.

If you consider other automatic deployment tools. I would like to recommend the terraform tool. it supports resource azurerm_app_service_virtual_network_swift_connection which makes you manage an App Service Virtual Network Association. Also, you can use ip_restriction block and scm_ip_restriction block under the resource azurerm_app_service to configure Access restriction.

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • Big thanks for answer ! I`m new in WebApp so , how can i run shell script from ansible ? I need use shell module , and this command will run on "host" machine in azure ? or i need install azure cli on my host where i run ansible and run azure cli command ? – Sergey Jul 22 '20 at 08:33
  • I think you need to install azure cli on the host and copy the script to the remote host then run the shell module to execute the commands. [example1](https://stackoverflow.com/questions/21160776/how-to-execute-a-shell-script-on-a-remote-server-using-ansible), [eg2](https://www.middlewareinventory.com/blog/ansible-shell-examples/) – Nancy Jul 22 '20 at 09:15