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.
141 lines
4.3 KiB
YAML
141 lines
4.3 KiB
YAML
7 years ago
|
# 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)
|
||
7 years ago
|
---
|
||
7 years ago
|
- name: setup
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
7 years ago
|
state: absent
|
||
|
register: result
|
||
|
- name: verify setup
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
|
||
|
- name: test fail if missing name
|
||
6 years ago
|
vultr_startup_script:
|
||
7 years ago
|
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
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
7 years ago
|
register: result
|
||
|
ignore_errors: yes
|
||
|
- name: verify fail if missing params for state=present
|
||
|
assert:
|
||
|
that:
|
||
|
- result is failed
|
||
|
- 'result.msg == "state is present but all of the following are missing: script"'
|
||
|
|
||
|
- name: test create startup script in check mode
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
|
script: "{{ vultr_startup_script }}"
|
||
7 years ago
|
register: result
|
||
|
check_mode: yes
|
||
|
- name: verify test create startup script in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
|
||
|
- name: test create startup script
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
|
script: "{{ vultr_startup_script }}"
|
||
7 years ago
|
register: result
|
||
|
- name: verify test create startup script
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
6 years ago
|
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||
|
- result.vultr_startup_script.script == '{{ vultr_startup_script }}'
|
||
7 years ago
|
|
||
|
- name: test create startup script idempotence
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
|
script: "{{ vultr_startup_script }}"
|
||
7 years ago
|
register: result
|
||
|
- name: verify test create startup script idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
6 years ago
|
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||
|
- result.vultr_startup_script.script == '{{ vultr_startup_script }}'
|
||
7 years ago
|
|
||
|
- name: test update startup script in check mode
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
|
script: "{{ vultr_startup_script2 }}"
|
||
7 years ago
|
register: result
|
||
|
check_mode: yes
|
||
|
- name: verify test update startup script in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
6 years ago
|
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||
|
- result.vultr_startup_script.script == '{{ vultr_startup_script }}'
|
||
7 years ago
|
|
||
|
- name: test update startup script
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
|
script: "{{ vultr_startup_script2 }}"
|
||
7 years ago
|
register: result
|
||
|
- name: verify test update startup script
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
6 years ago
|
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||
|
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||
7 years ago
|
|
||
|
- name: test update startup script idempotence
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
|
script: "{{ vultr_startup_script2 }}"
|
||
7 years ago
|
register: result
|
||
|
- name: verify test update startup script idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
6 years ago
|
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||
|
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||
7 years ago
|
|
||
|
- name: test absent startup script in check mode
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
7 years ago
|
state: absent
|
||
|
register: result
|
||
|
check_mode: yes
|
||
|
- name: verify test absent startup script in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
6 years ago
|
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||
|
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||
7 years ago
|
|
||
|
- name: test absent startup script
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
7 years ago
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test absent startup script
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
6 years ago
|
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||
|
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||
7 years ago
|
|
||
|
- name: test absent startup script idempotence
|
||
6 years ago
|
vultr_startup_script:
|
||
|
name: "{{ vultr_startup_script_name }}"
|
||
7 years ago
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test absent startup script idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|