Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@
type: bool
sample: false
http2:
description: Indicates if HTTP/2 protocol is enabled. (L7 only)
description: Indicates if HTTP/2 protocol is enabled. Temporarily unavailable. (L7 only)
type: bool
sample: false
http_to_https_redirect:
description: Indicates if HTTP is redirected to HTTPS. (L7 only)
type: bool
sample: false
http2_push_preload:
description: Indicates HTTP/2 push preload status. (L7 only)
description: Indicates HTTP/2 push preload status. Temporarily unavailable. (L7 only)
type: bool
sample: false
domains:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@
type: bool
default: false
http2:
description: Enable HTTP/2 protocol.
description: Enable HTTP/2 protocol. Temporarily unavailable.
type: bool
default: false
http_to_https_redirect:
description: Redirect HTTP traffic to HTTPS.
type: bool
default: false
http2_push_preload:
description: Enable HTTP/2 push preload.
description: Enable HTTP/2 push preload. Temporarily unavailable.
type: bool
default: false
domains:
Expand Down Expand Up @@ -314,15 +314,15 @@
returned: always
type: bool
http2:
description: "Indicates if HTTP/2 is enabled."
description: "Indicates if HTTP/2 is enabled. Temporarily unavailable."
returned: always
type: bool
http_to_https_redirect:
description: "Indicates if HTTP is redirected to HTTPS."
returned: always
type: bool
http2_push_preload:
description: "Indicates if HTTP/2 push preload is enabled."
description: "Indicates if HTTP/2 push preload is enabled. Temporarily unavailable."
returned: always
type: bool
domains:
Expand Down Expand Up @@ -475,9 +475,7 @@
- id: "zone1"
ports: [80, 443]
ssl: true
http2: true
http_to_https_redirect: false
http2_push_preload: false
domains: ["example.com", "www.example.com"]
ssl_certificate_id: "cert-12345"
location_zones:
Expand Down
22 changes: 16 additions & 6 deletions ansible_collections/serverscom/sc_api/tests/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,31 @@ Update these to match your account's available resources.

**Cloud Computing:**
`cloud_test_region_id`, `cloud_test_flavor_id`, `cloud_test_flavor_name`,
`cloud_test_ssh_key_fingerprint`, `cloud_test_region_search_pattern`,
`cloud_test_region_search_match`, `cloud_test_region_search_nomatch`
`cloud_test_ssh_key_fingerprint`, `cloud_test_image_name`,
`cloud_test_image_regex`, `cloud_test_reinstall_image_regex`,
`cloud_test_rescue_image_regex`, `cloud_test_invalid_image_regex`,
`cloud_test_region_search_pattern`, `cloud_test_region_search_match`,
`cloud_test_region_search_nomatch`

**Baremetal:**
`baremetal_test_location_search_pattern`, `baremetal_test_location_search_match`,
`baremetal_test_location_search_nomatch`, `baremetal_test_os_location_id`,
`baremetal_test_os_location_code`, `baremetal_test_os_server_model_id`,
`baremetal_test_os_server_model_name`
`baremetal_test_os_server_model_name`, `baremetal_test_os_regex`,
`baremetal_test_os_nomatch_regex`

**Dedicated server reinstall:**
`dedicated_test_reinstall_os_id`, `dedicated_test_reinstall_ssh_key_fingerprint`,
`dedicated_test_reinstall_os_id`, `dedicated_test_reinstall_quick_os_id`,
`dedicated_test_reinstall_os_regex`,
`dedicated_test_reinstall_ambiguous_os_regex`,
`dedicated_test_reinstall_missing_os_regex`,
`dedicated_test_reinstall_ssh_key_fingerprint`,
`dedicated_test_reinstall_ssh_key_name`

**SBM (Scalable Baremetal):**
`sbm_test_location_code`, `sbm_test_flavor_name`, `sbm_test_os_regex`,
`sbm_test_reinstall_os_name`
`sbm_test_location_code`, `sbm_test_flavor_name`, `sbm_test_create_os_name`,
`sbm_test_os_regex`, `sbm_test_os_filter_default`,
`sbm_test_reinstall_quick_os_id`, `sbm_test_reinstall_os_name`,
`sbm_test_invalid_os_name`, `sbm_test_invalid_os_regex`

