Cloudscale Regions and Zones Support (#67165)
This commit is contained in:
parent
7c8c53de20
commit
a4ec18d8a3
12 changed files with 169 additions and 22 deletions
|
@ -26,7 +26,9 @@ notes:
|
||||||
- This module requires the ipaddress python library. This library is included in Python since version 3.3. It is available as a
|
- This module requires the ipaddress python library. This library is included in Python since version 3.3. It is available as a
|
||||||
module on PyPI for earlier versions.
|
module on PyPI for earlier versions.
|
||||||
version_added: "2.5"
|
version_added: "2.5"
|
||||||
author: "Gaudenz Steinlin (@gaudenz)"
|
author:
|
||||||
|
- Gaudenz Steinlin (@gaudenz)
|
||||||
|
- Denis Krienbühl (@href)
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
|
@ -50,6 +52,20 @@ options:
|
||||||
- UUID of the server assigned to this floating IP.
|
- UUID of the server assigned to this floating IP.
|
||||||
- Required unless I(state) is absent.
|
- Required unless I(state) is absent.
|
||||||
type: str
|
type: str
|
||||||
|
type:
|
||||||
|
description:
|
||||||
|
- The type of the floating IP.
|
||||||
|
choices: [ regional, global ]
|
||||||
|
type: str
|
||||||
|
default: regional
|
||||||
|
version_added: '2.10'
|
||||||
|
region:
|
||||||
|
description:
|
||||||
|
- Region in which the floating IP resides (e.g. C(lgp) or C(rma)).
|
||||||
|
If omitted, the region of the project default zone is used.
|
||||||
|
This parameter must be omitted if I(type) is set to C(global).
|
||||||
|
type: str
|
||||||
|
version_added: '2.10'
|
||||||
prefix_length:
|
prefix_length:
|
||||||
description:
|
description:
|
||||||
- Only valid if I(ip_version) is 6.
|
- Only valid if I(ip_version) is 6.
|
||||||
|
@ -89,6 +105,7 @@ EXAMPLES = '''
|
||||||
prefix_length: 56
|
prefix_length: 56
|
||||||
server: 47cec963-fcd2-482f-bdb6-24461b2d47b1
|
server: 47cec963-fcd2-482f-bdb6-24461b2d47b1
|
||||||
api_token: xxxxxx
|
api_token: xxxxxx
|
||||||
|
region: lpg1
|
||||||
register: floating_ip
|
register: floating_ip
|
||||||
|
|
||||||
# Assign an existing floating network to a different server
|
# Assign an existing floating network to a different server
|
||||||
|
@ -137,6 +154,12 @@ ip:
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
sample: 185.98.122.176
|
sample: 185.98.122.176
|
||||||
|
region:
|
||||||
|
description: The region of the floating IP.
|
||||||
|
returned: success when state == present
|
||||||
|
type: dict
|
||||||
|
sample: {'slug': 'lpg'}
|
||||||
|
version_added: '2.10'
|
||||||
state:
|
state:
|
||||||
description: The current status of the floating IP.
|
description: The current status of the floating IP.
|
||||||
returned: success
|
returned: success
|
||||||
|
@ -210,10 +233,9 @@ class AnsibleCloudscaleFloatingIP(AnsibleCloudscaleBase):
|
||||||
data = {'ip_version': params['ip_version'],
|
data = {'ip_version': params['ip_version'],
|
||||||
'server': params['server']}
|
'server': params['server']}
|
||||||
|
|
||||||
if params['prefix_length']:
|
for p in ('prefix_length', 'reverse_ptr', 'type', 'region'):
|
||||||
data['prefix_length'] = params['prefix_length']
|
if params[p]:
|
||||||
if params['reverse_ptr']:
|
data[p] = params[p]
|
||||||
data['reverse_ptr'] = params['reverse_ptr']
|
|
||||||
|
|
||||||
self.info = self._resp2info(self._post('floating-ips', data))
|
self.info = self._resp2info(self._post('floating-ips', data))
|
||||||
|
|
||||||
|
@ -235,6 +257,8 @@ def main():
|
||||||
ip=dict(aliases=('network', ), type='str'),
|
ip=dict(aliases=('network', ), type='str'),
|
||||||
ip_version=dict(choices=(4, 6), type='int'),
|
ip_version=dict(choices=(4, 6), type='int'),
|
||||||
server=dict(type='str'),
|
server=dict(type='str'),
|
||||||
|
type=dict(type='str', choices=('regional', 'global'), default='regional'),
|
||||||
|
region=dict(type='str'),
|
||||||
prefix_length=dict(choices=(56,), type='int'),
|
prefix_length=dict(choices=(56,), type='int'),
|
||||||
reverse_ptr=dict(type='str'),
|
reverse_ptr=dict(type='str'),
|
||||||
))
|
))
|
||||||
|
|
|
@ -30,6 +30,7 @@ version_added: '2.3'
|
||||||
author:
|
author:
|
||||||
- Gaudenz Steinlin (@gaudenz)
|
- Gaudenz Steinlin (@gaudenz)
|
||||||
- René Moser (@resmo)
|
- René Moser (@resmo)
|
||||||
|
- Denis Krienbühl (@href)
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
|
@ -55,6 +56,11 @@ options:
|
||||||
description:
|
description:
|
||||||
- Image used to create the server.
|
- Image used to create the server.
|
||||||
type: str
|
type: str
|
||||||
|
zone:
|
||||||
|
description:
|
||||||
|
- Zone in which the server resides (e.g. C(lgp1) or C(rma1)).
|
||||||
|
type: str
|
||||||
|
version_added: '2.10'
|
||||||
volume_size_gb:
|
volume_size_gb:
|
||||||
description:
|
description:
|
||||||
- Size of the root volume in GB.
|
- Size of the root volume in GB.
|
||||||
|
@ -131,6 +137,7 @@ EXAMPLES = '''
|
||||||
flavor: flex-4
|
flavor: flex-4
|
||||||
ssh_keys: ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale
|
ssh_keys: ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale
|
||||||
server_groups: shiny-group
|
server_groups: shiny-group
|
||||||
|
zone: lpg1
|
||||||
use_private_network: True
|
use_private_network: True
|
||||||
bulk_volume_size_gb: 100
|
bulk_volume_size_gb: 100
|
||||||
api_token: xxxxxx
|
api_token: xxxxxx
|
||||||
|
@ -143,6 +150,7 @@ EXAMPLES = '''
|
||||||
flavor: flex-8
|
flavor: flex-8
|
||||||
ssh_keys: ssh-rsa XXXXXXXXXXX ansible@cloudscale
|
ssh_keys: ssh-rsa XXXXXXXXXXX ansible@cloudscale
|
||||||
server_groups: shiny-group
|
server_groups: shiny-group
|
||||||
|
zone: lpg1
|
||||||
api_token: xxxxxx
|
api_token: xxxxxx
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,6 +226,12 @@ image:
|
||||||
returned: success when not state == absent
|
returned: success when not state == absent
|
||||||
type: dict
|
type: dict
|
||||||
sample: { "default_username": "ubuntu", "name": "Ubuntu 18.04 LTS", "operating_system": "Ubuntu", "slug": "ubuntu-18.04" }
|
sample: { "default_username": "ubuntu", "name": "Ubuntu 18.04 LTS", "operating_system": "Ubuntu", "slug": "ubuntu-18.04" }
|
||||||
|
zone:
|
||||||
|
description: The zone used for booting this server
|
||||||
|
returned: success when not state == absent
|
||||||
|
type: dict
|
||||||
|
sample: { 'slug': 'lpg1' }
|
||||||
|
version_added: '2.10'
|
||||||
volumes:
|
volumes:
|
||||||
description: List of volumes attached to the server
|
description: List of volumes attached to the server
|
||||||
returned: success when not state == absent
|
returned: success when not state == absent
|
||||||
|
@ -511,6 +525,7 @@ def main():
|
||||||
uuid=dict(),
|
uuid=dict(),
|
||||||
flavor=dict(),
|
flavor=dict(),
|
||||||
image=dict(),
|
image=dict(),
|
||||||
|
zone=dict(),
|
||||||
volume_size_gb=dict(type='int', default=10),
|
volume_size_gb=dict(type='int', default=10),
|
||||||
bulk_volume_size_gb=dict(type='int'),
|
bulk_volume_size_gb=dict(type='int'),
|
||||||
ssh_keys=dict(type='list'),
|
ssh_keys=dict(type='list'),
|
||||||
|
|
|
@ -21,6 +21,7 @@ description:
|
||||||
- Create, update and remove server groups.
|
- Create, update and remove server groups.
|
||||||
author:
|
author:
|
||||||
- René Moser (@resmo)
|
- René Moser (@resmo)
|
||||||
|
- Denis Krienbühl (@href)
|
||||||
version_added: '2.8'
|
version_added: '2.8'
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
|
@ -38,6 +39,11 @@ options:
|
||||||
- Type of the server group.
|
- Type of the server group.
|
||||||
default: anti-affinity
|
default: anti-affinity
|
||||||
type: str
|
type: str
|
||||||
|
zone:
|
||||||
|
description:
|
||||||
|
- Zone slug of the server group (e.g. C(lgp1) or C(rma1)).
|
||||||
|
type: str
|
||||||
|
version_added: '2.10'
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the server group.
|
- State of the server group.
|
||||||
|
@ -60,6 +66,13 @@ EXAMPLES = '''
|
||||||
type: anti-affinity
|
type: anti-affinity
|
||||||
api_token: xxxxxx
|
api_token: xxxxxx
|
||||||
|
|
||||||
|
- name: Ensure server group in a specific zone
|
||||||
|
cloudscale_server_group:
|
||||||
|
name: my-rma-group
|
||||||
|
type: anti-affinity
|
||||||
|
zone: lpg1
|
||||||
|
api_token: xxxxxx
|
||||||
|
|
||||||
- name: Ensure a server group is absent
|
- name: Ensure a server group is absent
|
||||||
cloudscale_server_group:
|
cloudscale_server_group:
|
||||||
name: my-name
|
name: my-name
|
||||||
|
@ -89,6 +102,12 @@ type:
|
||||||
returned: if available
|
returned: if available
|
||||||
type: str
|
type: str
|
||||||
sample: anti-affinity
|
sample: anti-affinity
|
||||||
|
zone:
|
||||||
|
description: The zone of the server group
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
sample: { 'slug': 'rma1' }
|
||||||
|
version_added: '2.10'
|
||||||
servers:
|
servers:
|
||||||
description: A list of servers that are part of the server group.
|
description: A list of servers that are part of the server group.
|
||||||
returned: if available
|
returned: if available
|
||||||
|
@ -130,6 +149,7 @@ class AnsibleCloudscaleServerGroup(AnsibleCloudscaleBase):
|
||||||
data = {
|
data = {
|
||||||
'name': self._module.params.get('name'),
|
'name': self._module.params.get('name'),
|
||||||
'type': self._module.params.get('type'),
|
'type': self._module.params.get('type'),
|
||||||
|
'zone': self._module.params.get('zone'),
|
||||||
'tags': self._module.params.get('tags'),
|
'tags': self._module.params.get('tags'),
|
||||||
}
|
}
|
||||||
if not self._module.check_mode:
|
if not self._module.check_mode:
|
||||||
|
@ -193,6 +213,7 @@ def main():
|
||||||
name=dict(),
|
name=dict(),
|
||||||
uuid=dict(),
|
uuid=dict(),
|
||||||
type=dict(default='anti-affinity'),
|
type=dict(default='anti-affinity'),
|
||||||
|
zone=dict(),
|
||||||
tags=dict(type='dict'),
|
tags=dict(type='dict'),
|
||||||
state=dict(default='present', choices=['absent', 'present']),
|
state=dict(default='present', choices=['absent', 'present']),
|
||||||
))
|
))
|
||||||
|
|
|
@ -29,6 +29,7 @@ version_added: '2.8'
|
||||||
author:
|
author:
|
||||||
- Gaudenz Steinlin (@gaudenz)
|
- Gaudenz Steinlin (@gaudenz)
|
||||||
- René Moser (@resmo)
|
- René Moser (@resmo)
|
||||||
|
- Denis Krienbühl (@href)
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
|
@ -56,6 +57,12 @@ options:
|
||||||
Defaults to C(ssd) on volume creation.
|
Defaults to C(ssd) on volume creation.
|
||||||
choices: [ ssd, bulk ]
|
choices: [ ssd, bulk ]
|
||||||
type: str
|
type: str
|
||||||
|
zone:
|
||||||
|
description:
|
||||||
|
- Zone in which the volume resides (e.g. C(lgp1) or C(rma1)). Cannot be
|
||||||
|
changed after creating the volume. Defaults to the project default zone.
|
||||||
|
type: str
|
||||||
|
version_added: '2.10'
|
||||||
server_uuids:
|
server_uuids:
|
||||||
description:
|
description:
|
||||||
- UUIDs of the servers this volume is attached to. Set this to C([]) to
|
- UUIDs of the servers this volume is attached to. Set this to C([]) to
|
||||||
|
@ -76,6 +83,7 @@ EXAMPLES = '''
|
||||||
- name: Create an SSD volume
|
- name: Create an SSD volume
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
name: my_ssd_volume
|
name: my_ssd_volume
|
||||||
|
zone: 'lpg1'
|
||||||
size_gb: 50
|
size_gb: 50
|
||||||
api_token: xxxxxx
|
api_token: xxxxxx
|
||||||
register: my_ssd_volume
|
register: my_ssd_volume
|
||||||
|
@ -92,6 +100,7 @@ EXAMPLES = '''
|
||||||
- name: Create and attach volume to server
|
- name: Create and attach volume to server
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
name: my_ssd_volume
|
name: my_ssd_volume
|
||||||
|
zone: 'lpg1'
|
||||||
size_gb: 50
|
size_gb: 50
|
||||||
server_uuids:
|
server_uuids:
|
||||||
- ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
|
- ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
|
||||||
|
@ -138,6 +147,12 @@ type:
|
||||||
returned: state == present
|
returned: state == present
|
||||||
type: str
|
type: str
|
||||||
sample: bulk
|
sample: bulk
|
||||||
|
zone:
|
||||||
|
description: The zone of the volume.
|
||||||
|
returned: state == present
|
||||||
|
type: dict
|
||||||
|
sample: {'slug': 'lpg1'}
|
||||||
|
version_added: '2.10'
|
||||||
server_uuids:
|
server_uuids:
|
||||||
description: The UUIDs of the servers this volume is attached to.
|
description: The UUIDs of the servers this volume is attached to.
|
||||||
returned: state == present
|
returned: state == present
|
||||||
|
@ -189,6 +204,7 @@ class AnsibleCloudscaleVolume(AnsibleCloudscaleBase):
|
||||||
data = {
|
data = {
|
||||||
'name': self._module.params.get('name'),
|
'name': self._module.params.get('name'),
|
||||||
'type': self._module.params.get('type'),
|
'type': self._module.params.get('type'),
|
||||||
|
'zone': self._module.params.get('zone'),
|
||||||
'size_gb': self._module.params.get('size_gb') or 'ssd',
|
'size_gb': self._module.params.get('size_gb') or 'ssd',
|
||||||
'server_uuids': self._module.params.get('server_uuids') or [],
|
'server_uuids': self._module.params.get('server_uuids') or [],
|
||||||
'tags': self._module.params.get('tags'),
|
'tags': self._module.params.get('tags'),
|
||||||
|
@ -262,6 +278,7 @@ def main():
|
||||||
state=dict(default='present', choices=('present', 'absent')),
|
state=dict(default='present', choices=('present', 'absent')),
|
||||||
name=dict(),
|
name=dict(),
|
||||||
uuid=dict(),
|
uuid=dict(),
|
||||||
|
zone=dict(),
|
||||||
size_gb=dict(type='int'),
|
size_gb=dict(type='int'),
|
||||||
type=dict(choices=('ssd', 'bulk')),
|
type=dict(choices=('ssd', 'bulk')),
|
||||||
server_uuids=dict(type='list', aliases=['server_uuid']),
|
server_uuids=dict(type='list', aliases=['server_uuid']),
|
||||||
|
|
|
@ -11,3 +11,9 @@ cloudscale_test_flavor: 'flex-2'
|
||||||
# SSH key to use for test servers
|
# SSH key to use for test servers
|
||||||
cloudscale_test_ssh_key: |
|
cloudscale_test_ssh_key: |
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
|
||||||
|
|
||||||
|
# The zone to use to test servers
|
||||||
|
cloudscale_test_zone: 'lpg1'
|
||||||
|
|
||||||
|
# The region to use to request floating IPs
|
||||||
|
cloudscale_test_region: 'lpg'
|
||||||
|
|
|
@ -1,29 +1,64 @@
|
||||||
- name: Request floating IP
|
- name: Request regional floating IP
|
||||||
cloudscale_floating_ip:
|
cloudscale_floating_ip:
|
||||||
server: '{{ test01.uuid }}'
|
server: '{{ test01.uuid }}'
|
||||||
ip_version: '{{ item.ip_version }}'
|
ip_version: '{{ item.ip_version }}'
|
||||||
reverse_ptr: '{{ item.reverse_ptr | default(omit) }}'
|
reverse_ptr: '{{ item.reverse_ptr | default(omit) }}'
|
||||||
prefix_length: '{{ item.prefix_length | default(omit) }}'
|
prefix_length: '{{ item.prefix_length | default(omit) }}'
|
||||||
|
region: '{{ cloudscale_test_region }}'
|
||||||
|
|
||||||
register: floating_ip
|
register: floating_ip
|
||||||
- name: Verify request floating IP
|
- name: Verify request floating IP
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- floating_ip is successful
|
- floating_ip is successful
|
||||||
- floating_ip is changed
|
- floating_ip is changed
|
||||||
|
- floating_ip.region.slug == '{{ cloudscale_test_region }}'
|
||||||
- (item.ip_version == 4 and floating_ip.ip | ipv4) or (item.ip_version == 6 and floating_ip.ip | ipv6)
|
- (item.ip_version == 4 and floating_ip.ip | ipv4) or (item.ip_version == 6 and floating_ip.ip | ipv6)
|
||||||
- floating_ip.server == test01.uuid
|
- floating_ip.server == test01.uuid
|
||||||
|
|
||||||
- name: Check floating IP indempotence
|
- name: Check floating IP idempotence
|
||||||
cloudscale_floating_ip:
|
cloudscale_floating_ip:
|
||||||
server: '{{ test01.uuid }}'
|
server: '{{ test01.uuid }}'
|
||||||
ip: '{{ floating_ip.ip }}'
|
ip: '{{ floating_ip.ip }}'
|
||||||
register: floating_ip_indempotence
|
region: '{{ cloudscale_test_region }}'
|
||||||
- name: Verify floating IP indempotence
|
register: floating_ip_idempotence
|
||||||
|
- name: Verify floating IP idempotence
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- floating_ip_indempotence is successful
|
- floating_ip_idempotence is successful
|
||||||
- floating_ip_indempotence is not changed
|
- floating_ip_idempotence is not changed
|
||||||
- floating_ip_indempotence.server == test01.uuid
|
- floating_ip_idempotence.server == test01.uuid
|
||||||
|
- floating_ip.region.slug == '{{ cloudscale_test_region }}'
|
||||||
|
|
||||||
|
- name: Request global floating IP
|
||||||
|
cloudscale_floating_ip:
|
||||||
|
server: '{{ test01.uuid }}'
|
||||||
|
ip_version: '{{ item.ip_version }}'
|
||||||
|
reverse_ptr: '{{ item.reverse_ptr | default(omit) }}'
|
||||||
|
prefix_length: '{{ item.prefix_length | default(omit) }}'
|
||||||
|
type: 'global'
|
||||||
|
register: global_floating_ip
|
||||||
|
- name: Verify global floating IP
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- global_floating_ip is successful
|
||||||
|
- global_floating_ip is changed
|
||||||
|
- global_floating_ip.region == None
|
||||||
|
- global_floating_ip.type == 'global'
|
||||||
|
- (item.ip_version == 4 and global_floating_ip.ip | ipv4) or (item.ip_version == 6 and global_floating_ip.ip | ipv6)
|
||||||
|
- global_floating_ip.server == test01.uuid
|
||||||
|
|
||||||
|
- name: Release global floating IP
|
||||||
|
cloudscale_floating_ip:
|
||||||
|
ip: '{{ global_floating_ip.ip }}'
|
||||||
|
state: 'absent'
|
||||||
|
register: global_floating_ip
|
||||||
|
- name: Verify release of global floating IP
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- global_floating_ip is successful
|
||||||
|
- global_floating_ip is changed
|
||||||
|
- global_floating_ip.state == 'absent'
|
||||||
|
|
||||||
- name: Check network parameter alias
|
- name: Check network parameter alias
|
||||||
cloudscale_floating_ip:
|
cloudscale_floating_ip:
|
||||||
|
@ -70,12 +105,12 @@
|
||||||
- release_ip is changed
|
- release_ip is changed
|
||||||
- release_ip.state == 'absent'
|
- release_ip.state == 'absent'
|
||||||
|
|
||||||
- name: Release floating IP indempotence
|
- name: Release floating IP idempotence
|
||||||
cloudscale_floating_ip:
|
cloudscale_floating_ip:
|
||||||
ip: '{{ floating_ip.ip }}'
|
ip: '{{ floating_ip.ip }}'
|
||||||
state: 'absent'
|
state: 'absent'
|
||||||
register: release_ip
|
register: release_ip
|
||||||
- name: Verify release floating IPs indempotence
|
- name: Verify release floating IPs idempotence
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- release_ip is successful
|
- release_ip is successful
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
flavor: '{{ cloudscale_test_flavor }}'
|
flavor: '{{ cloudscale_test_flavor }}'
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
register: test01
|
register: test01
|
||||||
|
|
||||||
- name: Create a second server
|
- name: Create a second server
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
flavor: '{{ cloudscale_test_flavor }}'
|
flavor: '{{ cloudscale_test_flavor }}'
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
register: test02
|
register: test02
|
||||||
|
|
||||||
- include_tasks: floating_ip.yml
|
- include_tasks: floating_ip.yml
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
ip_version: 6
|
ip_version: 6
|
||||||
server: '{{ test01.uuid }}'
|
server: '{{ test01.uuid }}'
|
||||||
reverse_ptr: '{{ cloudscale_resource_prefix }}-unassigned.example.com'
|
reverse_ptr: '{{ cloudscale_resource_prefix }}-unassigned.example.com'
|
||||||
|
region: '{{ cloudscale_test_region }}'
|
||||||
register: floating_ip
|
register: floating_ip
|
||||||
|
|
||||||
# The only way to have an unassigned floating IP is to delete the server
|
# The only way to have an unassigned floating IP is to delete the server
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
cloudscale_server_group:
|
cloudscale_server_group:
|
||||||
name: '{{ cloudscale_resource_prefix }}-group-{{ item }}'
|
name: '{{ cloudscale_resource_prefix }}-group-{{ item }}'
|
||||||
type: anti-affinity
|
type: anti-affinity
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
with_sequence: count=2
|
with_sequence: count=2
|
||||||
|
|
||||||
- name: Test create a running server in check mode
|
- name: Test create a running server in check mode
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
stage: production
|
stage: production
|
||||||
|
@ -31,6 +33,7 @@
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
stage: production
|
stage: production
|
||||||
|
@ -42,6 +45,7 @@
|
||||||
- server is changed
|
- server is changed
|
||||||
- server.state == 'running'
|
- server.state == 'running'
|
||||||
- server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
- server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
- server.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- server.tags.project == 'ansible-test'
|
- server.tags.project == 'ansible-test'
|
||||||
- server.tags.stage == 'production'
|
- server.tags.stage == 'production'
|
||||||
- server.tags.sla == '24-7'
|
- server.tags.sla == '24-7'
|
||||||
|
@ -53,6 +57,7 @@
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
stage: production
|
stage: production
|
||||||
|
@ -64,6 +69,7 @@
|
||||||
- server is not changed
|
- server is not changed
|
||||||
- server.state == 'running'
|
- server.state == 'running'
|
||||||
- server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
- server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
- server.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- server.tags.project == 'ansible-test'
|
- server.tags.project == 'ansible-test'
|
||||||
- server.tags.stage == 'production'
|
- server.tags.stage == 'production'
|
||||||
- server.tags.sla == '24-7'
|
- server.tags.sla == '24-7'
|
||||||
|
@ -348,6 +354,7 @@
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
use_public_network: no
|
use_public_network: no
|
||||||
use_private_network: yes
|
use_private_network: yes
|
||||||
state: stopped
|
state: stopped
|
||||||
|
@ -366,6 +373,7 @@
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
use_public_network: no
|
use_public_network: no
|
||||||
use_private_network: yes
|
use_private_network: yes
|
||||||
state: stopped
|
state: stopped
|
||||||
|
@ -375,6 +383,7 @@
|
||||||
that:
|
that:
|
||||||
- server_stopped is changed
|
- server_stopped is changed
|
||||||
- server_stopped.state == 'stopped'
|
- server_stopped.state == 'stopped'
|
||||||
|
- server_stopped.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- server_stopped.anti_affinity_with.0.uuid == running_server_uuid
|
- server_stopped.anti_affinity_with.0.uuid == running_server_uuid
|
||||||
- server_stopped.interfaces.0.type == 'private'
|
- server_stopped.interfaces.0.type == 'private'
|
||||||
- server_stopped.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
- server_stopped.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
@ -386,6 +395,7 @@
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
use_public_network: no
|
use_public_network: no
|
||||||
use_private_network: yes
|
use_private_network: yes
|
||||||
state: stopped
|
state: stopped
|
||||||
|
@ -395,6 +405,7 @@
|
||||||
that:
|
that:
|
||||||
- server_stopped is not changed
|
- server_stopped is not changed
|
||||||
- server_stopped.state == 'stopped'
|
- server_stopped.state == 'stopped'
|
||||||
|
- server_stopped.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- server_stopped.anti_affinity_with.0.uuid == running_server_uuid
|
- server_stopped.anti_affinity_with.0.uuid == running_server_uuid
|
||||||
- server_stopped.interfaces.0.type == 'private'
|
- server_stopped.interfaces.0.type == 'private'
|
||||||
- server_stopped.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
- server_stopped.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
@ -415,6 +426,7 @@
|
||||||
that:
|
that:
|
||||||
- server_stopped is not changed
|
- server_stopped is not changed
|
||||||
- server_stopped.state == 'stopped'
|
- server_stopped.state == 'stopped'
|
||||||
|
- server_stopped.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- server_stopped.anti_affinity_with.0.uuid == running_server_uuid
|
- server_stopped.anti_affinity_with.0.uuid == running_server_uuid
|
||||||
- server_stopped.interfaces.0.type == 'private'
|
- server_stopped.interfaces.0.type == 'private'
|
||||||
- server_stopped.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
- server_stopped.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
- name: Create server group
|
- name: Create server group
|
||||||
cloudscale_server_group:
|
cloudscale_server_group:
|
||||||
name: '{{ cloudscale_resource_prefix }}-grp'
|
name: '{{ cloudscale_resource_prefix }}-grp'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
stage: production
|
stage: production
|
||||||
|
@ -29,6 +30,7 @@
|
||||||
- grp is changed
|
- grp is changed
|
||||||
- grp.type == 'anti-affinity'
|
- grp.type == 'anti-affinity'
|
||||||
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
|
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
|
||||||
|
- grp.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- grp.uuid
|
- grp.uuid
|
||||||
- grp.tags.project == 'ansible-test'
|
- grp.tags.project == 'ansible-test'
|
||||||
- grp.tags.stage == 'production'
|
- grp.tags.stage == 'production'
|
||||||
|
@ -41,6 +43,7 @@
|
||||||
- name: Create server group idempotence
|
- name: Create server group idempotence
|
||||||
cloudscale_server_group:
|
cloudscale_server_group:
|
||||||
name: '{{ cloudscale_resource_prefix }}-grp'
|
name: '{{ cloudscale_resource_prefix }}-grp'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
stage: production
|
stage: production
|
||||||
|
@ -51,6 +54,7 @@
|
||||||
that:
|
that:
|
||||||
- grp is not changed
|
- grp is not changed
|
||||||
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
|
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
|
||||||
|
- grp.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- grp.uuid == server_group_uuid
|
- grp.uuid == server_group_uuid
|
||||||
- grp.tags.project == 'ansible-test'
|
- grp.tags.project == 'ansible-test'
|
||||||
- grp.tags.stage == 'production'
|
- grp.tags.stage == 'production'
|
||||||
|
@ -72,6 +76,7 @@
|
||||||
- grp is changed
|
- grp is changed
|
||||||
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
|
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
|
||||||
- grp.uuid == server_group_uuid
|
- grp.uuid == server_group_uuid
|
||||||
|
- grp.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- grp.tags.project == 'ansible-test'
|
- grp.tags.project == 'ansible-test'
|
||||||
- grp.tags.stage == 'production'
|
- grp.tags.stage == 'production'
|
||||||
- grp.tags.sla == '24-7'
|
- grp.tags.sla == '24-7'
|
||||||
|
@ -91,6 +96,7 @@
|
||||||
- grp is changed
|
- grp is changed
|
||||||
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
|
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
|
||||||
- grp.uuid == server_group_uuid
|
- grp.uuid == server_group_uuid
|
||||||
|
- grp.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- grp.tags.project == 'ansible-test'
|
- grp.tags.project == 'ansible-test'
|
||||||
- grp.tags.stage == 'staging'
|
- grp.tags.stage == 'staging'
|
||||||
- grp.tags.sla == '8-5'
|
- grp.tags.sla == '8-5'
|
||||||
|
@ -110,6 +116,7 @@
|
||||||
- grp is not changed
|
- grp is not changed
|
||||||
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
|
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
|
||||||
- grp.uuid == server_group_uuid
|
- grp.uuid == server_group_uuid
|
||||||
|
- grp.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- grp.tags.project == 'ansible-test'
|
- grp.tags.project == 'ansible-test'
|
||||||
- grp.tags.stage == 'staging'
|
- grp.tags.stage == 'staging'
|
||||||
- grp.tags.sla == '8-5'
|
- grp.tags.sla == '8-5'
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
cloudscale_server:
|
cloudscale_server:
|
||||||
name: '{{ cloudscale_resource_prefix }}-server'
|
name: '{{ cloudscale_resource_prefix }}-server'
|
||||||
flavor: '{{ cloudscale_test_flavor }}'
|
flavor: '{{ cloudscale_test_flavor }}'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
image: '{{ cloudscale_test_image }}'
|
image: '{{ cloudscale_test_image }}'
|
||||||
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
||||||
register: server
|
register: server
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
- name: Create volume in check mode
|
- name: Create volume in check mode
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
name: '{{ cloudscale_resource_prefix }}-vol'
|
name: '{{ cloudscale_resource_prefix }}-vol'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
size_gb: 50
|
size_gb: 50
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
- name: Create volume
|
- name: Create volume
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
name: '{{ cloudscale_resource_prefix }}-vol'
|
name: '{{ cloudscale_resource_prefix }}-vol'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
size_gb: 50
|
size_gb: 50
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
|
@ -32,26 +34,29 @@
|
||||||
- vol is changed
|
- vol is changed
|
||||||
- vol.size_gb == 50
|
- vol.size_gb == 50
|
||||||
- vol.name == '{{ cloudscale_resource_prefix }}-vol'
|
- vol.name == '{{ cloudscale_resource_prefix }}-vol'
|
||||||
|
- vol.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- vol.tags.project == 'ansible-test'
|
- vol.tags.project == 'ansible-test'
|
||||||
- vol.tags.stage == 'production'
|
- vol.tags.stage == 'production'
|
||||||
- vol.tags.sla == '24-7'
|
- vol.tags.sla == '24-7'
|
||||||
|
|
||||||
- name: Create volume indempotence
|
- name: Create volume idempotence
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
name: '{{ cloudscale_resource_prefix }}-vol'
|
name: '{{ cloudscale_resource_prefix }}-vol'
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
size_gb: 50
|
size_gb: 50
|
||||||
tags:
|
tags:
|
||||||
project: ansible-test
|
project: ansible-test
|
||||||
stage: production
|
stage: production
|
||||||
sla: 24-7
|
sla: 24-7
|
||||||
register: vol
|
register: vol
|
||||||
- name: 'VERIFY: Create volume indempotence'
|
- name: 'VERIFY: Create volume idempotence'
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- vol is successful
|
- vol is successful
|
||||||
- vol is not changed
|
- vol is not changed
|
||||||
- vol.size_gb == 50
|
- vol.size_gb == 50
|
||||||
- vol.name == '{{ cloudscale_resource_prefix }}-vol'
|
- vol.name == '{{ cloudscale_resource_prefix }}-vol'
|
||||||
|
- vol.zone.slug == '{{ cloudscale_test_zone }}'
|
||||||
- vol.tags.project == 'ansible-test'
|
- vol.tags.project == 'ansible-test'
|
||||||
- vol.tags.stage == 'production'
|
- vol.tags.stage == 'production'
|
||||||
- vol.tags.sla == '24-7'
|
- vol.tags.sla == '24-7'
|
||||||
|
@ -83,13 +88,13 @@
|
||||||
- vol is changed
|
- vol is changed
|
||||||
- server.uuid in vol.server_uuids
|
- server.uuid in vol.server_uuids
|
||||||
|
|
||||||
- name: Attach existing volume by name to server indempotence
|
- name: Attach existing volume by name to server idempotence
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
name: '{{ cloudscale_resource_prefix }}-vol'
|
name: '{{ cloudscale_resource_prefix }}-vol'
|
||||||
server_uuids:
|
server_uuids:
|
||||||
- '{{ server.uuid }}'
|
- '{{ server.uuid }}'
|
||||||
register: vol
|
register: vol
|
||||||
- name: 'VERIFY: Attach existing volume by name to server indempotence'
|
- name: 'VERIFY: Attach existing volume by name to server idempotence'
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- vol is successful
|
- vol is successful
|
||||||
|
@ -121,12 +126,12 @@
|
||||||
- vol is changed
|
- vol is changed
|
||||||
- vol.size_gb == 100
|
- vol.size_gb == 100
|
||||||
|
|
||||||
- name: Resize attached volume by UUID indempotence
|
- name: Resize attached volume by UUID idempotence
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
uuid: '{{ vol.uuid }}'
|
uuid: '{{ vol.uuid }}'
|
||||||
size_gb: 100
|
size_gb: 100
|
||||||
register: vol
|
register: vol
|
||||||
- name: 'VERIFY: Resize attached volume by UUID indempotence'
|
- name: 'VERIFY: Resize attached volume by UUID idempotence'
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- vol is successful
|
- vol is successful
|
||||||
|
@ -162,12 +167,12 @@
|
||||||
- deleted.uuid == vol.uuid
|
- deleted.uuid == vol.uuid
|
||||||
- deleted.name == '{{ cloudscale_resource_prefix }}-vol'
|
- deleted.name == '{{ cloudscale_resource_prefix }}-vol'
|
||||||
|
|
||||||
- name: Delete attached volume by UUID indempotence
|
- name: Delete attached volume by UUID idempotence
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
uuid: '{{ vol.uuid }}'
|
uuid: '{{ vol.uuid }}'
|
||||||
state: 'absent'
|
state: 'absent'
|
||||||
register: deleted
|
register: deleted
|
||||||
- name: 'VERIFY: Delete attached volume by UUID indempotence'
|
- name: 'VERIFY: Delete attached volume by UUID idempotence'
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- deleted is successful
|
- deleted is successful
|
||||||
|
@ -180,6 +185,7 @@
|
||||||
cloudscale_volume:
|
cloudscale_volume:
|
||||||
name: '{{ cloudscale_resource_prefix }}-bulk'
|
name: '{{ cloudscale_resource_prefix }}-bulk'
|
||||||
type: bulk
|
type: bulk
|
||||||
|
zone: '{{ cloudscale_test_zone }}'
|
||||||
size_gb: 100
|
size_gb: 100
|
||||||
server_uuids:
|
server_uuids:
|
||||||
- '{{ server.uuid }}'
|
- '{{ server.uuid }}'
|
||||||
|
|
Loading…
Reference in a new issue