I am running a ansible playbook to get the status of virtual machine in azure my playbook look likes
- name: Get facts by name
azure_rm_virtualmachine_facts:
resource_group: startAnsible
name: startAnsible-vm
is there any method to get the facts/information of a virtual machine in azure.
CodePudding user response:
Your code is a task but from the error, you are trying to execute it as a play.
Playbook files contains a list of plays and each play execute a list of tasks (and/or roles).
So you need to put your task in a play:
- name: The play
hosts: <the target machine from your inventory>
tasks:
- name: Get facts by name
azure_rm_virtualmachine_facts:
resource_group: startAnsible
name: startAnsible-vm
CodePudding user response:
Within the initial error message the correct module is referenced azure_rm_virtualmachine_info
to get the virtual machine facts, whereby in the code snippet a probably old alias is used.
Further Links