Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add virt facts module for networks #56327

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@chrisred
Copy link

commented May 11, 2019

SUMMARY

A facts module for libvirt virtual networks. Facts are (mostly) generated from the XML configuration of the network, the XML document is loaded through a Config object to allow selected elements to be returned keeping the JSON output clean.

As facts are parsed from the XML config the keys returned can differ slightly depending on the resource configuration. However a key for each main config "item" is always present to provide a stable set of return values.

module_utils/virt.py is also included in this commit and contains shared functions used in this module and intended for use in other virt "facts" modules which parse the XML config of a libvirt resource. Additional pull requests to be generated separately for domain (VM) and storage pool modules will use these "utils" functions.

Related to #27905 about issues with the existing virt modules.

For reference #56085 has this network facts module along with the others for domains and pools. As per the guidelines they are being split into separate pull requests.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

virt_net_facts

ADDITIONAL INFORMATION

Example output from a simple virtual network.

lab-ln-kvm1 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python",
        "virt_networks": {
            "host-only": {
                "active": false,
                "autostart": true,
                "bridge": {
                    "delay": "0",
                    "name": "virbr1",
                    "stp": "on"
                },
                "connections": null,
                "dns": null,
                "domain": null,
                "forward": null,
                "ip": [
                    {
                        "address": "192.168.123.1",
                        "dhcp_range_end": "192.168.123.254",
                        "dhcp_range_start": "192.168.123.2",
                        "netmask": "255.255.255.0"
                    }
                ],
                "mac_address": "52:54:00:6f:7c:62",
                "mtu": null,
                "name": "host-only",
                "persistent": true,
                "portgroup": [],
                "static_route": [],
                "uuid": "40a77b1f-00a2-4464-9522-6bbcc74f5341",
                "virtualport": null,
                "vlan": null
            }
        },
        "virt_networks_live": null
    },
    "changed": false
}

Chris Redit
@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 11, 2019

@TimothyVandenbrande @UnderGreen @cheese @drybjed @flaper87 @helldorado @joshainglis @karmab @machacekondra @mnecas @mwperina

As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add shipit if you would like to see it merged.

click here for bot help

@ansibot ansibot added the stale_ci label May 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.