【问题标题】:ERROR! no module/action detected in task in git clone ansible playbook错误!在 git clone ansible playbook 的任务中未检测到模块/操作
【发布时间】:2020-03-27 16:34:04
【问题描述】:

我无法弄清楚这里发生了什么。这是我非常简单的 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


    【解决方案1】:

    我能够找出问题所在。这工作正常。我只需要删除 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
    

    【讨论】:

      猜你喜欢
      • 2016-06-05
      • 1970-01-01
      • 2017-05-06
      • 2020-05-03
      • 2018-04-19
      • 1970-01-01
      • 1970-01-01
      • 2017-07-10
      相关资源
      最近更新 更多