feat: release v1.1.1 - host sorting by name/IP, sync destination overrides, and ~ expansion
Build and Publish Release / Build Packages and Publish (push) Successful in 25s

This commit is contained in:
soda64 committed 2026-10-03 22:05:00 +02:00
1 parent 598e5d7397
commit 62710d8bb7
19 files changed
+190 -34

No files matched your search

@@ -17,7 +17,7 @@ class AnsibleJsonExporter(BaseExporter):
}
# Populate hostvars
for name, host in sorted(data.hosts.items()):
for name, host in data.hosts.items():
hvars: Dict[str, Any] = {
"ansible_host": host.ansible_host,
"ansible_user": host.ansible_user,
@@ -26,7 +26,8 @@ class AnsibleJsonExporter(BaseExporter):
if host.ansible_ssh_private_key_file:
hvars["ansible_ssh_private_key_file"] = host.ansible_ssh_private_key_file
if host.tags:
hvars["tags"] = host.tags
tags_list = host.tags
hvars["tags"] = tags_list
for k, v in host.variables.items():
hvars[k] = v
payload["_meta"]["hostvars"][name] = hvars
@@ -34,7 +35,7 @@ class AnsibleJsonExporter(BaseExporter):
# Populate groups
for grp_name, host_names in sorted(data.groups.items()):
payload[grp_name] = {
"hosts": sorted(host_names)
"hosts": list(host_names)
}
return json.dumps(payload, indent=2) + "\n"
@@ -17,7 +17,7 @@ class AnsibleYamlExporter(BaseExporter):
grouped_hosts = set()
for group_name, host_names in sorted(data.groups.items()):
group_dict: Dict[str, Any] = {"hosts": {}}
for name in sorted(host_names):
for name in host_names:
host = data.get_host(name)
if not host:
continue
@@ -37,10 +37,10 @@ class AnsibleYamlExporter(BaseExporter):
structure["all"]["children"][group_name] = group_dict
# Ungrouped hosts placed directly under all.hosts
ungrouped = {name: host for name, host in data.hosts.items() if name not in grouped_hosts}
ungrouped = [host for name, host in data.hosts.items() if name not in grouped_hosts]
if ungrouped:
structure["all"]["hosts"] = {}
for name, host in sorted(ungrouped.items()):
for host in ungrouped:
host_vars = {
"ansible_host": host.ansible_host,
"ansible_user": host.ansible_user,
@@ -50,7 +50,7 @@ class AnsibleYamlExporter(BaseExporter):
host_vars["tags"] = host.tags
for k, v in host.variables.items():
host_vars[k] = v
structure["all"]["hosts"][name] = host_vars
structure["all"]["hosts"][host.name] = host_vars
return structure
@@ -8,7 +8,7 @@ class GenericYamlExporter(BaseExporter):
def _build_structure(self, data: InventoryData) -> Dict[str, Any]:
hosts_list: List[Dict[str, Any]] = []
for name, host in sorted(data.hosts.items()):
for name, host in data.hosts.items():
h_dict: Dict[str, Any] = {
"name": host.name,
"ip": host.ansible_host,
@@ -22,7 +22,7 @@ class GenericYamlExporter(BaseExporter):
groups_dict: Dict[str, List[str]] = {}
for grp_name, members in sorted(data.groups.items()):
groups_dict[grp_name] = sorted(members)
groups_dict[grp_name] = list(members)
return {
"hosts": hosts_list,
@@ -11,7 +11,7 @@ class IniExporter(BaseExporter):
grouped_hosts = set()
for grp_name, host_names in sorted(data.groups.items()):
lines.append(f"[{grp_name}]")
for h_name in sorted(host_names):
for h_name in host_names:
host = data.get_host(h_name)
if not host:
continue
@@ -29,7 +29,7 @@ class IniExporter(BaseExporter):
lines.append("")
# Ungrouped hosts
ungrouped = [h for name, h in sorted(data.hosts.items()) if name not in grouped_hosts]
ungrouped = [h for name, h in data.hosts.items() if name not in grouped_hosts]
if ungrouped:
lines.append("[ungrouped]")
for host in ungrouped:
@@ -8,7 +8,7 @@ class LinuxConnectorExporter(BaseExporter):
def _build_structure(self, data: InventoryData) -> Dict[str, Any]:
hosts_list: List[Dict[str, Any]] = []
for name, host in sorted(data.hosts.items()):
for name, host in data.hosts.items():
h_dict: Dict[str, Any] = {
"name": host.name,
"hostname": host.ansible_host,
@@ -25,7 +25,7 @@ class LinuxConnectorExporter(BaseExporter):
groups_dict: Dict[str, List[str]] = {}
for grp_name, members in sorted(data.groups.items()):
groups_dict[grp_name] = sorted(members)
groups_dict[grp_name] = list(members)
return {
"hosts": hosts_list,
@@ -12,7 +12,7 @@ class XmlExporter(BaseExporter):
root.set("generated_at", datetime.now(timezone.utc).isoformat())
hosts_elem = ET.SubElement(root, "hosts")
for name, host in sorted(data.hosts.items()):
for name, host in data.hosts.items():
h_elem = ET.SubElement(hosts_elem, "host")
h_elem.set("name", host.name)
h_elem.set("ip", host.ansible_host)
@@ -43,7 +43,7 @@ class XmlExporter(BaseExporter):
for grp_name, members in sorted(data.groups.items()):
g_elem = ET.SubElement(groups_elem, "group")
g_elem.set("name", grp_name)
for m in sorted(members):
for m in members:
m_elem = ET.SubElement(g_elem, "member")
m_elem.text = m