skip to Main Content

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

enter image description here

is there any method to get the facts/information of a virtual machine in azure.

2

Answers


  1. 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
    
    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search