Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/consul/tasks/consul_binding_rule.yml

raw
1 ---
2 # Copyright (c) 2024, Florian Apolloner (@apollo13)
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: Create an auth method
7 community.general.consul_auth_method:
8 name: test
9 type: jwt
10 config:
11 jwt_validation_pubkeys:
12 - |
13 -----BEGIN PUBLIC KEY-----
14 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo
15 4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u
16 +qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyeh
17 kd3qqGElvW/VDL5AaWTg0nLVkjRo9z+40RQzuVaE8AkAFmxZzow3x+VJYKdjykkJ
18 0iT9wCS0DRTXu269V264Vf/3jvredZiKRkgwlL9xNAwxXFg0x/XFw005UWVRIkdg
19 cKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbc
20 mwIDAQAB
21 -----END PUBLIC KEY-----
22
23 - name: Create a binding rule
24 community.general.consul_binding_rule:
25 name: test-binding
26 description: my description
27 auth_method: test
28 bind_type: service
29 bind_name: yolo
30 register: result
31
32 - assert:
33 that:
34 - result is changed
35 - result.binding_rule.AuthMethod == 'test'
36 - "result.binding_rule.Description == 'test-binding: my description'"
37 - result.operation == 'create'
38
39 - name: Update a binding rule
40 community.general.consul_binding_rule:
41 name: test-binding
42 auth_method: test
43 bind_name: yolo2
44 register: result
45
46 - assert:
47 that:
48 - result is changed
49 - "result.binding_rule.Description == 'test-binding: my description'"
50 - result.operation == 'update'
51
52 - name: Update a binding rule (noop)
53 community.general.consul_binding_rule:
54 name: test-binding
55 auth_method: test
56 register: result
57
58 - assert:
59 that:
60 - result is not changed
61 - "result.binding_rule.Description == 'test-binding: my description'"
62 - result.operation is not defined
63
64 - name: Delete a binding rule
65 community.general.consul_binding_rule:
66 name: test-binding
67 auth_method: test
68 state: absent
69 register: result
70 - assert:
71 that:
72 - result is changed
73 - result.operation == 'remove'