Skip to content

Commit

Permalink
Merge pull request #110 from davidharkis/additional-dedicated-server-…
Browse files Browse the repository at this point in the history
…info

Support additional dedicated server info calls
  • Loading branch information
tortuegenialez authored Jan 9, 2025
2 parents b3acedc + bc524f8 commit 595ba1f
Show file tree
Hide file tree
Showing 4 changed files with 589 additions and 3 deletions.
206 changes: 206 additions & 0 deletions plugins/modules/dedicated_server_hardware_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from ansible.module_utils.basic import AnsibleModule

__metaclass__ = type
DOCUMENTATION = """
---
module: dedicated_server_hardware_info
short_description: Retrieve hardware specifications for an OVH dedicated server
description:
- This module retrieves detailed hardware specifications for an OVH dedicated server
author: David Harkis
requirements:
- ovh >= 0.5.0
options:
service_name:
required: true
description: The service_name
"""
EXAMPLES = r"""
- name: Retrieve hardware specifications for an OVH dedicated server
synthesio.ovh.dedicated_server_hardware_info:
service_name: "{{ service_name }}"
delegate_to: localhost
register: hardware_info
"""
RETURN = r"""
bootMode:
description: Server boot mode.
returned: always
type: str
sample: uefi
coresPerProcessor:
description: Number of cores per processor.
returned: always
type: int
sample: 6
defaultHardwareRaidSize:
description: Default hardware raid size for this server.
returned: when configured
type: dict
contains:
unit:
description: Size unit.
type: str
sample: GB
value:
description: Size value.
type: int
sample: 1000
defaultHardwareRaidType:
description: Default hardware raid type configured on this server.
returned: when configured
type: str
choices: [raid0, raid1, raid10, raid1E, raid5, raid50, raid6, raid60]
description:
description: Commercial name of this server.
returned: when available
type: str
sample: ADVANCE-1 | AMD EPYC 4244P - AMD EPYC 4244P
diskGroups:
description: Details about the groups of disks in the server.
returned: always
type: list
elements: dict
contains:
defaultHardwareRaidSize:
description: Default hardware raid size for this disk group.
type: dict
returned: when configured
defaultHardwareRaidType:
description: Default hardware raid type for this disk group.
type: str
returned: when configured
choices: [raid0, raid1, raid10, raid1E, raid5, raid50, raid6, raid60]
description:
description: Human readable description of this disk group.
type: str
sample: 2 X Disk NVME 960 GB, JBOD
diskGroupId:
description: Identifier of this disk group.
type: int
sample: 1
diskSize:
description: Disk capacity.
type: dict
contains:
unit:
description: Size unit.
type: str
sample: GB
value:
description: Size value.
type: int
sample: 960
diskType:
description: Type of the disk.
type: str
sample: NVME
numberOfDisks:
description: Number of disks in this group.
type: int
sample: 2
raidController:
description: Raid controller managing this group of disks.
type: str
expansionCards:
description: Details about the server's expansion cards.
returned: when present
type: list
elements: dict
contains:
description:
description: Expansion card description.
type: str
type:
description: Expansion card type.
type: str
choices: [fpga, gpu]
formFactor:
description: Server form factor.
returned: always
type: str
choices: [0.25u, 0.5u, 1u, 2u, 3u, 4u]
sample: 0.5u
memorySize:
description: RAM capacity.
returned: always
type: dict
contains:
unit:
description: Size unit.
type: str
sample: MB
value:
description: Size value.
type: int
sample: 32768
motherboard:
description: Server motherboard.
returned: always
type: str
sample: S3661
numberOfProcessors:
description: Number of processors in this dedicated server.
returned: always
type: int
sample: 1
processorArchitecture:
description: Processor architecture bit.
returned: always
type: str
choices: [arm64, armhf32, ppc64, x86, x86-ht, x86_64]
sample: x86_64
processorName:
description: Processor name.
returned: always
type: str
sample: Epyc4244P
threadsPerProcessor:
description: Number of threads per processor.
returned: always
type: int
sample: 12
usbKeys:
description: Capacity of the USB keys installed on your server.
returned: when present
type: list
elements: dict
contains:
unit:
description: Size unit.
type: str
sample: GB
value:
description: Size value.
type: int"""
from ansible_collections.synthesio.ovh.plugins.module_utils.ovh import (
OVH,
ovh_argument_spec,
)


