I have jar file that i want to deploy to diffrent hosts using ansible
so i configured my inventory with the domains of my webapps
[webapps]
domainofwebapp1.com resource_group=RG web_app=WEBAPPname
domainofwebapp2.com resource_group=RG web_app=WEBAPPname
domainofwebapp3.com resource_group=RG web_app=WEBAPPname
domainofwebapp4.com resource_group=RG web_app=WEBAPPname
than i created a playbook to deploy via Az deploy as follow :
- name: Deploy JAR to Azure Web App
hosts: webapps
gather_facts: no
tasks:
- name: Run Azure login command
shell: >
az login --service-principal -u "clientID" -p "SECRET" --tenant "TEnantID"
- name: Deploy JAR file to Azure Web App
shell: >
az webapp deploy --resource-group {{ hostvars[inventory_hostname].resource_group }} --name {{ hostvars[inventory_hostname].web_app }} --src-path "/path/to/your/local/jar/file.jar" --type jar
also i did configure ~/.azure/credentials
[default]
subscription_id=<subscription_id>
client_id=<service_principal_app_id>
secret=<service_principal_password>
tenant=<service_principal_tenant_id>
Yet i always get this error
domainofwebapp1.com | UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh: ssh: connect to host domainofwebapp1.com port 22: Connection timed out”,
“unreachable”: true
}
I don’t want to use SSH i want to configure it to not use ssh and use Service Principle instead
i tried also the az.collection azure_rm_webapp: module yet i couldn’ deploy with it to the webapp it only help to create the web app .
CAN YOU HELP ME PLEASE TO DEPLOY SUCCEFULLY TO A GROUP OF AZURE WEBAPPS USING ANSIBLE .