Hi,
I am attempting to schedule a playbook to run every night to backup Cisco
network device configs using crontab.
The playbook is a simple ios_command task executing show run on the Cisco
Devices.
The playbook works fine when I run it manually and I have got to the point
where crontab is runs the playbook.
However when crontab runs the playbook the playbook is failing and the only
output I can see is this:(from ansible.log)
2017-07-12 17:52:01,981 p=6113 u=root | ERROR! Extraneous options or
arguments
2017-07-12 17:54:02,232 p=6122 u=root | ERROR! Extraneous options or
arguments
2017-07-12 17:56:01,525 p=6131 u=root | ERROR! Extraneous options or
arguments
As you can see this is every 2 minutes and for testing purposes crontab is
running the playbook every 2 minutes.
crontab:
*/2 * * * * /usr/bin/ansible
/home/ansibleuser/ansible/playbooks/ansible-playbook device_bak_2.yml
playbook which runs perfectly manually:
---
- hosts: CISCO_SWITCHES_ALL
connection: local
vars:
backup_root: /home/ansibleuser/Configs
tasks:
- name: run show running-config on remote devices
ios_command:
commands: show running
timeout: 20
register: config
- name: ensure backup folder is created
file:
path: "{{ backup_root }}"
state: directory
run_once: yes
- name: ensure device folder is created
file:
path: "{{ backup_root }}/{{ inventory_hostname }}"
state: directory
- copy:
content: "{{ config.stdout[0] }}"
dest: "{{ backup_root }}/{{ inventory_hostname }}/running-config_{{
ansible_date_time.year }}{{ ansible_date_time.month }}{{
ansible_date_time.day }}{{ ansible_date_time.hour }}{{
ansible_date_time.minute }}{{ ansible_date_time.second }}"
Does anyone have an idea how I can generate more debug output than just
"ERROR! Extraneous options or arguments" ?
Even better if someone knows how I can fix this !!
Kind regards,
Phil.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/0791b635-e754-4527-b76b-db73049bc01b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.