def run_module():
module_args = ovh_argument_spec()
module_args.update(dict(service_name=dict(required=True)))
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)

if module.check_mode:
module.exit_json(changed=False)

client = OVH(module)
service_name = module.params["service_name"]
result = client.wrap_call(
"GET", f"/dedicated/server/{service_name}/specifications/hardware"
)
module.exit_json(changed=False, **result)


def main():
run_module()


if __name__ == "__main__":
main()
6 changes: 3 additions & 3 deletions plugins/modules/dedicated_server_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
DOCUMENTATION = '''
---
module: dedicated_server_info
short_description: Retrieve all info for a OVH dedicated server
short_description: Retrieve basic info for an OVH dedicated server
description:
- This module retrieves all info for a OVH dedicated server
- This module retrieves basic info for an OVH dedicated server
author: Maxime Dupré
requirements:
- ovh >= 0.5.0
Expand All @@ -23,7 +23,7 @@
'''

EXAMPLES = r'''
- name: Retrieve all info for an OVH dedicated server
- name: Retrieve basic info for an OVH dedicated server
synthesio.ovh.dedicated_server_info:
service_name: "{{ service_name }}"
delegate_to: localhost
Expand Down
116 changes: 116 additions & 0 deletions plugins/modules/dedicated_server_ip_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from ansible.module_utils.basic import AnsibleModule

__metaclass__ = type
DOCUMENTATION = """
---
module: dedicated_server_ip_info
short_description: Retrieve IP specifications for an OVH dedicated server
description:
- This module retrieves detailed IP specifications for an OVH dedicated server
author: David Harkis
requirements:
- ovh >= 0.5.0
options:
service_name:
required: true
description: The service_name
"""
EXAMPLES = r"""
- name: Retrieve IP specifications for an OVH dedicated server
synthesio.ovh.dedicated_server_ip_info:
service_name: "{{ service_name }}"
delegate_to: localhost
register: ip_info
"""
RETURN = r"""
ipv4:
description: Orderable IP v4 details.
returned: always
type: list
elements: dict
contains:
blockSizes:
description: Orderable IP blocks sizes.
type: list
elements: int
sample: [1, 4, 8, 16, 32, 64, 128]
included:
description: Are those IP included with your offer.
type: bool
sample: true
ipNumber:
description: Total number of IP that can be routed to this server.
type: int
sample: 256
number:
description: Total number of prefixes that can be routed to this server.
type: int
sample: 254
optionRequired:
description: Which option is required to order this type of IP.
type: str
choices: [professionalUse]
type:
description: This IP type.
type: str
choices: [failover, static, unshielded]
sample: failover
ipv6:
description: Orderable IP v6 details.
returned: always
type: list
elements: dict
contains:
blockSizes:
description: Orderable IP blocks sizes.
type: list
elements: int
choices: [1, 4, 8, 16, 32, 64, 128, 256]
included:
description: Are those IP included with your offer.
type: bool
ipNumber:
description: Total number of IP that can be routed to this server.
type: int
number:
description: Total number of prefixes that can be routed to this server.
type: int
optionRequired:
description: Which option is required to order this type of IP.
type: str
choices: [professionalUse]
type:
description: This IP type.
type: str
choices: [failover, static, unshielded]"""
from ansible_collections.synthesio.ovh.plugins.module_utils.ovh import (
OVH,
ovh_argument_spec,
)


def run_module():
module_args = ovh_argument_spec()
module_args.update(dict(service_name=dict(required=True)))
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)

if module.check_mode:
module.exit_json(changed=False)

client = OVH(module)
service_name = module.params["service_name"]
result = client.wrap_call(
"GET", f"/dedicated/server/{service_name}/specifications/ip"
)
module.exit_json(changed=False, **result)


def main():
run_module()


if __name__ == "__main__":
main()
Loading

0 comments on commit 595ba1f

Please sign in to comment.