1

I'm trying to run the Ansible modules junos_cli and junos_rollback and I get the following error:

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

The error appears to have been in '/home/quake/network-ansible/roles/junos-rollback/tasks/main.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: I've made a huge mistake
  ^ here

This is the role in question:

---
- name: I've made a huge mistake
  junos_rollback:
    host={{ inventory_hostname }}
    user=ansible
    comment={{ comment }}
    confirm={{ confirm }}
    rollback={{ rollback }}
    logfile={{ playbook_dir }}/library/logs/rollback.log
    diffs_file={{ playbook_dir }}/configs/{{ inventory_hostname }}

Here is the Juniper page: http://junos-ansible-modules.readthedocs.io/en/1.3.1/junos_rollback.html

Their example's syntax is a little odd. host uses a colon while the rest uses = signs. I've tried mixing both and only using one or the other. I keep getting errors.

I also confirmed that my junos-eznc version is higher than 1.2.2 (I have 2.0.1)

I've been able to use junos_cli before, I don't know if a version mismatch happened. On the official Ansible documentation, there is no mention of junos_cli or junos_rollback. Perhaps they're not supported anymore?

http://docs.ansible.com/ansible/list_of_network_modules.html#junos

Thanks,

Quake
  • 105
  • 1
  • 10

2 Answers2

1

junos_cli & junos_rollback are part of Galaxy and not core modules. You can find them at https://galaxy.ansible.com/Juniper/junos/

Is the content posted here has whole content of your playbook? if yes, You need to define other items too in your playbook such as roles, connection, local. For example

refer https://github.com/Juniper/ansible-junos-stdlib#example-playbook

```

---
- name: rollback example
  hosts: all
  roles:
    - Juniper.junos
  connection: local
  gather_facts: no

  tasks:
    - name: I've made a huge mistake
      junos_rollback:
        host = {{inventory_hostname}}
        ----
        ----

```

Nitin Kr
  • 521
  • 2
  • 12
  • The example above is a role called by my playbook. I also already installed the Juniper.Junos package: `$ ansible-galaxy install Juniper.junos - Juniper.junos is already installed, skipping.` That's what's confusing me. A month ago I was able to use the junos_cli module and now I get the module not found error. Perhaps updating Ansible to 2.0.2 broke them? I have no idea. ``` – Quake Apr 05 '17 at 13:32
0

Where have you saved the content of juniper.junos modules?. Can you post the content of your playbook and the output of the tree command to see your file structure? That could help.

I had a similar problem where Ansible was not finding my modules and what I did was to copy the juniper.junos folder to my roles folder and then added a tasks folder within it to execute the main.yaml from there.

Something like this: /Users/macuared/Ansible_projects/roles/Juniper.junos/tasks

---
- name: "TEST 1 - Gather Facts"
  junos_get_facts:
    host: "{{ inventory_hostname}}"
    user: "uuuuu"
    passwd: "yyyyyy"
    savedir: "/Users/macuared/Ansible_projects/Ouput/Facts"
  ignore_errors: True
  register: junos

- name: Checking Device Version
  debug: msg="{{ junos.facts.serialnumber }}"

Additionally, I would add "" to the string values in your YAML. Something like this:

---
- name: I've made a huge mistake
  junos_rollback:
    host="{{ inventory_hostname }}"
    user=ansible
    comment="{{ comment }}"
    confirm={{ confirm }}
    rollback={{ rollback }}
    logfile="{{ playbook_dir }}/library/logs/rollback.log"
    diffs_file="{{ playbook_dir }}/configs/{{ inventory_hostname }}"

Regarding this "I've tried mixing both and only using one or the other. I keep getting errors."

I've used just colon and mine works fine even when in the documentation suggests = signs. See junos_get_facts

Daniel Macuare
  • 72
  • 1
  • 2
  • 9