Ansible-如何在Azure Cloud Shell中运行YAML代码

Ansible-如何在Azure Cloud Shell中运行YAML代码,azure,ansible,azure-cloud-shell,Azure,Ansible,Azure Cloud Shell,问题:如何在Azure云Shell中运行以下YAML 在的步骤1中,作者要求运行以下YAML-以创建资源组。我正在Azure Cloud Shell中使用PowerShell(Ansible是预安装的) 将其保存到playbook.yaml文本文件中,并使用ansible playbook playbook.yaml运行,但您还需要对playbook文件具有适当的结构。大概是这样的: --- - hosts: localhost tasks: - name: Create resourc

问题:如何在
Azure云Shell
中运行以下
YAML

在的步骤1中,作者要求运行以下
YAML
-以创建资源组。我正在Azure Cloud Shell中使用PowerShell(Ansible是预安装的)


将其保存到playbook.yaml文本文件中,并使用ansible playbook playbook.yaml运行,但您还需要对playbook文件具有适当的结构。大概是这样的:

---
- hosts: localhost
  tasks:
  - name: Create resource groupf
    azure_rm_resourcegroup:
      name: rg-cs-ansible
      location: eastus

我在
playbook.yaml
文件中运行了您的脚本,发现以下错误-有什么建议吗<代码>错误!加载任务时遇到格式错误的块:{u'azure\u rm_resourcegroup':None,u'name':u'rg-cs-ansible',u'location':u'eastus'}应为列表或无,但错误似乎位于“/home/myaccount/clouddrive/MyTestDir/createrg.yaml”:第1行第3列,但可能位于文件的其他位置,具体取决于语法问题。有问题的行似乎是:-name:Create resource group^ here可能已经修复了它,已经3年没有使用ansible了,或者你的修复建议奏效了(谢谢)。文章作者没有提到如何运行他/她的代码块。有没有其他方法可以运行他/她的区块?
---
- hosts: localhost
  tasks:
  - name: Create resource groupf
    azure_rm_resourcegroup:
      name: rg-cs-ansible
      location: eastus