mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Consul action group (#7897)
Added action group for new style consul modules.
This commit is contained in:
parent
be3bfd6fa5
commit
afd1988810
16 changed files with 39 additions and 47 deletions
2
changelogs/fragments/7897-consul-action-group.yaml
Normal file
2
changelogs/fragments/7897-consul-action-group.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- consul_auth_method, consul_binding_rule, consul_policy, consul_role, consul_session, consul_token - added action group ``community.general.consul`` (https://github.com/ansible-collections/community.general/pull/7897).
|
|
@ -4,6 +4,14 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
requires_ansible: '>=2.13.0'
|
||||
action_groups:
|
||||
consul:
|
||||
- consul_auth_method
|
||||
- consul_binding_rule
|
||||
- consul_policy
|
||||
- consul_role
|
||||
- consul_session
|
||||
- consul_token
|
||||
plugin_routing:
|
||||
connection:
|
||||
docker:
|
||||
|
|
|
@ -47,3 +47,14 @@ options:
|
|||
- The token to use for authorization.
|
||||
type: str
|
||||
"""
|
||||
|
||||
ACTIONGROUP_CONSUL = r"""
|
||||
options: {}
|
||||
attributes:
|
||||
action_group:
|
||||
description: Use C(group/community.general.consul) in C(module_defaults) to set defaults for this module.
|
||||
support: full
|
||||
membership:
|
||||
- community.general.consul
|
||||
version_added: 8.3.0
|
||||
"""
|
||||
|
|
|
@ -21,6 +21,7 @@ author:
|
|||
- Florian Apolloner (@apollo13)
|
||||
extends_documentation_fragment:
|
||||
- community.general.consul
|
||||
- community.general.consul.actiongroup_consul
|
||||
- community.general.consul.token
|
||||
- community.general.attributes
|
||||
attributes:
|
||||
|
|
|
@ -21,6 +21,7 @@ author:
|
|||
- Florian Apolloner (@apollo13)
|
||||
extends_documentation_fragment:
|
||||
- community.general.consul
|
||||
- community.general.consul.actiongroup_consul
|
||||
- community.general.consul.token
|
||||
- community.general.attributes
|
||||
attributes:
|
||||
|
|
|
@ -21,6 +21,7 @@ author:
|
|||
- Håkon Lerring (@Hakon)
|
||||
extends_documentation_fragment:
|
||||
- community.general.consul
|
||||
- community.general.consul.actiongroup_consul
|
||||
- community.general.consul.token
|
||||
- community.general.attributes
|
||||
attributes:
|
||||
|
|
|
@ -22,6 +22,7 @@ author:
|
|||
extends_documentation_fragment:
|
||||
- community.general.consul
|
||||
- community.general.consul.token
|
||||
- community.general.consul.actiongroup_consul
|
||||
- community.general.attributes
|
||||
attributes:
|
||||
check_mode:
|
||||
|
|
|
@ -21,6 +21,7 @@ author:
|
|||
- Håkon Lerring (@Hakon)
|
||||
extends_documentation_fragment:
|
||||
- community.general.consul
|
||||
- community.general.consul.actiongroup_consul
|
||||
- community.general.consul.token
|
||||
- community.general.attributes
|
||||
attributes:
|
||||
|
|
|
@ -22,6 +22,7 @@ author:
|
|||
extends_documentation_fragment:
|
||||
- community.general.consul
|
||||
- community.general.consul.token
|
||||
- community.general.consul.actiongroup_consul
|
||||
- community.general.attributes
|
||||
attributes:
|
||||
check_mode:
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
cKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbc
|
||||
mwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -32,7 +31,6 @@
|
|||
community.general.consul_auth_method:
|
||||
name: test
|
||||
max_token_ttl: 30m80s
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -45,7 +43,6 @@
|
|||
community.general.consul_auth_method:
|
||||
name: test
|
||||
max_token_ttl: 30m80s
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -58,7 +55,6 @@
|
|||
community.general.consul_auth_method:
|
||||
name: test
|
||||
state: absent
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -70,7 +66,6 @@
|
|||
community.general.consul_auth_method:
|
||||
name: test
|
||||
state: absent
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
cKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbc
|
||||
mwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
token: "{{ consul_management_token }}"
|
||||
|
||||
- name: Create a binding rule
|
||||
community.general.consul_binding_rule:
|
||||
name: test-binding
|
||||
description: my description
|
||||
auth_method: test
|
||||
token: "{{ consul_management_token }}"
|
||||
bind_type: service
|
||||
bind_name: yolo
|
||||
register: result
|
||||
|
@ -42,7 +40,6 @@
|
|||
community.general.consul_binding_rule:
|
||||
name: test-binding
|
||||
auth_method: test
|
||||
token: "{{ consul_management_token }}"
|
||||
bind_name: yolo2
|
||||
register: result
|
||||
|
||||
|
@ -56,7 +53,6 @@
|
|||
community.general.consul_binding_rule:
|
||||
name: test-binding
|
||||
auth_method: test
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -70,7 +66,6 @@
|
|||
name: test-binding
|
||||
auth_method: test
|
||||
state: absent
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
key "private/foo" {
|
||||
policy = "deny"
|
||||
}
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -35,7 +34,6 @@
|
|||
event "bbq" {
|
||||
policy = "write"
|
||||
}
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -56,7 +54,6 @@
|
|||
event "bbq" {
|
||||
policy = "write"
|
||||
}
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -67,7 +64,6 @@
|
|||
- name: Remove a policy
|
||||
consul_policy:
|
||||
name: foo-access
|
||||
token: "{{ consul_management_token }}"
|
||||
state: absent
|
||||
register: result
|
||||
- assert:
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
key "private/foo" {
|
||||
policy = "deny"
|
||||
}
|
||||
token: "{{ consul_management_token }}"
|
||||
register: policy_result
|
||||
|
||||
- name: Create another policy with rules
|
||||
|
@ -26,7 +25,6 @@
|
|||
key "private/bar" {
|
||||
policy = "deny"
|
||||
}
|
||||
token: "{{ consul_management_token }}"
|
||||
register: policy_result
|
||||
|
||||
- name: Create a role with policy
|
||||
|
@ -34,7 +32,6 @@
|
|||
name: foo-role-with-policy
|
||||
policies:
|
||||
- name: "foo-access-for-role"
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -47,7 +44,6 @@
|
|||
consul_role:
|
||||
name: foo-role-with-policy
|
||||
description: "Testing updating description"
|
||||
token: "{{ consul_management_token }}"
|
||||
check_mode: yes
|
||||
register: result
|
||||
|
||||
|
@ -62,7 +58,6 @@
|
|||
consul_role:
|
||||
name: foo-role-with-policy
|
||||
description: "Role for testing policies"
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -78,7 +73,6 @@
|
|||
policies:
|
||||
- name: "foo-access-for-role"
|
||||
- name: "bar-access-for-role"
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -91,7 +85,6 @@
|
|||
|
||||
- name: Create a role with service identity
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-service-identity
|
||||
service_identities:
|
||||
- name: web
|
||||
|
@ -107,7 +100,6 @@
|
|||
|
||||
- name: Update the role with service identity in check mode
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-service-identity
|
||||
service_identities:
|
||||
- name: web
|
||||
|
@ -124,7 +116,6 @@
|
|||
|
||||
- name: Update the role with service identity to add a policy, leaving the service id unchanged
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-service-identity
|
||||
policies:
|
||||
- name: "foo-access-for-role"
|
||||
|
@ -139,7 +130,6 @@
|
|||
|
||||
- name: Update the role with service identity to remove the policies
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-service-identity
|
||||
policies: []
|
||||
register: result
|
||||
|
@ -153,7 +143,6 @@
|
|||
|
||||
- name: Update the role with service identity to remove the node identities, in check mode
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-service-identity
|
||||
node_identities: []
|
||||
register: result
|
||||
|
@ -169,7 +158,6 @@
|
|||
|
||||
- name: Update the role with service identity to remove the service identities
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-service-identity
|
||||
service_identities: []
|
||||
register: result
|
||||
|
@ -182,7 +170,6 @@
|
|||
|
||||
- name: Create a role with node identity
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-node-identity
|
||||
node_identities:
|
||||
- name: node-1
|
||||
|
@ -197,7 +184,6 @@
|
|||
|
||||
- name: Remove the last role
|
||||
consul_role:
|
||||
token: "{{ consul_management_token }}"
|
||||
name: role-with-node-identity
|
||||
state: absent
|
||||
register: result
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
- name: list sessions
|
||||
consul_session:
|
||||
state: list
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -18,7 +17,6 @@
|
|||
consul_session:
|
||||
state: present
|
||||
name: testsession
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -33,7 +31,6 @@
|
|||
- name: list sessions after creation
|
||||
consul_session:
|
||||
state: list
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- set_fact:
|
||||
|
@ -61,7 +58,6 @@
|
|||
consul_session:
|
||||
state: info
|
||||
id: '{{ session_id }}'
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -72,7 +68,6 @@
|
|||
consul_session:
|
||||
state: info
|
||||
name: test
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
|
@ -84,7 +79,6 @@
|
|||
consul_session:
|
||||
state: absent
|
||||
id: '{{ session_id }}'
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -94,7 +88,6 @@
|
|||
- name: list sessions after deletion
|
||||
consul_session:
|
||||
state: list
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -121,7 +114,6 @@
|
|||
state: present
|
||||
name: session-with-ttl
|
||||
ttl: 180 # sec
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
key "foo" {
|
||||
policy = "read"
|
||||
}
|
||||
token: "{{ consul_management_token }}"
|
||||
loop:
|
||||
- foo-access
|
||||
- foo-access2
|
||||
|
@ -19,7 +18,6 @@
|
|||
community.general.consul_token:
|
||||
state: present
|
||||
accessor_id: 07a7de84-c9c7-448a-99cc-beaf682efd21
|
||||
token: "{{ consul_management_token }}"
|
||||
service_identities:
|
||||
- service_name: test
|
||||
datacenters: [test1, test2]
|
||||
|
@ -42,7 +40,6 @@
|
|||
community.general.consul_token:
|
||||
state: present
|
||||
accessor_id: 07a7de84-c9c7-448a-99cc-beaf682efd21
|
||||
token: "{{ consul_management_token }}"
|
||||
description: Testing
|
||||
policies:
|
||||
- id: "{{ create_result.token.Policies[-1].ID }}"
|
||||
|
@ -58,7 +55,6 @@
|
|||
community.general.consul_token:
|
||||
state: present
|
||||
accessor_id: 07a7de84-c9c7-448a-99cc-beaf682efd21
|
||||
token: "{{ consul_management_token }}"
|
||||
policies:
|
||||
- id: "{{ create_result.token.Policies[-1].ID }}"
|
||||
register: result
|
||||
|
@ -72,7 +68,6 @@
|
|||
community.general.consul_token:
|
||||
state: absent
|
||||
accessor_id: 07a7de84-c9c7-448a-99cc-beaf682efd21
|
||||
token: "{{ consul_management_token }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
|
|
@ -89,12 +89,18 @@
|
|||
- 3
|
||||
- import_tasks: consul_general.yml
|
||||
- import_tasks: consul_kv.yml
|
||||
|
||||
- block:
|
||||
- import_tasks: consul_session.yml
|
||||
- import_tasks: consul_policy.yml
|
||||
- import_tasks: consul_role.yml
|
||||
- import_tasks: consul_token.yml
|
||||
- import_tasks: consul_auth_method.yml
|
||||
- import_tasks: consul_binding_rule.yml
|
||||
module_defaults:
|
||||
group/community.general.consul:
|
||||
token: "{{ consul_management_token }}"
|
||||
|
||||
always:
|
||||
- name: Kill consul process
|
||||
shell: kill $(cat {{ remote_tmp_dir }}/consul.pid)
|
||||
|
|
Loading…
Reference in a new issue