consul_policy
Create, update or remove Consul ACL policies
Collection: community.general
Full Name: community.general.consul_policy
Synopsis
Create, update or remove Consul ACL policies
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| ca_path | string | Target PEM CA bundle path. | ||
| description | string | Description of the policy. | ||
| host | string | localhost | Consul agent hostname. | |
| name | string | yes | The name that should be associated with the policy, this is opaque to Consul. | |
| port | int | 8500 | Consul agent HTTP port. | |
| rules | string | Rule document that should be associated with the current policy. | ||
| scheme | string | http | HTTP or HTTPS protocol. | |
| state | string | present | Whether the policy should be present or absent. | |
| token | string | Consul ACL token; private argument. | ||
| valid_datacenters | list | Valid datacenters for the policy. All if list is empty. | ||
| validate_certs | bool | true | Validate the server certificate. |
Example
yaml
- community.general.consul_policy:
host: consul1.example.com
name: foo-access
rules: |
key "foo" {
policy = "read"
}
key "private/foo" {
policy = "deny"
}
token: some_management_acl
name: Create a policy with rules
- community.general.consul_policy:
host: consul1.example.com
name: foo-access
rules: |
key "foo" {
policy = "read"
}
key "private/foo" {
policy = "deny"
}
event "bbq" {
policy = "write"
}
token: some_management_acl
name: Update the rules associated to a policy
- community.general.consul_policy:
host: consul1.example.com
name: foo-access
state: absent
token: some_management_acl
name: Remove a policy