Why is Ansible showing the error "ERROR! No action detected in task"?

Ansible shows an error:

ERROR! no actions were found in the task. This often indicates the name of the module with an error or the wrong path to the module.

What's wrong?


Exact transcript:

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in 'playbook.yml': line 10, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: My task name
  ^ here
+4
source share
1 answer

Reason number 1

You are using an older version of Ansible that did not have the module you are trying to run.

How to check it?

  • Open the list of modules module documentation and find the documentation page for your module.

  • Read the title at the top of the page - it usually shows the version of Ansible in which the module was introduced. For instance:

    New in version 2.2.

  • , Ansible . Run:

    ansible-playbook --version
    

    . - :

    ansible-playbook 2.4.1.0


№ 2

my_role/tasks/main.yml.

tasks/main.yml . :

---
- name: Configure servers
  hosts: my_hosts
  tasks:
    - name: My first task
      my_module:
        parameter1: value1

Ansible hosts tasks. , .

: tasks/main.yml:

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

№ 3

.

, . , users user, Ansible " ".

Ansible . , , "" .

, qLQn1BHxzirz, Ansible . , "" .


№ 4

, Ansible.

, , Ansible.

, - , , .

modules , .

ANSIBLE_LIBRARY --module-path.

, , :

ansible-playbook --version

:

=

2.4 .


№ 5

.

. :

- name: My task
  become: true
+13

Source: https://habr.com/ru/post/1688876/


All Articles