Having trouble copying registered result to local file.

15 views
Skip to first unread message

Marcos Georgopoulos

unread,
Mar 5, 2018, 11:24:17 PM3/5/18
to Ansible Project
Hi,

I am trying to save some results that I have registered to a file on my local machine ( that is running ansible ) The error I am getting is very generic and of no use.  Below is the playbook and the resulting error

---
- hosts: ios
  gather_facts
: no
  connection
: local
  vars
:
    cli
:
       host
: "{{ inventory_hostname }}"
       username
: cisco
       password
: cisco
       auth_pass
: cisco


  tasks
:
 
 
- name: DEFINE PROVIDER
    set_fact
:
      provider
:
        host
: "{{ inventory_hostname }}"
        username
: cisco
        password
: cisco
        auth_pass
: cisco
 
 
- name: RUN 'SHOW RUN'
    ios_command
:
      provider
: "{{ cli }}"
      authorize
: yes
      commands
:
       
- show run
   
register: before_base
 
 
- debug: var=before_base.stdout_lines




 
- name: "write to local file"
    copy
:
      content
: "{{ before_base.stdout_lines }}"
      dest
: /tmp/test
      backup
: yes
    run_once
: yes
    delegate_to
: localhost




fatal: [172.16.1.127 -> localhost]: FAILED! => {

    "changed": false, 

    "checksum": "d3b2821b4ae84267794786164cdbd16ac3752ad1", 

    "diff": [], 

    "failed": true, 

    "module_stderr": "", 

    "module_stdout": "", 

    "msg": "MODULE FAILURE", 

    "rc": 0



Could someone please explain why this is failing and provide me with a way to do this simple task. Many thanks.




Marcos Georgopoulos

unread,
Mar 6, 2018, 5:55:16 AM3/6/18
to Ansible Project
ok, I managed to solve this, there was a problem with my install.

Tony Chia

unread,
Mar 6, 2018, 4:43:20 PM3/6/18
to Ansible Project
It's unclear which task the error is coming from. Next time please include more log messages 
Reply all
Reply to author
Forward
0 new messages