See the Justfile recipes (in the root directory of this project) for local development.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- name: Test2, Get OS list by name regex
sc_baremetal_os_list:
server_id: "{{ existing_server1_id }}"
os_name_regex: "^Ubuntu 24.04-server x86_64$"
os_name_regex: "{{ baremetal_test_os_regex }}"
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
SERVERSCOM_API_URL: '{{ sc_endpoint }}'
Expand Down Expand Up @@ -76,7 +76,7 @@
- name: Test5, None OS options found
sc_baremetal_os_list:
server_id: "{{ existing_server1_id }}"
os_name_regex: "^Ubuntu 24.04-server arm64$"
os_name_regex: "{{ baremetal_test_os_nomatch_regex }}"
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
SERVERSCOM_API_URL: '{{ sc_endpoint }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
register: flavor_info
tags: always

- name: Tests prep, store image id
set_fact:
cloud_test_image_id: "{{ (img_info.cloud_images | selectattr('allowed_flavors', 'equalto', []) | first).id }}"
tags: always

- name: Test5, create instance new in check_mode
tags: [test5]
block:
Expand All @@ -82,7 +87,7 @@
state: present
region_id: "{{ regions.regions[0].id }}"
flavor_id: '{{ (flavor_info.cloud_flavors|sort(attribute="disk"))[0].id }}'
image_id: "{{ (img_info.cloud_images | selectattr('allowed_flavors', 'equalto', []) | first).id }}"
image_id: "{{ cloud_test_image_id }}"
name: ec354674-e844-11ea-ac53-83e1244f3049
backup_copies: 0
gpn: true
Expand Down Expand Up @@ -126,7 +131,7 @@
state: present
region_id: "{{ regions.regions[0].id }}"
flavor_id: '{{ (flavor_info.cloud_flavors|sort(attribute="disk"))[0].id }}'
image_id: "{{ (img_info.cloud_images | selectattr('allowed_flavors', 'equalto', []) | first).id }}"
image_id: "{{ cloud_test_image_id }}"
name: 52310c60-7446-482d-a30e-2bedeb515878
backup_copies: 0
gpn: true
Expand Down Expand Up @@ -159,7 +164,7 @@
state: present
region_id: "{{ regions.regions[0].id }}"
flavor_id: '{{ (flavor_info.cloud_flavors|sort(attribute="disk"))[0].id }}'
image_id: "{{ (img_info.cloud_images | selectattr('allowed_flavors', 'equalto', []) | first).id }}"
image_id: "{{ cloud_test_image_id }}"
name: 52310c60-7446-482d-a30e-2bedeb515878
backup_copies: 0
gpn: true
Expand All @@ -176,7 +181,7 @@
state: present
region_id: "{{ regions.regions[0].id }}"
flavor_id: '{{ (flavor_info.cloud_flavors|sort(attribute="disk"))[0].id }}'
image_id: "{{ (img_info.cloud_images | selectattr('allowed_flavors', 'equalto', []) | first).id }}"
image_id: "{{ cloud_test_image_id }}"
name: 52310c60-7446-482d-a30e-2bedeb515878
backup_copies: 0
gpn: true
Expand Down Expand Up @@ -217,7 +222,7 @@
state: present
region_id: "{{ regions.regions[0].id }}"
flavor_id: '{{ (flavor_info.cloud_flavors|sort(attribute="disk"))[0].id }}'
image_id: "{{ (img_info.cloud_images | selectattr('allowed_flavors', 'equalto', []) | first).id }}"
image_id: "{{ cloud_test_image_id }}"
name: c4edd55c-8a79-4181-b880-917b8ee5cdf2
backup_copies: 0
gpn: false
Expand Down Expand Up @@ -325,7 +330,7 @@
name: 15a0688b-44f6-41e2-971c-4e860c402373
region_id: "{{ regions.regions[0].id }}"
flavor_name: "dont.exist"
image_id: "{{ (img_info.cloud_images | selectattr('allowed_flavors', 'equalto', []) | first).id }}"
image_id: "{{ cloud_test_image_id }}"
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
SERVERSCOM_API_URL: '{{ sc_endpoint }}'
Expand All @@ -338,7 +343,7 @@
name: 15a0688b-44f6-41e2-971c-4e860c402373
region_id: "{{ regions.regions[0].id }}"
flavor_id: '{{ (flavor_info.cloud_flavors|sort(attribute="disk"))[0].id }}'
image_regexp: a.+dont.exist
image_regexp: "{{ cloud_test_invalid_image_regex }}"
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
SERVERSCOM_API_URL: '{{ sc_endpoint }}'
Expand All @@ -349,7 +354,7 @@
assert:
that:
- "'Unable to find flavor by name dont.exist' in test8_flavor.msg"
- "'Unable to find image by regexp a.+dont.exist' in test8_image.msg"
- "('Unable to find image by regexp ' ~ cloud_test_invalid_image_regex) in test8_image.msg"

