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.
476 lines
13 KiB
YAML
476 lines
13 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)
|
||
|
---
|
||
|
- name: setup firewall group
|
||
6 years ago
|
vultr_firewall_group:
|
||
|
name: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
register: result
|
||
|
- name: verify setup firewall group
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
|
||
|
- name: setup firewall rule tcp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify setup firewal rule
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
|
||
|
- name: setup firewall rule udp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify setup firewal rule udp
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
|
||
|
- name: setup firewall rule udp v6
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
ip_version: v6
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify setup firewal rule udp v6
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
|
||
|
- name: setup firewall rule port range
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
start_port: 8000
|
||
|
end_port: 8080
|
||
|
protocol: tcp
|
||
|
cidr: 10.100.12.0/24
|
||
|
state: absent
|
||
|
register: result
|
||
|
tags: tmp
|
||
|
- name: verify setup firewal rule port range
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
|
||
|
- name: setup firewall rule icmp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
protocol: icmp
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify setup firewal rule
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
|
||
|
- name: test fail if missing group
|
||
6 years ago
|
vultr_firewall_rule:
|
||
7 years ago
|
register: result
|
||
|
ignore_errors: yes
|
||
|
- name: verify test fail if missing group
|
||
|
assert:
|
||
|
that:
|
||
|
- result is failed
|
||
|
- 'result.msg == "missing required arguments: group"'
|
||
|
|
||
|
- name: test create firewall rule tcp in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: verify test create firewall rule tcp in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
|
||
|
- name: test create firewall rule tcp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
register: result
|
||
|
- name: verify test create firewall rule tcp
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||
|
|
||
|
- name: test create firewall rule tcp idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
register: result
|
||
|
- name: verify test create firewall rule tcp idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||
|
|
||
|
- name: test create firewall rule udp in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: verify test create firewall rule udp in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
|
||
|
- name: test create firewall rule udp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
register: result
|
||
|
- name: verify test create firewall rule udp
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "udp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||
|
|
||
|
- name: test create firewall rule udp idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
register: result
|
||
|
- name: verify test create firewall rule udp idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "udp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||
|
|
||
|
- name: test create firewall rule udp v6 in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
ip_version: v6
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: verify test create firewall rule udp v6 in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
|
||
|
- name: test create firewall rule udp v6
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
ip_version: v6
|
||
|
register: result
|
||
|
- name: verify test create firewall rule udp v6
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "udp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "::/0"
|
||
|
|
||
|
- name: test create firewall rule udp v6 idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
ip_version: v6
|
||
|
register: result
|
||
|
- name: verify test create firewall rule udp v6 idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "udp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "::/0"
|
||
|
|
||
|
- name: test create firewall rule port range in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
start_port: 8000
|
||
|
end_port: 8080
|
||
|
protocol: tcp
|
||
|
cidr: 10.100.12.0/24
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: verify test create firewall rule port range in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
|
||
|
- name: test create firewall rule port range
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
start_port: 8000
|
||
|
end_port: 8080
|
||
|
protocol: tcp
|
||
|
cidr: 10.100.12.0/24
|
||
|
register: result
|
||
|
- name: verify test create firewall rule port range
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 8000
|
||
|
- result.vultr_firewall_rule.end_port == 8080
|
||
|
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||
|
|
||
|
- name: test create firewall rule port range idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
start_port: 8000
|
||
|
end_port: 8080
|
||
|
protocol: tcp
|
||
|
cidr: 10.100.12.0/24
|
||
|
register: result
|
||
|
- name: test create firewall rule port range idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 8000
|
||
|
- result.vultr_firewall_rule.end_port == 8080
|
||
|
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||
|
|
||
|
- name: test create firewall rule icmp in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
protocol: icmp
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: test create firewall rule icmp in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
|
||
|
- name: test create firewall rule icmp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
protocol: icmp
|
||
|
register: result
|
||
|
- name: test create firewall rule icmp
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "icmp"
|
||
|
|
||
|
- name: test create firewall rule icmp idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
protocol: icmp
|
||
|
register: result
|
||
|
- name: test create firewall rule icmp idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "icmp"
|
||
|
|
||
|
- name: test remove firewall rule icmp in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
protocol: icmp
|
||
|
state: absent
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: test remove firewall rule icmp in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "icmp"
|
||
|
|
||
|
- name: test remove firewall rule icmp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
protocol: icmp
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: test remove firewall rule icmp
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "icmp"
|
||
|
|
||
|
- name: test remove firewall rule icmp idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
protocol: icmp
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: test remove firewall rule icmp idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
|
||
|
- name: test remove firewall rule tcp in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
state: absent
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: verify test remove firewall rule tcp in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||
|
|
||
|
- name: test remove firewall rule tcp
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test remove firewall rule tcp
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||
|
|
||
|
- name: test remove firewall rule tcp idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test remove firewall rule tcp idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
|
||
|
- name: test remove firewall rule udp v6 in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
ip_version: v6
|
||
|
state: absent
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: verify test remove firewall rule udp v6 in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "udp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "::/0"
|
||
|
|
||
|
- name: test remove firewall rule udp v6
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
ip_version: v6
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test remove firewall rule udp v6
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "udp"
|
||
|
- result.vultr_firewall_rule.start_port == 53
|
||
|
- result.vultr_firewall_rule.cidr == "::/0"
|
||
|
|
||
|
- name: test remove firewall rule udp v6 idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
port: 53
|
||
|
protocol: udp
|
||
|
ip_version: v6
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test remove firewall rule udp v6 idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|
||
|
|
||
|
- name: test remove firewall rule port range in check mode
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
start_port: 8000
|
||
|
end_port: 8080
|
||
|
protocol: tcp
|
||
|
cidr: 10.100.12.0/24
|
||
|
state: absent
|
||
|
register: result
|
||
|
check_mode: true
|
||
|
- name: verify test remove firewall rule port range in check mode
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 8000
|
||
|
- result.vultr_firewall_rule.end_port == 8080
|
||
|
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||
|
|
||
|
- name: test remove firewall rule port range
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
start_port: 8000
|
||
|
end_port: 8080
|
||
|
protocol: tcp
|
||
|
cidr: 10.100.12.0/24
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test remove firewall rule port range
|
||
|
assert:
|
||
|
that:
|
||
|
- result is changed
|
||
|
- result.vultr_firewall_rule.action == "accept"
|
||
|
- result.vultr_firewall_rule.protocol == "tcp"
|
||
|
- result.vultr_firewall_rule.start_port == 8000
|
||
|
- result.vultr_firewall_rule.end_port == 8080
|
||
|
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||
|
|
||
|
- name: test remove firewall rule port range idempotence
|
||
6 years ago
|
vultr_firewall_rule:
|
||
|
group: "{{ vultr_firewall_group_name }}"
|
||
7 years ago
|
start_port: 8000
|
||
|
end_port: 8080
|
||
|
protocol: tcp
|
||
|
cidr: 10.100.12.0/24
|
||
|
state: absent
|
||
|
register: result
|
||
|
- name: verify test remove firewall rule port range idempotence
|
||
|
assert:
|
||
|
that:
|
||
|
- result is not changed
|