Dustin C. Hatch 4d30798f54 newvm: Configure VM for dynamic inventory
This commit adds a new `--group` argument to the `newvm` script, which
adds the host to an Ansible group by listing it in the _libvirt_ domain
metadata.  Multiple groups can be specified by repeating the argument.
Additionally, the VM title is now always set to machine's FQDN, which
is what the dynamic inventory plugin uses to determine the inventory
hostname.

The dynamic inventory plugin parses the _libvirt_ domain metadata and
extracts group membership from the `<dch:groups>` XML element.  Each
`<dch:group>` sub-element specifies a group to which the host belongs.

Unfortunately, `virt-install` does not support modifying the
`<metadata>` element in the _libvirt_ domain XML document, so we have
to resort to using `virsh`.  To ensure the metadata are set before the
guest OS boots and tries to access them, we fork and run `virsh` in
a separate process.
2025-02-08 15:35:34 -06:00
2024-02-22 10:23:19 -06:00
2024-11-24 10:33:21 -06:00
2025-02-08 15:29:57 -06:00
2024-11-05 06:54:27 -06:00
2025-02-08 15:29:58 -06:00
2025-01-26 13:08:59 -06:00
2024-09-02 21:24:59 -05:00
2025-02-01 17:36:58 -06:00
2020-02-22 16:28:06 -06:00
2025-02-08 15:29:58 -06:00
2018-04-08 12:20:03 -05:00
2018-08-19 14:17:48 -05:00
2018-03-27 20:44:43 -05:00
2024-08-24 11:46:28 -05:00
2024-06-12 18:56:41 -05:00
2018-10-07 21:42:18 -05:00
2024-11-24 10:33:21 -06:00
2024-01-09 18:18:34 -06:00
2023-11-13 17:45:21 -06:00
2022-08-10 21:55:54 -05:00
2020-08-29 14:22:17 -05:00
2025-02-08 15:29:55 -06:00
2018-04-08 10:11:43 -05:00
2025-01-31 19:49:51 -06:00
2018-08-12 10:14:25 -05:00
2018-08-12 10:14:25 -05:00
2018-08-12 10:14:25 -05:00
2018-08-12 10:14:25 -05:00
2024-11-24 10:33:21 -06:00
2023-05-09 21:37:46 -05:00
2024-09-02 21:03:33 -05:00
2024-01-19 20:50:03 -06:00
2025-01-26 13:08:59 -06:00
2018-03-27 20:44:43 -05:00
2018-08-13 20:25:22 -05:00
2025-02-08 15:29:55 -06:00
2019-09-19 19:51:45 -05:00
2025-01-26 13:08:59 -06:00
2022-08-11 21:40:19 -05:00
Description
Ansible configuration policy for the private network/home lab of Dustin C. Hatch
http://dustin.hatch.name/
7.7 MiB
Languages
Jinja 86.2%
Python 6.6%
Shell 4.6%
Groovy 2.6%