モジュールjunos_get_facts
を使用可能にしようとしています。 juniper.junos
という役割の中で、メインのプレイブックといくつかのタスクがあります。例外:タスクでアクションが検出されていません。
ansible-脚本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:私は取得しています問題は、次の例外です/roles/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
ここで何が問題なのかよく分かりません。私はすべての依存関係がインストールされているvirtualenvを使用しています。
ありがとうございます、今は少しはっきりしています。あなたが言ったように、問題は "タスク"辞書にありました。エラーメッセージを読むときは、辞書ではなくタスクのリストを期待していたので、今やもっと意味があります。 –