always:
- name: Test8, cleanup
Expand All @@ -369,7 +374,7 @@
name: 8d2779e6-eb72-11ea-970f-733ca983e4ca
region_id: "{{ regions.regions[0].id }}"
flavor_name: "{{ cloud_test_flavor_name }}"
image_regexp: "Ubuntu.+"
image_regexp: "{{ cloud_test_image_regex }}"
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
SERVERSCOM_API_URL: '{{ sc_endpoint }}'
Expand Down Expand Up @@ -422,7 +427,7 @@
gpn: true
ipv4: false
flavor_name: "{{ cloud_test_flavor_name }}"
image_regexp: "Ubuntu.+"
image_regexp: "{{ cloud_test_image_regex }}"
ssh_key_name: 95f41cea-00fc-11ed-bfa8-33691f518c37
user_data: |
#cloud-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@
- "'v1/cloud_computing/instances/M7e5Ba2v' in test1.api_url"
- test1.status_code != 200

- name: Get Debian 12 image ID
- name: Get configured image ID
sc_cloud_computing_images_info:
region_id: "{{ cloud_test_region_id }}"
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
SERVERSCOM_API_URL: '{{ sc_endpoint }}'
register: images_info

- name: Store Debian 12 image ID
- name: Store configured image ID
set_fact:
debian_12_image_id: "{{ images_info.cloud_images | selectattr('name','equalto','Debian 12 (64 bit)') | map(attribute='id') | first }}"
cloud_test_named_image_id: "{{ images_info.cloud_images | selectattr('name','equalto', cloud_test_image_name) | map(attribute='id') | first }}"

- name: Create test instance
sc_cloud_computing_instance:
state: present
region_id: "{{ cloud_test_region_id }}"
flavor_id: "{{ cloud_test_flavor_id }}"
image_id: "{{ debian_12_image_id }}"
image_id: "{{ cloud_test_named_image_id }}"
name: "sc-cloud-computing-instance-info-test"
ssh_key_fingerprint: "{{ cloud_test_ssh_key_fingerprint }}"
labels:
Expand Down Expand Up @@ -68,7 +68,7 @@
- test2.status == "ACTIVE"
- test2.region_id == cloud_test_region_id
- test2.flavor_id == cloud_test_flavor_id
- test2.image_id == debian_12_image_id
- test2.image_id == cloud_test_named_image_id
- test2.labels.test_label == "test_value"
- test2.backup_copies == 0
- test2.gpn_enabled == true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
state: present
region_id: "{{ regions.regions[0].id }}"
flavor_name: "{{ cloud_test_flavor_name }}"
image_regexp: "Ubuntu.+"
image_regexp: "{{ cloud_test_image_regex }}"
name: 537eb44e-eced-11ea-8fef-3b4e87dd916a
backup_copies: 0
gpn: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
state: present
region_id: '{{ regions.regions[0].id }}'
flavor_name: "{{ cloud_test_flavor_name }}"
image_regexp: 'Ubuntu.+'
image_regexp: "{{ cloud_test_image_regex }}"
name: '{{ instance_name }}'
backup_copies: 0
gpn: true
Expand Down Expand Up @@ -63,7 +63,7 @@
sc_cloud_computing_instance:
state: reinstalled
instance_id: '{{ instance.id }}'
image_regexp: 'Debian.+'
image_regexp: "{{ cloud_test_reinstall_image_regex }}"
wait: 600
update_interval: 5
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
state: present
region_id: '{{ regions.regions[0].id }}'
flavor_name: "{{ cloud_test_flavor_name }}"
image_regexp: 'Ubuntu.+'
image_regexp: "{{ cloud_test_image_regex }}"
name: 4839550e-edf5-11ea-8df4-4f25b3878e42
backup_copies: 0
gpn: true
Expand Down Expand Up @@ -260,7 +260,7 @@
- name: Test11, rescue with image_regexp
sc_cloud_computing_instance_state:
name: 4839550e-edf5-11ea-8df4-4f25b3878e42
image_regexp: '.*Cent.+'
image_regexp: "{{ cloud_test_rescue_image_regex }}"
state: '{{ item }}'
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@
- test3 is not changed
- test3.cloud_instances|length > 0

