I created playbook which deploy Centos VM in azure. It is working fine.
I want in this playbook to install application on that deployed VM. How can I continue with this playbook and install application on this VM?
---
- name: Create Azure VM
hosts: 127.0.0.1
connection: local
gather_facts: False
tasks:
- name: Azure VM creation
azure_rm_virtualmachine:
name: AnsibleTestVM19
location: 'westus'
admin_username: salfand
admin_password: Netapp123456
resource_group: forAnsible
virtual_network_name: AnsibleVnet
image:
offer: CentOS
publisher: OpenLogic
sku: '7.2'
version: latest
register : azure
- name : Debug Azure output
debug :
var : azure
- name: Wait for SSH to come up
wait_for: host="{{ azure_vm.properties.networkProfile.networkInterfaces[0].properties.ipConfigurations[0].properties.publicIPAddress.properties.ipAddress }}" port=22 delay=60 timeout=320 state=started
- name: Get VM information
blockinfile:
create: yes
dest: /etc/ansible/playbooks/occm_info.txt
block: |
OCCM URL: http://{{ azure_vm.properties.networkProfile.networkInterfaces[0].properties.ipConfigurations[0].properties.publicIPAddress.properties.ipAddress }}