mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
44679e71a2
* Extract common functionality. * Refactor duplicated code into module_utils. * Fixed ansible-test issues. * Address review comments. * Revert changes to consul_acl. It uses deprecated APIs disabled since Consul 1.11 (which is EOL), don't bother updating the module anymore. * Remove unused code. * Merge token into default doc fragment. * JSON all the way down. * extract validation tests into custom file and prep for requests removal. * Removed dependency on requests. * Initial test for consul_kv. * fixup license headers. * Revert changes to consul.py since it utilizes python-consul. * Disable the lookup test for now. * Fix python 2.7 support. * Address review comments. * Address review comments. * Addec changelog fragment. * Mark ConsulModule as private.
57 lines
No EOL
1.3 KiB
YAML
57 lines
No EOL
1.3 KiB
YAML
---
|
|
# Copyright (c) 2024, Florian Apolloner (@apollo13)
|
|
# 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 key
|
|
consul_kv:
|
|
key: somekey
|
|
value: somevalue
|
|
token: "{{ consul_management_token }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.data.Value == 'somevalue'
|
|
|
|
#- name: Test the lookup
|
|
# assert:
|
|
# that:
|
|
# - lookup('community.general.consul_kv', 'somekey', token=consul_management_token) == 'somevalue'
|
|
|
|
- name: Update a key with the same data
|
|
consul_kv:
|
|
key: somekey
|
|
value: somevalue
|
|
token: "{{ consul_management_token }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
- result.data.Value == 'somevalue'
|
|
|
|
- name: Remove a key from the store
|
|
consul_kv:
|
|
key: somekey
|
|
state: absent
|
|
token: "{{ consul_management_token }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.data.Value == 'somevalue'
|
|
|
|
- name: Remove a non-existant key from the store
|
|
consul_kv:
|
|
key: somekey
|
|
state: absent
|
|
token: "{{ consul_management_token }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
- not result.data |