mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
dc5f012e52
Consul action group (#7897)
Added action group for new style consul modules.
(cherry picked from commit afd1988810
)
Co-authored-by: Florian Apolloner <florian@apolloner.eu>
72 lines
No EOL
1.5 KiB
YAML
72 lines
No EOL
1.5 KiB
YAML
---
|
|
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
- name: Create a policy with rules
|
|
consul_policy:
|
|
name: foo-access
|
|
rules: |
|
|
key "foo" {
|
|
policy = "read"
|
|
}
|
|
key "private/foo" {
|
|
policy = "deny"
|
|
}
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.policy.Name == 'foo-access'
|
|
- result.operation == 'create'
|
|
|
|
- name: Update the rules associated to a policy
|
|
consul_policy:
|
|
name: foo-access
|
|
rules: |
|
|
key "foo" {
|
|
policy = "read"
|
|
}
|
|
key "private/foo" {
|
|
policy = "deny"
|
|
}
|
|
event "bbq" {
|
|
policy = "write"
|
|
}
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.operation == 'update'
|
|
|
|
- name: Update reports not changed when updating again without changes
|
|
consul_policy:
|
|
name: foo-access
|
|
rules: |
|
|
key "foo" {
|
|
policy = "read"
|
|
}
|
|
key "private/foo" {
|
|
policy = "deny"
|
|
}
|
|
event "bbq" {
|
|
policy = "write"
|
|
}
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
- result.operation is not defined
|
|
|
|
- name: Remove a policy
|
|
consul_policy:
|
|
name: foo-access
|
|
state: absent
|
|
register: result
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.operation == 'remove' |