Commits vergleichen

..

Keine gemeinsamen Commits. "333a906f056c132669ccbac653d2cac00f7b88f1" und "527ad350cf803d15d831cf60e2974ae2acd1a0c7" haben vollständig unterschiedliche Historien.

4 geänderte Dateien mit 15 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -1,2 +0,0 @@
---
release_summary: added nickname_is_hostname config to let the nickname be the hostname of the host

Datei anzeigen

@ -1,7 +1,7 @@
---
namespace: ansible
name: netcup
version: 0.1.1
version: 0.1.0
readme: README.md
authors:
- Sebastian Tobie

Datei anzeigen

@ -1,5 +1,4 @@
---
plugin: ansible.netcup.scp
plugin: sebastian.netcup.scp
userid:
password:
nickname_is_hostname: false

Datei anzeigen

@ -10,7 +10,7 @@ display = Display()
class InventoryModule(BaseInventoryPlugin):
NAME = "ansible.netcup.scp"
NAME = "sebastian.netcup.scp"
loader: DataLoader
inventory: InventoryData
plugin: str
@ -42,29 +42,26 @@ class InventoryModule(BaseInventoryPlugin):
inventory.add_host(nickname, group)
else:
inventory.add_child(group, nickname)
interfaces = dict()
interfaces = []
for interface in serverinfo["serverInterfaces"]:
interfaces[interface["mac"]] = dict(
driver=interface["driver"],
id=interface["id"],
ipv4=interface["ipv4IP"],
ipv6=interface["ipv6IP"],
mac=interface["mac"],
interfaces.append(
dict(
driver=interface["driver"],
id=interface["id"],
ipv4=interface["ipv4IP"],
ipv6=interface["ipv6IP"],
mac=interface["mac"],
)
)
if len(interface["ipv4IP"]) > 0:
ansible_host = interface["ipv4IP"][0]
inventory.set_variable(nickname, "interfaces", interfaces)
inventory.set_variable(nickname, "memory", serverinfo["memory"])
inventory.set_variable(nickname, "name", serverinfo["vServerName"])
inventory.set_variable(nickname, "cores", serverinfo["cpuCores"])
inventory.set_variable(nickname, "up", serverinfo["status"] == "online")
if self.config.get("nickname_is_hostname", False):
ansible_host = nickname
inventory.set_variable(nickname, "ansible_host", ansible_host)
DOCUMENTATION = """
name: ansible.netcup.scp
DOCUMENTATION = r"""
name: sebastian.netcup.scp
plugin_type: inventory
short_description: Returns Ansible inventory from netcup SCP
description: Returns Ansible inventory from netcup SCP
@ -73,7 +70,7 @@ DOCUMENTATION = """
plugin:
description: Name of the plugin
required: true
choices: ['scp', "ansible.netcup.scp"]
choices: ['scp', "sebastian.netcup.scp"]
userid:
description: userid for logging into SCP
required: true
@ -82,10 +79,4 @@ DOCUMENTATION = """
- API password to authenticate againt the api.
- This is different from you SCP password and must be set indipendently from the SCP password
required: true
nickname_is_hostname:
version_added: 0.1.1
description: use the nickname as hostname
type: bool
required: false
default: false
"""