Skip to content

Commit 037a3ec

Browse files
authored
Merge pull request #38 from serverscom/fix-bm-ci
RAID0 from one disk is no more supported by servers.com PAPI
2 parents f31f735 + e8f5809 commit 037a3ec

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

ansible_collections/serverscom/sc_api/galaxy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
namespace: serverscom
33
name: sc_api
4-
version: 0.4.0
4+
version: 0.5.0
55
readme: README.md
66
authors:
77
- George Shuklin <george.shuklin@gmail.com>
88
- Volodymyr Rudniev <rudnev.vv@gmail.com>
9+
- Aleksandr Chudinov <silentirk@me.com>
910
description: Collection of modules to work with Servers.com API
1011
license:
1112
- GPL-3.0-or-later

ansible_collections/serverscom/sc_api/plugins/module_utils/modules.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,12 @@ def get_drives_layout(layout, template):
421421
{"slot_positions": [0, 1], "raid": 1, "partitions": partitions_template}
422422
]
423423
raid0_simple = [
424-
{"slot_positions": [0], "raid": 0, "partitions": partitions_template}
424+
{"slot_positions": [0, 1], "raid": 0, "partitions": partitions_template}
425425
]
426-
templates = {"raid1-simple": rai1_simple, "raid0-simple": raid0_simple}
426+
no_raid = [
427+
{"slot_positions": [0], "partitions": partitions_template}
428+
]
429+
templates = {"raid1-simple": rai1_simple, "raid0-simple": raid0_simple, "no-raid": no_raid}
427430
if layout:
428431
return layout
429432
if template not in templates:

ansible_collections/serverscom/sc_api/plugins/modules/sc_dedicated_server_reinstall.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@
6161
6262
drives_layout_template:
6363
type: str
64-
choices: [raid1-simple, raid0-simple]
64+
choices: [raid1-simple, raid0-simple, no-raid]
6565
description:
6666
- Mutually exclusive with I(drives_layout).
6767
- Provides a template to use instead of I(drives_layout).
6868
- C(raid1-simple) uses two first drives to create RAID1,
6969
partition /boot (1Gb), swap (4Gb) and / (all other space).
70-
- C(raid0-simple) uses first drive as raid0 (or no raid in case
71-
of servers without hardware raid), and places /boot, swap
72-
and / on this drive.
70+
- C(raid0-simple) uses first two drives to create RAID0,
71+
partition /boot (1Gb), swap (4Gb) and / (all other space).
72+
- C(no-raid) uses first drive, does not create any RAID,
73+
partition /boot (1Gb), swap (4Gb) and / (all other space).
7374
- This option is implemented by this module (it generates layout
7475
for drives['layout'] request to API based on built-in template).
7576
@@ -447,7 +448,7 @@ def main():
447448
"hostname": {"type": "str"},
448449
"drives_layout_template": {
449450
"type": "str",
450-
"choices": ["raid1-simple", "raid0-simple"],
451+
"choices": ["raid1-simple", "raid0-simple", "no-raid"],
451452
},
452453
"drives_layout": {"type": "list", "elements": "dict"},
453454
"operating_system_id": {"type": "int"},

ansible_collections/serverscom/sc_api/tests/integration/targets/sc_dedicated_server_reinstall_long/tasks/main.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,24 @@
155155
- test6.id == existing_server1_id
156156
- test6.power_status == "powered_on"
157157
- test6.title == "raid0test"
158+
159+
- name: Test7, reinstall with no-raid_template and OS name
160+
sc_dedicated_server_reinstall:
161+
token: '{{ sc_token }}'
162+
endpoint: '{{ sc_endpoint }}'
163+
id: '{{ existing_server1_id }}'
164+
drives_layout_template: no-raid
165+
operating_system_regex: "^Debian 12 (.*)x86_64$"
166+
hostname: noraidtest
167+
ssh_key_name: amarao
168+
wait: 3600
169+
update_interval: 30
170+
register: test7
171+
172+
- name: Check Test7
173+
assert:
174+
that:
175+
- test7 is changed
176+
- test7.id == existing_server1_id
177+
- test7.power_status == "powered_on"
178+
- test7.title == "noraidtest"

0 commit comments

Comments
 (0)