2018-01-21 21:54:12 +00: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 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
|
|
|
name: "{{ vultr_firewall_group_name }}"
|
2018-01-21 21:54:12 +00:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
- name: verify setup
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is success
|
|
|
|
|
|
|
|
- name: test fail if missing name
|
2018-08-13 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
2018-01-21 21:54:12 +00: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 create firewall group in check mode
|
2018-08-13 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
|
|
|
name: "{{ vultr_firewall_group_name }}"
|
2018-01-21 21:54:12 +00:00
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test create firewall group in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
|
|
|
|
- name: test create firewall group
|
2018-08-13 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
|
|
|
name: "{{ vultr_firewall_group_name }}"
|
2018-01-21 21:54:12 +00:00
|
|
|
register: result
|
|
|
|
- name: verify test create firewall group
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
2018-08-13 08:21:50 +00:00
|
|
|
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
2018-01-21 21:54:12 +00:00
|
|
|
|
|
|
|
- name: test create firewall group idempotence
|
2018-08-13 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
|
|
|
name: "{{ vultr_firewall_group_name }}"
|
2018-01-21 21:54:12 +00:00
|
|
|
|
|
|
|
register: result
|
|
|
|
- name: verify test create firewall group idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
2018-08-13 08:21:50 +00:00
|
|
|
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
2018-01-21 21:54:12 +00:00
|
|
|
|
|
|
|
- name: test absent firewall group in check mode
|
2018-08-13 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
|
|
|
name: "{{ vultr_firewall_group_name }}"
|
2018-01-21 21:54:12 +00:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
check_mode: yes
|
|
|
|
- name: verify test absent firewall group in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
2018-08-13 08:21:50 +00:00
|
|
|
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
2018-01-21 21:54:12 +00:00
|
|
|
|
|
|
|
- name: test absent firewall group
|
2018-08-13 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
|
|
|
name: "{{ vultr_firewall_group_name }}"
|
2018-01-21 21:54:12 +00:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
- name: verify test absent firewall group
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
2018-08-13 08:21:50 +00:00
|
|
|
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
2018-01-21 21:54:12 +00:00
|
|
|
|
|
|
|
- name: test absent firewall group idempotence
|
2018-08-13 08:21:50 +00:00
|
|
|
vultr_firewall_group:
|
|
|
|
name: "{{ vultr_firewall_group_name }}"
|
2018-01-21 21:54:12 +00:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
- name: verify test absent firewall group idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|