Ich versuche, das Modul junos_get_facts
in Ansible zu verwenden. Ich habe ein Hauptspielbuch und einige Aufgaben in der Rolle juniper.junos
. Das Problem Ich erhalte die folgende Ausnahme:Ausnahme: keine Aktion in Aufgabe
ansible-Textbuch main_pb.yml
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/Users/macuared/Ansible_projects/roles/juniper.junos/tasks/main.yaml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: Test junos_get_facts module
^here
The error appears to have been in '/Users/macuared/Ansible_projects/roles/juniper.junos/tasks/main.yaml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: Test junos_get_facts module
^here
exception type: <class 'ansible.errors.AnsibleParserError'>
exception: no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/Users/macuared/Ansible_projects/roles/juniper.junos/tasks/main.yaml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: Test junos_get_facts module
^here
~/Ansible_projects/main_pb.yml
---
- name: Gathering Info from devices
hosts: man3-rc-test4200-01
connection: local
gather_facts: no
roles:
- { role: 'juniper.junos', when: DEVICE_TYPE == 'info' }
~/Ansible_projects /role/Juniper.junos/tasks/main.yaml
---
- name: Test junos_get_facts module
tasks:
- name: "TEST 1 - Gather Facts"
junos_get_facts:
host: "{{ inventory_hostname}}"
user: "YYYYYYY"
passwd: "XXXXXXX"
ignore_errors: True
register: junos
# - debug: var=junos
- name: Check TEST 1
assert:
that:
- junos.facts.hostname
- junos.facts.serialnumber
- junos.facts.model
- junos.facts.fqdn
Ich bin mir nicht sicher, was das Problem hier ist. Ich benutze ein virtualenv, wo ich alle meine Abhängigkeiten installiert habe.
Danke, es ist jetzt ein bisschen klarer. Das Problem war mit dem Wörterbuch "Aufgaben", wie du gesagt hast. Es macht jetzt mehr Sinn beim Lesen der Fehlermeldung, da es nur eine Liste von Aufgaben erwartet, kein Wörterbuch. –