2019-05-01 21:11:23 +00:00
|
|
|
---
|
2020-09-10 17:32:06 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: ACL Role Create'
|
2020-04-13 18:40:26 +00:00
|
|
|
sidebar_title: create
|
2019-05-01 21:11:23 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul ACL Role Create
|
|
|
|
|
|
|
|
Command: `consul acl role create`
|
|
|
|
|
|
|
|
The `acl role create` command creates new roles.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul acl role create [options] [args]`
|
|
|
|
|
|
|
|
#### API Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_client.mdx'
|
2020-04-07 23:56:08 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_server.mdx'
|
2019-05-01 21:11:23 +00:00
|
|
|
|
|
|
|
#### Command Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-description=<string>` - A description of the role.
|
2019-05-01 21:11:23 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-meta` - Indicates that role metadata such as the content hash and raft
|
|
|
|
indices should be shown for each entry.
|
2019-05-01 21:11:23 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-name=<string>` - The new role's name. This flag is required.
|
2019-05-01 21:11:23 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-policy-id=<value>` - ID of a policy to use for this role. May be specified
|
2019-05-01 21:11:23 +00:00
|
|
|
multiple times
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-policy-name=<value>` - Name of a policy to use for this role. May be
|
2019-05-01 21:11:23 +00:00
|
|
|
specified multiple times
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-service-identity=<value>` - Name of a service identity to use for this
|
2019-05-01 21:11:23 +00:00
|
|
|
role. May be specified multiple times. Format is the `SERVICENAME` or
|
|
|
|
`SERVICENAME:DATACENTER1,DATACENTER2,...`
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-format={pretty|json}` - Command output format. The default value is `pretty`.
|
2020-03-26 16:03:22 +00:00
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
#### Enterprise Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_namespace_options.mdx'
|
2019-12-06 16:14:56 +00:00
|
|
|
|
2019-05-01 21:11:23 +00:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
Create a new role with one policy:
|
|
|
|
|
2020-09-10 17:32:06 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl role create -name "crawler" -description "web crawler role" -policy-name "crawler-kv"
|
|
|
|
ID: 57147d87-6bf7-f794-1a6e-7d038c4e4ae9
|
|
|
|
Name: crawler
|
|
|
|
Description: web crawler role
|
|
|
|
Policies:
|
|
|
|
2f8f99c7-edd9-2f09-7e4b-a1f519eb4fc2 - crawler-kv
|
|
|
|
```
|
|
|
|
|
|
|
|
Create a new role with one service identity:
|
|
|
|
|
2020-09-10 17:32:06 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl role create -name archiver -description 'archiver role' -service-identity "archiver:dc2"
|
|
|
|
ID: a365fdc9-ac71-e754-0645-7ab6bd747301
|
|
|
|
Name: archiver
|
|
|
|
Description: archiver role
|
|
|
|
Service Identities:
|
|
|
|
archiver (Datacenters: dc2)
|
|
|
|
```
|