2018-01-21 22:54:12 +01:00
|
|
|
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
---
|
|
|
|
- name: setup
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
- name: verify setup
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is success
|
|
|
|
|
2018-09-19 00:01:53 +02:00
|
|
|
# Servers can only be destroyed 5 min after creation
|
|
|
|
- name: wait for 5 min
|
2019-04-27 02:33:59 +02:00
|
|
|
wait_for:
|
2018-09-19 00:01:53 +02:00
|
|
|
when: result is changed
|
|
|
|
|
2018-01-21 22:54:12 +01:00
|
|
|
- name: test fail if missing name
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
2018-01-21 22:54:12 +01:00
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
- name: verify test fail if missing name
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is failed
|
|
|
|
- 'result.msg == "missing required arguments: name"'
|
|
|
|
|
|
|
|
- name: test fail if missing params for state=present
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
- name: verify fail if missing params for state=present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is failed
|
|
|
|
- 'result.msg == "missing required arguments: os, plan, region"'
|
|
|
|
|
2019-06-09 13:34:25 +02:00
|
|
|
- name: test fail if plan does not exist
|
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
|
|
|
os: CentOS 6 x64
|
|
|
|
plan: does_not_exist
|
|
|
|
region: Amsterdam
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
- name: verify test fail if plan does not exist
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is failed
|
|
|
|
- 'result.msg == "Could not find plans with ID or name: does_not_exist"'
|
|
|
|
|
2019-01-01 10:11:10 +01:00
|
|
|
- name: setup create ssh keys
|
|
|
|
vultr_ssh_key:
|
|
|
|
name: "{{ item.name }}"
|
|
|
|
ssh_key: "{{ item.key }}"
|
|
|
|
loop: "{{ vultr_server_ssh_keys }}"
|
|
|
|
|
2018-01-21 22:54:12 +01:00
|
|
|
- name: test create server in check mode
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_1 }}"
|
2019-01-01 10:11:10 +01:00
|
|
|
ssh_keys:
|
|
|
|
- key1
|
|
|
|
- key2
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
state: started
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test create server in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
|
|
|
|
- name: test create server
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_1 }}"
|
2019-01-01 10:11:10 +01:00
|
|
|
ssh_keys:
|
|
|
|
- key1
|
|
|
|
- key2
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
state: started
|
|
|
|
register: result
|
|
|
|
- name: verify test create server
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_1
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.power_status == 'running'
|
|
|
|
|
|
|
|
- name: test create server idempotence
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_1 }}"
|
2019-01-01 10:11:10 +01:00
|
|
|
ssh_keys:
|
|
|
|
- key1
|
|
|
|
- key2
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
state: started
|
|
|
|
register: result
|
|
|
|
- name: verify test create server idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_1
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test stop an existing server in check mode
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: stopped
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test stop server in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test stop an existing server
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: stopped
|
|
|
|
register: result
|
|
|
|
- name: verify test stop an existing server
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'stopped'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test stop an existing server idempotence
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: stopped
|
|
|
|
register: result
|
|
|
|
- name: verify test stop an existing server idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'stopped'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test start an existing server in check mode
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: started
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test start an existing server in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'stopped'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test start an existing server
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: started
|
|
|
|
register: result
|
|
|
|
- name: verify test start an existing server
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test start an existing server idempotence
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: started
|
|
|
|
register: result
|
|
|
|
- name: verify test start an existing server idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test update plan for server in check mode without force
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test update plan for server in check mode without force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_1
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test update plan for server without force
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
register: result
|
|
|
|
- name: verify test update plan for server without force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_1
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: setup firewall group
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_firewall_group:
|
2018-01-21 22:54:12 +01:00
|
|
|
name: test_firewall_group
|
|
|
|
register: result
|
|
|
|
- name: verify test create firewall group
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is success
|
|
|
|
|
|
|
|
- name: test fail with unknown firewall group
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
|
|
|
region: Amsterdam
|
|
|
|
firewall_group: does not exist
|
|
|
|
tag: test_tag
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test fail with unknown firewall group
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is failed
|
|
|
|
- result.msg.startswith('Could not find')
|
|
|
|
|
|
|
|
- name: test update tag, firewall group for server in check mode without force
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
|
|
|
region: Amsterdam
|
|
|
|
firewall_group: test_firewall_group
|
|
|
|
tag: test_tag
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test update tag, firewall group for server in check mode without force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_1
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.tag == ''
|
|
|
|
- result.vultr_server.firewall_group != 'test_firewall_group'
|
|
|
|
|
|
|
|
- name: test update tag, firewall group for server without force
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
|
|
|
region: Amsterdam
|
|
|
|
firewall_group: test_firewall_group
|
|
|
|
tag: test_tag
|
|
|
|
register: result
|
|
|
|
- name: verify test update tag, firewall group for server without force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.tag == 'test_tag'
|
|
|
|
- result.vultr_server.firewall_group == 'test_firewall_group'
|
|
|
|
|
|
|
|
- name: test update tag, firewall group for server without force idempotence
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
|
|
|
region: Amsterdam
|
|
|
|
firewall_group: test_firewall_group
|
|
|
|
tag: test_tag
|
|
|
|
register: result
|
|
|
|
- name: verify test update tag, firewall group for server without force idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.tag == 'test_tag'
|
|
|
|
- result.vultr_server.firewall_group == 'test_firewall_group'
|
|
|
|
|
|
|
|
- name: test update server in check mode with force
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
auto_backup_enabled: yes
|
2019-04-23 21:22:17 +02:00
|
|
|
private_network_enabled: yes
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
force: yes
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test update server in check mode with force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_1
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.auto_backup_enabled == false
|
2019-04-23 21:22:17 +02:00
|
|
|
- result.vultr_server.internal_ip == ''
|
2018-01-21 22:54:12 +01:00
|
|
|
|
|
|
|
- name: test update server with force
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
auto_backup_enabled: yes
|
2019-04-23 21:22:17 +02:00
|
|
|
private_network_enabled: yes
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
force: yes
|
|
|
|
register: result
|
|
|
|
- name: verify test update server with force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_2
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.auto_backup_enabled == true
|
2019-04-23 21:22:17 +02:00
|
|
|
- result.vultr_server.internal_ip != ''
|
2018-01-21 22:54:12 +01:00
|
|
|
|
|
|
|
- name: test update server idempotence with force
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2019-04-23 21:22:17 +02:00
|
|
|
auto_backup_enabled: yes
|
|
|
|
private_network_enabled: yes
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
2019-04-23 21:22:17 +02:00
|
|
|
force: yes
|
2018-01-21 22:54:12 +01:00
|
|
|
register: result
|
|
|
|
- name: verify test update server idempotence with force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_2
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.auto_backup_enabled == true
|
2019-04-23 21:22:17 +02:00
|
|
|
- result.vultr_server.internal_ip != ''
|
2018-01-21 22:54:12 +01:00
|
|
|
|
2019-06-09 13:34:25 +02:00
|
|
|
- name: test update server with IDs idempotence with force
|
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
|
|
|
os: "127"
|
|
|
|
plan: "202"
|
|
|
|
auto_backup_enabled: yes
|
|
|
|
private_network_enabled: yes
|
|
|
|
region: "7"
|
|
|
|
force: yes
|
|
|
|
register: result
|
|
|
|
- name: verify test update server idempotence with force
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
|
|
|
- result.vultr_server.name == vultr_server_name
|
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.plan == vultr_server_plan_2
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.auto_backup_enabled == true
|
|
|
|
- result.vultr_server.internal_ip != ''
|
|
|
|
|
2018-01-21 22:54:12 +01:00
|
|
|
- name: test update server to stopped in check mode
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2019-04-23 21:22:17 +02:00
|
|
|
ipv6_enabled: yes
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
state: stopped
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test update server to stopped in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_2
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.v6_main_ip == ''
|
|
|
|
|
|
|
|
- name: test update server to stopped
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2019-04-23 21:22:17 +02:00
|
|
|
ipv6_enabled: yes
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
state: stopped
|
|
|
|
register: result
|
|
|
|
- name: verify test update server to stopped
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'stopped'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_2
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.v6_main_ip != ''
|
|
|
|
|
|
|
|
- name: test update server to stopped idempotence
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
os: CentOS 6 x64
|
2019-03-17 11:28:29 +01:00
|
|
|
plan: "{{ vultr_server_plan_2 }}"
|
2019-04-23 21:22:17 +02:00
|
|
|
ipv6_enabled: yes
|
2018-01-21 22:54:12 +01:00
|
|
|
region: Amsterdam
|
|
|
|
state: stopped
|
|
|
|
register: result
|
|
|
|
- name: verify test update server to stopped idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
- result.vultr_server.power_status == 'stopped'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.plan == vultr_server_plan_2
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
- result.vultr_server.v6_main_ip != ''
|
|
|
|
|
|
|
|
- name: test restart an existing server in check mode
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: restarted
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test restart an existing server in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'stopped'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test restart an existing server
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: restarted
|
|
|
|
register: result
|
|
|
|
- name: verify test restart an existing server
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test absent server in check mode
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test absent server in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
# Servers can only be destroyed 5 min after creation
|
|
|
|
- name: wait for 5 min
|
2019-04-27 02:33:59 +02:00
|
|
|
wait_for:
|
2018-01-21 22:54:12 +01:00
|
|
|
|
|
|
|
- name: test absent server
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
- name: verify test absent server
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result.vultr_server.power_status == 'running'
|
2019-03-17 11:28:29 +01:00
|
|
|
- result.vultr_server.name == vultr_server_name
|
2018-01-21 22:54:12 +01:00
|
|
|
- result.vultr_server.os == 'CentOS 6 x64'
|
|
|
|
- result.vultr_server.region == 'Amsterdam'
|
|
|
|
|
|
|
|
- name: test absent server idempotence
|
2018-08-13 10:21:50 +02:00
|
|
|
vultr_server:
|
|
|
|
name: "{{ vultr_server_name }}"
|
2018-01-21 22:54:12 +01:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
- name: verify test absent server idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
2019-01-01 10:11:10 +01:00
|
|
|
|
|
|
|
- name: cleanup ssh keys
|
|
|
|
vultr_ssh_key:
|
|
|
|
name: "{{ item.name }}"
|
|
|
|
ssh_key: "{{ item.key }}"
|
|
|
|
state: absent
|
|
|
|
loop: "{{ vultr_server_ssh_keys }}"
|