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.
On Wednesday, August 25, 2021 at 4:12:40 AM UTC+5:30 Vikram S wrote: > 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 > > On Monday, 23 August, 2021 at 8:50:10 am UTC+5:30 [email protected] > wrote: > >> Check kron module, it's similar to at. >> >> On Mon, 23 Aug, 2021, 6:19 am Vikram S, <[email protected]> wrote: >> >>> 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 >>> On Sunday, 22 August, 2021 at 2:57:05 am UTC+5:30 Erik Godding Boye >>> wrote: >>> >>>> Is *at* installed on your hosts? >>>> >>>> https://docs.ansible.com/ansible/2.5/modules/at_module.html#requirements >>>> >>>> On Sat, Aug 21, 2021 at 11:10 PM Vikram S <[email protected]> wrote: >>>> >>>>> 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 >>>>> >>>>> >>>>> -- >>>>> 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 view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/ansible-project/14e4a2b2-67f5-43ad-a407-897a73a3317cn%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/ansible-project/14e4a2b2-67f5-43ad-a407-897a73a3317cn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> 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 view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/64fc8b80-720e-4b2e-a38b-daffff68bcc9n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/ansible-project/64fc8b80-720e-4b2e-a38b-daffff68bcc9n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/77870949-ff03-4b4c-ac87-8fd982603238n%40googlegroups.com.
