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/test/legacy/roles/scaleway_user_data/tasks/main.yml

79 lines
1.9 KiB
YAML

# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_user_data
- name: Create a server
scaleway_compute:
name: foobar
state: present
image: 857de28c-39ce-4b15-9389-b68d8bb1bb51
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
region: par1
commercial_type: START1-S
wait: true
register: server_creation_task
- debug: var=server_creation_task
- set_fact:
server_id: "{{ server_creation_task.msg.id }}"
- debug: var=server_id
- name: Patch user_data cloud-init configuration (Check)
check_mode: yes
scaleway_user_data:
region: par1
server_id: "{{ server_id }}"
user_data:
cloud-init: "{{ cloud_init_script }}"
register: user_data_check_task
- debug: var=user_data_check_task
- assert:
that:
- user_data_check_task is success
- user_data_check_task is changed
- name: Patch user_data cloud-init configuration
scaleway_user_data:
region: par1
server_id: "{{ server_id }}"
user_data:
cloud-init: "{{ cloud_init_script }}"
register: user_data_task
- debug: var=user_data_task
- assert:
that:
- user_data_task is success
- user_data_task is changed
- name: Patch user_data cloud-init configuration (Confirmation)
scaleway_user_data:
region: par1
server_id: "{{ server_id }}"
user_data:
cloud-init: "{{ cloud_init_script }}"
register: user_data_confirmation_task
- debug: var=user_data_confirmation_task
- assert:
that:
- user_data_confirmation_task is success
- user_data_confirmation_task is not changed
- name: Destroy it
scaleway_compute:
name: foobar
state: absent
region: par1
image: 857de28c-39ce-4b15-9389-b68d8bb1bb51
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
commercial_type: START1-S
wait: true
register: server_destroy_task
- debug: var=server_destroy_task