One question regarding the following code snippet. I would love to hear a high level explanation of what this code has achieved line by line. If it is too long answer to write, I would like to at least understand how/where “a, b, c” is persisted to (are they actually being persisted to host_vars/foo, host_vars/bar and group_vars/webserver?)
I can’t really speak from experience with the cobbler script, but for most other dynamic inventory scripts, vars for each host end up in hostvars[hostname]. The the json output from the cobbler script would shed more light on how it works.
In the above, a new profile is created based on the CentOS one. This is done so that specific kickstart metadata (the ksmeta options) can be assigned to it. The kickstart metadata will be listed as variables in the Ansible inventory. Two new systems are then created using the new profile, assigned to a management class (the equivalent of a group in Ansible), and additional metadata are assigned to it.
When viewed with --host, the foo server would look like this: