mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.9 KiB
YAML
80 lines
1.9 KiB
YAML
6 years ago
|
# 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
|