Hi,
I want to execute specified task in ansible playbook after every 30 mins. Task is not just a command, so “at” module does not work in my case or may be I am not doing it in proper way :
Here is my play book. Playbook below runs correctly for single time. I want to collect the stats after every 30 mins, so how should I do that… Can you guys please suggest solution ?
- hosts: zmr
gather_facts: no
vars:
date: “{{ lookup(‘pipe’, ‘date +%Y%m%d-%H%M’) }}”
tasks: - name: set the winsize
shell: stty cols 5000 rows 5000 - name: Get the debug status
ignore_errors: yes
expect:
command: /opt/wishu/ZMR_Platform/bin/go_zmr_cli
timeout: 5
responses:
(.)Username:(.): “admin”
(.)Password:(.): “admin”
(.)ZMR>(.): display debug info PP ip 192.168.30.26 port 8686
(.):(.): " q"
timeout: 30
register: stats - local_action: copy content=“{{ stats_.stdout}}” dest=“/home/sam/stats_{{ lookup(‘pipe’, ‘date +%Y%m%d-%H%M’) }}.txt”
ignore_errors: yes