Python 如何使用ansible以csv格式导入每个ip的配置网络输出?
我需要知道如何使用ansible和python以csv格式打印网络ipv6地址。我正在使用vscode运行剧本 这是运行任务后的输出:任务内存 确定[ip地址]->{msg:“主机名,ip,153.2.242.166”} 这就是代码Python 如何使用ansible以csv格式导入每个ip的配置网络输出?,python,csv,ansible,Python,Csv,Ansible,我需要知道如何使用ansible和python以csv格式打印网络ipv6地址。我正在使用vscode运行剧本 这是运行任务后的输出:任务内存 确定[ip地址]->{msg:“主机名,ip,153.2.242.166”} 这就是代码 --- -hosts: all tasks: - name: ports command: "grep net. ipv4.ip_local_reserved_ports /etc/systc1. conf" register: grep_o
---
-hosts: all
tasks:
- name: ports
command: "grep net. ipv4.ip_local_reserved_ports /etc/systc1. conf"
register: grep_output
- name: ram
debug:
msg:"{{inventory_hostname_short}}, memory{{ansible_memory_mb['real']['total'}}"
只需将收集到的数据导出到json,然后使用制表模块转换整个集合。或者用值填充sqlite db并将数据导出到csv。我使用文件模块中的行。您是否编写了一些代码?是的,@RHP 12。我有。是shell命令吗?它有命令模块