Replies: 1 comment 2 replies
-
Please, format your issue properly so it's easy to read. Thanks |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear David:
how can I use write_file in nornir_utils.plugins.tasks.files to let outputs from different commands write in a same file.
The coding is :
from nornir import InitNornir
from nornir_netmiko import netmiko_send_command
from nornir_utils.plugins.functions import print_result
from nornir_utils.plugins.tasks.files import write_file
from datetime import date
import time
start_time = time.time()
def analysis_results(tasks):
for cmd in commands:
r = task.run(task=netmiko_send_command, command_string=cmd)
task.run(task=write_file, content=r.result, filename=str(task.host.name)+'-'+str(date.today())+'-analysis.txt')
Regards
Michael
Beta Was this translation helpful? Give feedback.
All reactions