-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathpostfix_address.yml
145 lines (129 loc) · 3.63 KB
/
postfix_address.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---
- name: Testing Postfix Address
hosts: localhost
gather_facts: no
module_defaults:
group/ansibleguy.opnsense.all:
firewall: "{{ lookup('ansible.builtin.env', 'TEST_FIREWALL') }}"
api_credential_file: "{{ lookup('ansible.builtin.env', 'TEST_API_KEY') }}"
ssl_verify: false
ansibleguy.opnsense.list:
target: 'postfix_address'
tasks:
- name: Listing
ansibleguy.opnsense.list:
register: opn_pre1
failed_when: >
'data' not in opn_pre1 or
opn_pre1.data | length != 0
- name: Removing - does not exist
ansibleguy.opnsense.postfix_address:
address: 'ANSIBLE_TEST_99_9'
state: 'absent'
register: opn_pre2
failed_when: >
opn_pre2.failed or
opn_pre2.changed
- name: Adding 1 - failing because of missing to value
ansibleguy.opnsense.postfix_address:
address: [email protected]
register: opn_fail1
failed_when: not opn_fail1.failed
- name: Adding 1
ansibleguy.opnsense.postfix_address:
address: [email protected]
register: opn1
failed_when: >
opn1.failed or
not opn1.changed
- name: Changing 1
ansibleguy.opnsense.postfix_address:
address: [email protected]
to:
register: opn2
failed_when: >
opn2.failed or
not opn2.changed
- name: Disabling 1
ansibleguy.opnsense.postfix_address:
address: [email protected]
to:
enabled: false
register: opn3
failed_when: >
opn3.failed or
not opn3.changed
when: not ansible_check_mode
- name: Disabling 1 - nothing changed
ansibleguy.opnsense.postfix_address:
address: [email protected]
to:
enabled: false
register: opn4
failed_when: >
opn4.failed or
opn4.changed
when: not ansible_check_mode
- name: Enabling 1
ansibleguy.opnsense.postfix_address:
address: [email protected]
to:
register: opn5
failed_when: >
opn5.failed or
not opn5.changed
when: not ansible_check_mode
- name: Adding 2
ansibleguy.opnsense.postfix_address:
address: [email protected]
register: opn6
failed_when: >
opn6.failed or
not opn6.changed
- name: Adding 2 - nothing changed
ansibleguy.opnsense.postfix_address:
address: [email protected]
register: opn7
failed_when: >
opn7.failed or
opn7.changed
when: not ansible_check_mode
- name: Removing 2
ansibleguy.opnsense.postfix_address:
address: [email protected]
state: absent
register: opn8
failed_when: >
opn8.failed or
not opn8.changed
when: not ansible_check_mode
- name: Listing
ansibleguy.opnsense.list:
register: opn9
failed_when: >
'data' not in opn9 or
opn9.data | length != 1
when: not ansible_check_mode
- name: Cleanup
ansibleguy.opnsense.postfix_address:
address: [email protected]
state: 'absent'
when: not ansible_check_mode
- name: Listing
ansibleguy.opnsense.list:
register: opn_clean1
failed_when: >
'data' not in opn_clean1 or
opn_clean1.data | length != 0
when: not ansible_check_mode