Debian Codegraph @

ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user_limits/tasks/ubuntu.yml

raw
1 ---
2
3 - name: Test setting user limits in check mode
4 block:
5 - name: Set user limits in check mode
6 rabbitmq_user_limits:
7 user: guest
8 max_connections: 64
9 max_channels: 256
10 state: present
11 check_mode: true
12 register: module_result
13
14 - name: Check that the module's result is correct
15 assert:
16 that:
17 - module_result is changed
18 - module_result is success
19
20 - name: Get a list of configured user limits
21 shell: "rabbitmqctl list_user_limits"
22 register: shell_result
23
24 - name: Check that the check mode does not make any changes
25 assert:
26 that:
27 - shell_result is success
28 - "'\"max-connections\":64' not in shell_result.stdout"
29 - "'\"max-channels\":256' not in shell_result.stdout"
30
31 - name: Test setting user limits
32 block:
33 - name: Set user limits
34 rabbitmq_user_limits:
35 user: guest
36 max_connections: 64
37 max_channels: 256
38 state: present
39 register: module_result
40
41 - name: Check that the module's result is correct
42 assert:
43 that:
44 - module_result is changed
45 - module_result is success
46
47 - name: Get a list of configured user limits
48 shell: "rabbitmqctl list_user_limits"
49 register: shell_result
50
51 - name: Check that the user limits are actually set
52 assert:
53 that:
54 - shell_result is success
55 - "'\"max-connections\":64' in shell_result.stdout"
56 - "'\"max-channels\":256' in shell_result.stdout"
57
58 - name: Test setting user limits (idempotence)
59 block:
60 - name: Set user limits (idempotence)
61 rabbitmq_user_limits:
62 user: guest
63 max_connections: 64
64 max_channels: 256
65 state: present
66 register: module_result
67
68 - name: Check the idempotence
69 assert:
70 that:
71 - module_result is not changed
72 - module_result is success
73
74 - name: Test changing user limits
75 block:
76 - name: Change user limits
77 rabbitmq_user_limits:
78 user: guest
79 max_connections: 32
80 state: present
81 register: module_result
82
83 - name: Check that the module's result is correct
84 assert:
85 that:
86 - module_result is changed
87 - module_result is success
88
89 - name: Get a list of configured user limits
90 shell: "rabbitmqctl list_user_limits"
91 register: shell_result
92
93 - name: Check that the user limits are actually set
94 assert:
95 that:
96 - shell_result is success
97 - "'\"max-connections\":32' in shell_result.stdout"
98 - "'\"max-channels\"' not in shell_result.stdout"
99
100 - name: Test clearing user limits in check mode
101 block:
102 - name: Clear user limits in check mode
103 rabbitmq_user_limits:
104 user: guest
105 state: absent
106 check_mode: true
107 register: module_result
108
109 - name: Check that the module's result is correct
110 assert:
111 that:
112 - module_result is not changed
113 - module_result is success
114
115 - name: Get a list of configured user limits
116 shell: "rabbitmqctl list_user_limits"
117 register: shell_result
118
119 - name: Check that the check mode does not make any changes
120 assert:
121 that:
122 - shell_result is success
123 - "'\"max-connections\":32' in shell_result.stdout"
124 - "'\"max-channels\"' not in shell_result.stdout"
125
126 - name: Test clearing user limits
127 block:
128 - name: Clear user limits
129 rabbitmq_user_limits:
130 user: guest
131 state: absent
132 register: module_result
133
134 - name: Check that the module's result is correct
135 assert:
136 that:
137 - module_result is changed
138 - module_result is success
139
140 - name: Get a list of configured user limits
141 shell: "rabbitmqctl list_user_limits"
142 register: shell_result
143
144 - name: Check that the user limits are actually cleared
145 assert:
146 that:
147 - shell_result is success
148 - "'\"max-connections\":' not in shell_result.stdout"
149 - "'\"max-channels\":' not in shell_result.stdout"
150
151 - name: Test clearing user limits (idempotence)
152 block:
153 - name: Clear user limits (idempotence)
154 rabbitmq_user_limits:
155 user: guest
156 state: absent
157 register: module_result
158
159 - name: Check the idempotence
160 assert:
161 that:
162 - module_result is not changed
163 - module_result is success