Skip to content

meerkampdvv/ansible-xml-to-json-filter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible XML to JSON filter

Custom filter plugin to convert XML outputs to JSON. There is not external dependencies. Every node attribute name is prefixed by using a '@'. Example:

"{{ '<test>this is a test</test>' | from_xml }}"
"{{ '<test>this is a test</test>' | xml_to_json }}"
Filter Description
from_xml Convert XML to python dictionary
xml_to_json Convert XML to JSON

How to use

Create a ansible.cfg file in the root of your playbook path. Add the following content:

[defaults]
filter_plugins = ./filter_plugins

Run the example

playbook.yml is a simple use case that uses a nmap XML output o test the plugin. To run this playbook you need nmap installed in your system and also make sure you run the example playbook as root.

$ ansible-playbook playbook.yaml --ask-become-pass --become

About

Ansible XML to JSON filter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%