【问题标题】:Location of Ansible playbook when running in Azure Cloud Shell在 Azure Cloud Shell 中运行时 Ansible playbook 的位置
【发布时间】:2020-10-25 15:12:31
【问题描述】:

This 官方文档 Quickstart: Configure Ansible using Azure Cloud Shell 来自 MS Azure 站点,要求您先将以下代码保存为 create_rg.yml,然后在 Azure Cloud shell 中运行 ansible-playbook 命令(如下面的第二个代码块所示)。

问题:在运行命令之前,您将create_rg.yml 保存在哪里(如下面的第二个代码块所示)?

创建_rg.yml 文件

---
- hosts: localhost
  connection: local
  tasks:
    - name: Creating resource group - "{{ name }}"
      azure_rm_resourcegroup:
        name: "{{ name }}"
        location: "{{ location }}"
      register: rg
    - debug:
        var: rg

ansible-playbook 命令运行 Azure Cloud Shell

ansible-playbook create_rg.yml --extra-vars "name=<resource_group_name> location=<resource_group_location>"

备注:当我将本地文件夹中的 create_rg.yml 文件保存为C:\TestFolder\create_rg.yml 时,上述命令给出以下错误:

错误!剧本:找不到 C:\TestFolder\create_rg.yml

【问题讨论】:

  • 检查文件权限。

标签: azure xaml ansible azure-cloud-shell


【解决方案1】:

您可以将 .yml 文件保存到 PowerShell 中的目录 /home/nancy 或 Azure Cloud Shell 中的 Bash,而不是本地文件夹。有一个内置的 ansible tool in Azure cloud Shell

【讨论】:

  • 如果您有时间评论/建议解决方案,我会在here 发布另一个问题。
猜你喜欢
  • 2013-12-09
  • 2022-01-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-04
相关资源
最近更新 更多