finalized content for creating templates

pull/746/head
Scott Anderson 2020-02-07 09:08:00 -07:00
parent 146acb48be
commit 985042806e
1 changed files with 58 additions and 14 deletions

View File

@ -17,9 +17,10 @@ Add buckets, Telegraf configurations, tasks, and more in the InfluxDB UI and exp
them as a template.
{{% note %}}
The simplest way to create a new template is to create a new organization and build
The simplest way to create a template is to create a new organization and build
the template within the organization.
**InfluxDB OSS** supports multiple organizations. In **InfluxDB Cloud**, your user account is an organization.
**InfluxDB OSS** supports multiple organizations.
In **InfluxDB Cloud**, your user account is an organization.
**We recommend using InfluxDB OSS to create Influx templates.**
{{% /note %}}
@ -27,7 +28,7 @@ the template within the organization.
1. [Start InfluxDB](/v2.0/get-started/).
2. [Create a new organization](/v2.0/organizations/create-org/).
3. In the InfluxDB UI, add all the resources to include in the template.
3. Use the InfluxDB UI to add resources to your template.
The following resources are templatable:
- [buckets](/v2.0/organizations/buckets/create-bucket/)
@ -40,22 +41,65 @@ the template within the organization.
- [tasks](/v2.0/process-data/manage-tasks/create-task/)
- [Telegraf configurations](/v2.0/write-data/use-telegraf/)
4. [Export the template](#export-a-template).
4. Export the template _(see [below](#export-a-template))_.
## Export a template
There are two methods for exporting a template.
### Export all
1. Export all resources in an organization _(recommended)_
2. Export specific resources in an organization
Then you can just `influx pkg export all -o <org-name>`
### Export all resources
Use the `influx pkg export all` command to export all templatable resources
into a new template manifest.
Provide the following:
- **Organization name** or **ID**
- **Authentication token** with read access to the organization
- **Destination file** path for the template manifest.
The extension of the destination file determines the output format of the manifest file.
Export template manifests in either YAML (`.yml` or `.yaml`) or JSON (`.json`).
###### Export all resources to a template manifest
```sh
# Syntax
influx pkg export all -o <org-name> -f <filepath> -t <token>
# Example
influx pkg export all \
-o my-org \
-f ~/templates/awesome-template.yml \
-t $INFLUX_TOKEN
```
For information about other options and flags, see the
[`influx pkg export all` documentation](/v2.0/reference/cli/influx/pkg/export/all/).
### Export specific resources
Use the `influx pkg export` with resource flagss to export all specific templatable
resources into a new template manifest.
Provide the following:
- **Organization name** or **ID**
- **Authentication token** with read access to the organization
- **Destination file** path for the template manifest.
The extension of the file determines the output format of the manifest file.
Influx templates support YAML, JSON, and Jsonnet.
- **Resource flags** with corresponding lists of resource IDs to include in the template.
For information about what resource flags are available, see the
[`influx pkg export` documentation](/v2.0/reference/cli/influx/pkg/export/).
## Placeholder outline
- Create a template
- `influx pkg`
- Package everything vs package specific things
- Include secrets (only keys are included, uses will still need to populate the secret)
- Submit a template to the InfluxDB community template repo
- View your package summary
- Validate a package
###### Export specific resources to a template manifest
```sh
# Syntax
influx pkg export all -o <org-name> -f <filepath> -t <token> [resource-flags]
# Example
influx pkg export all \
-o my-org \
-f ~/templates/awesome-template.yml \
-t $INFLUX_TOKEN \
--buckets=00x000ooo0xx0xx,o0xx0xx00x000oo \
--dashboards=00000xX0x0X00x000 \
--telegraf-configs=00000x0x000X0x0X0
```