- name: Get Debian 12 image ID
- name: Get configured image ID
sc_cloud_computing_images_info:
region_id: "{{ cloud_test_region_id }}"
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
SERVERSCOM_API_URL: '{{ sc_endpoint }}'
register: images_info

- name: Store Debian 12 image ID
- name: Store configured image ID
set_fact:
debian_12_image_id: "{{ images_info.cloud_images | selectattr('name','equalto','Debian 12 (64 bit)') | map(attribute='id') | first }}"
cloud_test_named_image_id: "{{ images_info.cloud_images | selectattr('name','equalto', cloud_test_image_name) | map(attribute='id') | first }}"

- name: Create test instance with labels
sc_cloud_computing_instance:
state: present
region_id: "{{ cloud_test_region_id }}"
flavor_id: "{{ cloud_test_flavor_id }}"
image_id: "{{ debian_12_image_id }}"
image_id: "{{ cloud_test_named_image_id }}"
name: "sc-cloud-computing-instances-info-test"
ssh_key_fingerprint: "{{ cloud_test_ssh_key_fingerprint }}"
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
sc_dedicated_server_reinstall:
id: '{{ existing_server1_id }}'
drives_layout_template: raid0-simple
operating_system_regex: "^debian (.*)x86_64$"
operating_system_regex: "{{ dedicated_test_reinstall_ambiguous_os_regex }}"
hostname: raid0test
ssh_key_name: "{{ dedicated_test_reinstall_ssh_key_name }}"
wait: 3600
Expand All @@ -58,15 +58,14 @@
assert:
that:
- test4 is not changed
- >-
test4.msg is match("(?s)^Multiple OS options match the
regex '\\^debian \\(.*\\)x86_64\\$': .*")
- test4.msg is match("(?s)^Multiple OS options match the regex")
- dedicated_test_reinstall_ambiguous_os_regex in test4.msg

- name: Test5, reinstall with raid0_template and non-existing OS regex
sc_dedicated_server_reinstall:
id: '{{ existing_server1_id }}'
drives_layout_template: raid0-simple
operating_system_regex: "^Debian 6(.*)x86_64$"
operating_system_regex: "{{ dedicated_test_reinstall_missing_os_regex }}"
hostname: raid0test
ssh_key_name: "{{ dedicated_test_reinstall_ssh_key_name }}"
wait: 3600
Expand All @@ -82,7 +81,5 @@
assert:
that:
- test5 is not changed
- >-
test5.msg is match("(?s)^No OS options match the regex
'\\^Debian 6\\(.*\\)x86_64\\$' for server model 'Supermicro X11DPL-i /
2 x Intel Xeon Silver 4114 / 32 GB RAM / 1 x 480 GB SSD' in location 'WAS1'.*")
- test5.msg is match("(?s)^No OS options match the regex")
- dedicated_test_reinstall_missing_os_regex in test5.msg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
sc_dedicated_server_reinstall:
id: '{{ existing_server3_id }}'
drives_layout_template: no-raid
operating_system_regex: "^Debian 12 (.*)x86_64$"
operating_system_regex: "{{ dedicated_test_reinstall_os_regex }}"
hostname: noraidtest
ssh_key_name: "{{ dedicated_test_reinstall_ssh_key_name }}"
wait: 3600
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
id: '{{ existing_server1_id }}'
drives_layout_template: raid1-simple
ssh_key_name: should-not-exists
operating_system_id: '42'
operating_system_id: "{{ dedicated_test_reinstall_quick_os_id }}"
hostname: somename
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
Expand All @@ -50,7 +50,7 @@
drives_layout_template: raid1-simple
ssh_keys:
- '58:e5:58:e9:38:10:82:57:d9:82:11:8c:f6:44:68:e8'
operating_system_id: '42'
operating_system_id: "{{ dedicated_test_reinstall_quick_os_id }}"
hostname: somename
environment:
SERVERSCOM_API_TOKEN: '{{ sc_token }}'
Expand Down
Loading
Loading