Created
June 16, 2023 18:03
-
-
Save nleiva/354589d18a73f7202ca9aaece89a6b4a to your computer and use it in GitHub Desktop.
Ansible native parser template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- example: "object-group network TEST-NETWORK" | |
getval: 'object-group\s(?P<type>\S+)\s(?P<name>\S+)' | |
result: | |
"{{ name }}": | |
name: "{{ name }}" | |
type: "{{ type }}" | |
shared: True | |
- example: " network-object host 100.64.0.1" | |
getval: '\snetwork-object\shost\s(?P<host>\S+)' | |
result: | |
"{{ name }}": | |
{host: ["{{ host }}"]} | |
- example: "service-object tcp destination eq ftp" | |
getval: '\sservice-object\stcp\sdestination\seq\s(?P<port>\S+)' | |
result: | |
"{{ name }}": | |
{tcp: ["{{ port }}"]} | |
- example: "service-object object NAME" | |
getval: '\s*service-object\sobject\s(?P<object>\S+)' | |
result: | |
"{{ name }}": | |
{object : ["{{ object }}"] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment