【问题标题】:Get virtual machine facts using ansible使用 ansible 获取虚拟机事实
【发布时间】:2022-06-10 19:56:31
【问题描述】:

我正在运行一个 ansible playbook 以在我的 playbook 看起来像 azure 中获取虚拟机的状态

- name: Get facts by name
  azure_rm_virtualmachine_facts:
    resource_group: startAnsible
    name: startAnsible-vm

enter image description here

有什么方法可以在 Azure 中获取虚拟机的事实/信息。

【问题讨论】:

  • 请不要发布文字图片。只需在您的问题中包含文本本身,格式为代码示例。

标签: azure ansible


【解决方案1】:

您的代码是一项任务,但由于错误,您正试图将其作为一个游戏来执行。

剧本文件包含剧本列表,每个剧本执行任务(和/或角色)列表。

所以你需要把你的任务放在一个戏剧中:

- 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

【讨论】:

    猜你喜欢
    • 2018-10-27
    • 2019-11-06
    • 2022-01-25
    • 2020-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-26
    相关资源
    最近更新 更多