我正在调用一个模块,Ansible 仍然抱怨“无操作"; [英] I'm calling a module, Ansible still complains about "no action"

查看:29
本文介绍了我正在调用一个模块,Ansible 仍然抱怨“无操作";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ansible 出现错误,错误!任务中未检测到任何动作."根据

I'm getting an error with Ansible, "ERROR! No action detected in task." According to Why does Ansible show "ERROR! no action detected in task" error? , it looks like my error should be that I tried to write a role, and put a playbook in my role/tasks/main.yml. And the solution is to specify only a list of tasks in the tasks/main.yml file. Like this:

---
- name: My first task
  my_module:
    parameter1: value1

So my file looks like this:

---
- name: using a module
  ansible.builtin.command: echo hello there

So I am using a module, just like in the example shown elsewhere on StackOverflow, but still I get the error message. What am I missing?

This is for Ansible 2.9 on RHEL 7.7. Thanks.

解决方案

You are using ansible v2.9.

The (optional) full <namespace>.<collection>.<module_name> you are using in your task is only valid starting from ansible v2.10.

Use the short name: ansible.builtin.command => command.

You can also switch to the ansible v2.9 version on the documentation on the site to prevent this kind of problem when copy/pasting. See the dropdown on the top left

这篇关于我正在调用一个模块,Ansible 仍然抱怨“无操作";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