Page MenuHomeVyOS Platform

show configuration in json format
Closed, ResolvedPublicFEATURE REQUEST

Description

Suggested syntax for op-mode:

show configuration json

For example, it will be easier to get information in json format for some automation tools like ansible
https://github.com/ansible-collections/vyos.vyos/blob/0a43a34d544d6f4f6055aa8a534fcf602fd235f2/plugins/cliconf/vyos.py#L97-L112

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Unspecified (please specify)

Event Timeline

Viacheslav set Issue type to Unspecified (please specify).
Viacheslav changed the task status from Open to In progress.Nov 29 2021, 7:29 PM
Viacheslav claimed this task.

PR https://github.com/vyos/vyos-1x/pull/1090

vyos@r11-roll:~$ show configuration json pretty 
{
    "interfaces": {
        "ethernet": {
            "eth0": {
                "address": [
                    "192.168.122.11/24"
                ],
                "hw-id": "52:54:00:48:a0:c6"
            },
            "eth1": {
                "hw-id": "52:54:00:fc:50:0b"
            },
            "eth2": {
                "hw-id": "52:54:00:e5:2f:51"
            }
        },
        "loopback": {
            "lo": {}
        }
    },
    "protocols": {
        "static": {
            "route": {
                "0.0.0.0/0": {
                    "next-hop": {
                        "192.168.122.1": {}
                    }
                }
            }
        }
    },
    "service": {
        "ssh": {
            "disable-host-validation": {}
        }
    },
    "system": {
        "config-management": {
            "commit-revisions": "100"
        },
        "conntrack": {
            "modules": {
                "ftp": {},
                "h323": {},
                "nfs": {},
                "pptp": {},
                "sip": {},
                "sqlnet": {},
                "tftp": {}
            }
        },
        "console": {
            "device": {
                "ttyS0": {
                    "speed": "115200"
                }
            }
        },
        "host-name": "r11-roll",
        "login": {
            "user": {
                "vyos": {
                    "authentication": {
                        "encrypted-password": "$45OXXXX",
                        "plaintext-password": "",
                        "public-keys": {
                            "vyos@vyos": {
                                "key": "AAXXXXk=",
                                "type": "ssh-rsa"
                            }
                        }
                    }
                }
            }
        },
        "name-server": [
            "1.1.1.1"
        ],
        "ntp": {
            "server": {
                "time1.vyos.net": {},
                "time2.vyos.net": {},
                "time3.vyos.net": {}
            }
        },
        "syslog": {
            "global": {
                "facility": {
                    "all": {
                        "level": "info"
                    },
                    "protocols": {
                        "level": "debug"
                    }
                }
            }
        },
        "time-zone": "Europe/Madrid"
    }
}

JSON and JSON pretty format:

show configuration json
show configuration json pretty
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus (1.3.0) board.