首页 > 解决方案 > 错误!在 git clone ansible playbook 的任务中未检测到模块/操作

问题描述

我无法弄清楚这里发生了什么。这是我非常简单的 ansible 剧本:

---
  - name: "Playing with Ansible and Git"
    hosts: localhost
    connection: local
    tasks:
        - name: "clone the repo"
        - become: yes
        - git:
            repo: https://github.com/ansible/ansible-examples.git
            dest: /opt/
            clone: yes
            update: yes

这是我的 ansible-playbook 版本

ansible-playbook --version
ansible-playbook 2.9.6

错误

ERROR! no module/action detected in task.

The error appears to be in 'local.yml': line 6, column 11, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    tasks:
        - name: "clone the repo"
          ^ here

我跑过去ansible-playbook local.yml

我真的无法弄清楚这里出了什么问题。

标签: ansible

解决方案


我能够弄清楚这个问题。这工作正常。我只需要-在 git 前面删除。

---
  - name: "Playing with Ansible and Git"
    hosts: localhost
    connection: local
    tasks:
        - name: "clone the repo"
          git:
            repo: https://github.com/ansible/ansible-examples.git
            dest: /opt/
            clone: yes
            update: yes

推荐阅读