getting error when trying to use 'at' module to schedule a script

97 views
Skip to first unread message

Vikram S

unread,
Aug 21, 2021, 5:09:52 PM8/21/21
to Ansible Project

I tried to schdule a script to be run at a particular time as per the instruction in documentation for 'at' module. However iam getting below error. Not sure what iam doing wrong, please guide.

First, i wrote a script which references another script that need to be executed in 5 minutes. Both scripts are in same directory. However when i run this script, it shows below error:

i wonder if 'hosts: TESTFIREWALL' is needed as iam not running this script on a remote host but i tried adding and removing it yet got error on both occassions.

---

- name: PLAYBOOK

  hosts: TESTFIREWALL

  serial: 1

  gather_facts: false

  connection: network_cli


  vars:

    ansible_network_os: asa


  tasks:

    - name: Schedule a command to execute in 2 minutes

      at:

        script_file: firewallrules.yaml

        count: 2

        units: minutes


ERROR:

TASK [Schedule a command to execute in 5 minutes] ******************************************************************************************************************************************* fatal: [TESTFIREWALL]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "Failed to find required executable at in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}



Below is the firewallrules.yaml script that is referenced in above script:

---

- name: PLAYBOOK

  hosts: TESTFIREWALL

  serial: 1

  gather_facts: false

  connection: network_cli


  vars:

    ansible_network_os: asa


  tasks:

    - name: Gather all legacy facts

      cisco.asa.asa_facts:

        gather_subset: hardware


Thanks,
Vikram


Erik Godding Boye

unread,
Aug 21, 2021, 5:27:05 PM8/21/21
to ansible...@googlegroups.com

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/14e4a2b2-67f5-43ad-a407-897a73a3317cn%40googlegroups.com.

Melvin Satheesan

unread,
Aug 21, 2021, 9:36:40 PM8/21/21
to ansible...@googlegroups.com
It seems environment issue. Find the 'at' command location and export to the binary path. 

Vikram S

unread,
Aug 22, 2021, 8:49:32 PM8/22/21
to Ansible Project
Hi Erik,

no, i wanted to schedule a script to be run on a cisco switch/firewall (network device). i don't think 'at' module can be installed on a network device.

so is there any other way i can schedule script to be run in device in below format?

2960 switch-1 - run 2960upgrade.yaml - run at 2:30 pm

3650 switch - 3650upgrade.yaml - run at 3:30 pm

2960 switch-2 - 2960upgrade.yaml - run at 4:30 pm


Thanks,
Vikram

Melvin Satheesan

unread,
Aug 22, 2021, 11:20:10 PM8/22/21
to ansible...@googlegroups.com
Check kron module, it's similar to at. 

Vikram S

unread,
Aug 24, 2021, 6:42:40 PM8/24/21
to Ansible Project
Hi,

After going tghrough documentation for cron module, i doubt if it would help in scheduling script to be executed in network devices. Are you sure it helps with scheduling for scisco network devices?

Regards,
Vikram

rajthecomputerguy

unread,
Aug 25, 2021, 9:44:36 PM8/25/21
to Ansible Project
We cannot execute any script on network devices, execution will happen only in the Ansible server . The cron job will only do the scheduling job.  
Reply all
Reply to author
Forward
0 new messages