1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/inventory_cloudscale/playbooks/setup.yml

75 lines
2.8 KiB
YAML
Raw Normal View History

2020-03-09 10:11:07 +01:00
---
- name: Create server with public network only
2020-03-29 13:02:28 +02:00
community.general.cloudscale_server:
2020-03-09 10:11:07 +01:00
name: '{{ cloudscale_resource_prefix }}-inventory-public'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
use_public_network: True
use_private_network: False
register: server_public
- name: Create server with private network only
2020-03-29 13:02:28 +02:00
community.general.cloudscale_server:
2020-03-09 10:11:07 +01:00
name: '{{ cloudscale_resource_prefix }}-inventory-private'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_alt_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
use_public_network: False
use_private_network: True
register: server_private
- name: Create server with public and private network
2020-03-29 13:02:28 +02:00
community.general.cloudscale_server:
2020-03-09 10:11:07 +01:00
name: '{{ cloudscale_resource_prefix }}-inventory-public-private'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
use_public_network: True
use_private_network: True
register: server_public_private
- name: Create servers with duplicate names
# The cloudscale_server module does not allow creating two servers with the same
# name. To do this the uri module has to be used.
uri:
url: 'https://api.cloudscale.ch/v1/servers'
method: POST
headers:
Authorization: 'Bearer {{ lookup("env", "CLOUDSCALE_API_TOKEN") }}'
body:
name: '{{ cloudscale_resource_prefix }}-duplicate'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys:
- '{{ cloudscale_test_ssh_key }}'
body_format: json
status_code: 201
register: duplicate
with_sequence: count=2
- name: Create server with different prefix
2020-03-29 13:02:28 +02:00
community.general.cloudscale_server:
2020-03-09 10:11:07 +01:00
name: 'other-prefix-{{ cloudscale_resource_prefix }}-inventory'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
register: server_other_prefix
# The API does not allow creation of a server with a name containing
# characters not allowed in DNS names. So create a server and rename
# it afterwards (which is possible). The resaon for this restriction is
# that on creation a PTR entry for the server is created.
- name: Create server to be renamed with unsafe characters
2020-03-29 13:02:28 +02:00
community.general.cloudscale_server:
2020-03-09 10:11:07 +01:00
name: '{{ cloudscale_resource_prefix }}-unsafe-chars'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
register: server_unsafe_chars
- name: Rename server to contain unsafe characters
2020-03-29 13:02:28 +02:00
community.general.cloudscale_server:
2020-03-09 10:11:07 +01:00
uuid: '{{ server_unsafe_chars.uuid }}'
name: '{{ cloudscale_resource_prefix }}-snowmans-are-cool-☃!'
register: server_unsafe_chars