Commits vergleichen
Keine gemeinsamen Commits. "c396f6c628ae6ec3fe655bc49630ad06784924f6" und "f3a1e25323522969ea6e80413b7e1a38e3bc5dec" haben vollständig unterschiedliche Historien.
c396f6c628
...
f3a1e25323
|
@ -5,27 +5,6 @@ stop50.ansible-netcup Release Notes
|
|||
.. contents:: Topics
|
||||
|
||||
|
||||
v0.1.2
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
added additional_info parameter
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- added additional_info to the config. this allows addtional data to be added to the inventory
|
||||
|
||||
v0.1.1
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
added nickname_is_hostname config to let the nickname be the hostname of the host
|
||||
|
||||
v0.1.0
|
||||
======
|
||||
|
||||
|
|
|
@ -20,4 +20,4 @@ plugins:
|
|||
strategy: {}
|
||||
test: {}
|
||||
vars: {}
|
||||
version: 0.1.2
|
||||
version: 0.1.0
|
||||
|
|
|
@ -11,19 +11,3 @@ releases:
|
|||
name: scp
|
||||
namespace: null
|
||||
release_date: '2023-11-26'
|
||||
0.1.1:
|
||||
changes:
|
||||
release_summary: added nickname_is_hostname config to let the nickname be the
|
||||
hostname of the host
|
||||
fragments:
|
||||
- scp-hostname.yml
|
||||
release_date: '2023-12-10'
|
||||
0.1.2:
|
||||
changes:
|
||||
minor_changes:
|
||||
- added additional_info to the config. this allows addtional data to be added
|
||||
to the inventory
|
||||
release_summary: added additional_info parameter
|
||||
fragments:
|
||||
- scp-additional_info.yml
|
||||
release_date: '2023-12-10'
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
release_summary: added additional_info parameter
|
||||
minor_changes:
|
||||
- added additional_info to the config. this allows addtional data to be added to the inventory
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
namespace: ansible
|
||||
name: netcup
|
||||
version: 0.1.2
|
||||
version: 0.1.1
|
||||
readme: README.md
|
||||
authors:
|
||||
- Sebastian Tobie
|
||||
|
|
|
@ -32,11 +32,9 @@ class InventoryModule(BaseInventoryPlugin):
|
|||
inventory.add_group("netcup_offline")
|
||||
inventory.add_child("netcup", "netcup_online")
|
||||
inventory.add_child("netcup", "netcup_offline")
|
||||
additional = self.config.get("additional_info", dict())
|
||||
for hostname in self.service.getVServers(**self.args):
|
||||
serverinfo = self.service.getVServerInformation(vservername=hostname, **self.args)
|
||||
nickname = serverinfo["vServerNickname"] or serverinfo["vServerName"]
|
||||
ai = additional.get(nickname, dict())
|
||||
group = "netcup_online"
|
||||
if serverinfo["status"] != "online":
|
||||
group = "netcup_offline"
|
||||
|
@ -45,17 +43,14 @@ class InventoryModule(BaseInventoryPlugin):
|
|||
else:
|
||||
inventory.add_child(group, nickname)
|
||||
interfaces = dict()
|
||||
ai_interfaces = ai.pop("interfaces", dict())
|
||||
for interface in serverinfo["serverInterfaces"]:
|
||||
interfaces[interface["mac"]] = dict()
|
||||
interfaces[interface["mac"]].update(
|
||||
interfaces[interface["mac"]] = dict(
|
||||
driver=interface["driver"],
|
||||
id=interface["id"],
|
||||
ipv4=interface["ipv4IP"],
|
||||
ipv6=interface["ipv6IP"],
|
||||
mac=interface["mac"],
|
||||
)
|
||||
interfaces[interface["mac"]].update(ai_interfaces.pop(interface["mac"], dict()))
|
||||
if len(interface["ipv4IP"]) > 0:
|
||||
ansible_host = interface["ipv4IP"][0]
|
||||
inventory.set_variable(nickname, "interfaces", interfaces)
|
||||
|
@ -63,9 +58,7 @@ class InventoryModule(BaseInventoryPlugin):
|
|||
inventory.set_variable(nickname, "name", serverinfo["vServerName"])
|
||||
inventory.set_variable(nickname, "cores", serverinfo["cpuCores"])
|
||||
inventory.set_variable(nickname, "up", serverinfo["status"] == "online")
|
||||
if ai.get("ansible_host", False):
|
||||
ansible_host = ai.pop("ansible_host")
|
||||
elif self.config.get("nickname_is_hostname", False):
|
||||
if self.config.get("nickname_is_hostname", False):
|
||||
ansible_host = nickname
|
||||
inventory.set_variable(nickname, "ansible_host", ansible_host)
|
||||
|
||||
|
@ -95,10 +88,4 @@ DOCUMENTATION = """
|
|||
type: bool
|
||||
required: false
|
||||
default: false
|
||||
additional_info:
|
||||
version_added: 0.1.2
|
||||
description:
|
||||
required: false
|
||||
default: {}
|
||||
type: dict
|
||||
"""
|
||||
|
|
Laden…
In neuem Issue referenzieren