update template task docs with new cli structure, resolves #1087

pull/1091/head
Scott Anderson 2020-06-08 21:38:14 -06:00
parent 1c54c1d25d
commit 88d365095d
4 changed files with 110 additions and 105 deletions

View File

@ -0,0 +1,30 @@
---
title: InfluxDB templates in InfluxDB Cloud
list_title: InfluxDB templates in Cloud
description: >
Download and use the `influx` CLI to apply and manage InfluxDB templates with
your InfluxDB Cloud account.
menu:
v2_0:
parent: InfluxDB templates
name: Templates in Cloud
weight: 101
aliases:
- /v2.0/influxdb-templates/get_started_cloud/
v2.0/tags: [templates]
products: [cloud]
---
If using InfluxDB Cloud, download and use the [`influx` command line interface (CLI)](/v2.0/reference/cli/influx/)
to apply and manage templates in your InfluxDB Cloud account.
InfluxDB OSS 2.0 includes the InfluxDB CLI (`influx`). If you havent already, do the following:
1. [Download and install InfluxDB 2.0 OSS](/v2.0/get-started/#start-with-influxdb-oss).
2. [Configure the `influx` CLI](/v2.0/get-started/#set-up-influxdb) to use your
InfluxDB Cloud instance URL, organization, and tokens.
3. [Use the `influx` CLI](/v2.0/reference/cli/influx/) to use, manage, and create
InfluxDB templates:
- [Use templates](/v2.0/influxdb-templates/use/)
- [Create templates](/v2.0/influxdb-templates/create/)

View File

@ -1,7 +1,7 @@
---
title: Create an InfluxDB template
description: >
Use the InfluxDB UI and the `influx pkg export` command to create InfluxDB templates.
Use the InfluxDB UI and the `influx export` command to create InfluxDB templates.
menu:
v2_0:
parent: InfluxDB templates
@ -10,11 +10,11 @@ menu:
weight: 103
v2.0/tags: [templates]
related:
- /v2.0/reference/cli/influx/pkg/export/
- /v2.0/reference/cli/influx/pkg/export/all/
- /v2.0/reference/cli/influx/export/
- /v2.0/reference/cli/influx/export/all/
---
Use the InfluxDB user interface (UI) and the `influx pkg export` command to
Use the InfluxDB user interface (UI) and the `influx export` command to
create InfluxDB templates.
Add resources (buckets, Telegraf configurations, tasks, and more) in the InfluxDB
UI and export the resources as a template.
@ -61,7 +61,7 @@ Do one of the following to export a template:
### Export all resources
To export all templatable resources within an organization to a template manifest,
use the `influx pkg export all` command.
use the `influx export all` command.
Provide the following:
- **Organization name** or **ID**
@ -73,17 +73,17 @@ Provide the following:
###### Export all resources to a template
```sh
# Syntax
influx pkg export all -o <org-name> -f <file-path> -t <token>
influx export all -o <org-name> -f <file-path> -t <token>
# Example
influx pkg export all \
influx export all \
-o my-org \
-f ~/templates/awesome-template.yml \
-t $INFLUX_TOKEN
```
#### Export resources filtered by labelName or resourceKind
The `influx pkg export all` command has an optional `--filter` flag that exports
The `influx export all` command has an optional `--filter` flag that exports
only resources that match specified label names or resource kinds.
Provide multiple filters for both `labelName` and `resourceKind`
@ -97,7 +97,7 @@ and
```
```sh
influx pkg export all \
influx export all \
-o my-org \
-f ~/templates/awesome-template.yml \
-t $INFLUX_TOKEN \
@ -107,15 +107,12 @@ influx pkg export all \
--filter=labelName=Example2
```
For information about flags, see the
[`influx pkg export all` documentation](/v2.0/reference/cli/influx/pkg/export/all/).
[`influx export all` documentation](/v2.0/reference/cli/influx/export/all/).
### Export specific resources
To export specific resources within an organization to a template manifest,
use the `influx pkg export` with resource flags for each resource to include.
use the `influx export` with resource flags for each resource to include.
Provide the following:
- **Organization name** or **ID**
@ -125,15 +122,15 @@ Provide the following:
**JSON** (`.json`) are supported.
- **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/).
[`influx export` documentation](/v2.0/reference/cli/influx/export/).
###### Export specific resources to a template
```sh
# Syntax
influx pkg export all -o <org-name> -f <file-path> -t <token> [resource-flags]
influx export all -o <org-name> -f <file-path> -t <token> [resource-flags]
# Example
influx pkg export all \
influx export all \
-o my-org \
-f ~/templates/awesome-template.yml \
-t $INFLUX_TOKEN \
@ -193,13 +190,13 @@ metadata:
{{< /code-tabs-wrapper >}}
Using the example above, users are prompted to provide a value for `bucket-name-1`
when [installing the template](/v2.0/influxdb-templates/use/#install-templates).
when [applying the template](/v2.0/influxdb-templates/use/#apply-templates).
Users can also include the `--env-ref` flag with the appropriate key-value pair
when installing the template.
```sh
# Set bucket-name-1 to "myBucket"
influx pkg \
influx apply \
-f /path/to/template.yml \
--env-ref=bucket-name-1=myBucket
```
@ -211,7 +208,9 @@ exist in the template and what keys to use to replace them._
#### Resource fields that support environment references
Only the following fields support environment references:
- `metadata.name`
- `spec.endpointName`
- `spec.associations.name`
{{% /note %}}
## Share your InfluxDB templates

View File

@ -1,26 +0,0 @@
---
title: Get started with InfluxDB templates
description: >
To get started with InfluxDB templates, you need to download the InfluxDB CLI.
menu:
v2_0:
parent: InfluxDB templates
name: Get started with templates in Cloud
identifier: Templates requires CLI
weight: 101
v2.0/tags: [templates]
products: [cloud]
---
If you're an InfluxDB Cloud user, you'll need the InfluxDB CLI (`influx`) to run `pkg` commands against your Cloud account.
InfluxDB OSS 2.0 includes the InfluxDB CLI (`influx`). If you havent already, do the following:
- [Install OSS 2.0](/v2.0/get-started/#start-with-influxdb-oss).
- [Set up and use InfluxDB CLI](/v2.0/reference/cli/influx/) with the appropriate InfluxDB Cloud instance URL, organization, and tokens associated with your account.
Next, discover how to use `influx` and `pkg` to do the following:
- [Use templates](/v2.0/influxdb-templates/use/)
- [Create templates](/v2.0/influxdb-templates/create/)

View File

@ -1,8 +1,8 @@
---
title: Use InfluxDB templates
description: >
Use the `influx pkg` command to view and install templates from your local
filesystem or from URLs.
Use the `influx` command line interface (CLI) to summarize, validate, and apply
templates from your local filesystem and from URLs.
menu:
v2_0:
parent: InfluxDB templates
@ -10,23 +10,25 @@ menu:
weight: 102
v2.0/tags: [templates]
related:
- /v2.0/reference/cli/influx/pkg/
- /v2.0/reference/cli/influx/apply/
- /v2.0/reference/cli/influx/template/
- /v2.0/reference/cli/influx/template/validate/
---
Use the `influx pkg` command to summarize, validate, and install templates from
your local filesystem and from URLs.
Use the `influx` command line interface (CLI) to summarize, validate, and apply
templates from your local filesystem and from URLs.
- [Use InfluxDB community templates](#use-influxdb-community-templates)
- [View a template summary](#view-a-template-summary)
- [Validate a template](#validate-a-template)
- [Install templates](#install-templates)
- [Apply templates](#apply-templates)
## Use InfluxDB community templates
The [InfluxDB community templates repository](https://github.com/influxdata/community-templates/)
is home to a growing number of InfluxDB templates developed and maintained by
others in the InfluxData community.
Install community templates directly from GitHub using a template's download URL
Apply community templates directly from GitHub using a template's download URL
or download the template.
{{% note %}}
@ -47,8 +49,8 @@ https://raw.githubusercontent.com/influxdata/community-templates/master/docker/d
<a class="btn" href="https://github.com/influxdata/community-templates/" target="\_blank">View InfluxDB Community Templates</a>
## View a template summary
To view a summary of what's included in a template before installing the template,
use the [`influx pkg summary` command](/v2.0/reference/cli/influx/pkg/summary/).
To view a summary of what's included in a template before applying the template,
use the [`influx template` command](/v2.0/reference/cli/influx/template/).
View a summary of a template stored in your local filesystem or from a URL.
{{% code-tabs-wrapper %}}
@ -59,26 +61,26 @@ View a summary of a template stored in your local filesystem or from a URL.
{{% code-tab-content %}}
```sh
# Syntax
influx pkg summary -f <template-file-path>
influx template -f <template-file-path>
# Example
influx pkg summary -f /path/to/template.yml
influx template -f /path/to/template.yml
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
```sh
# Syntax
influx pkg summary -u <template-url>
influx template -u <template-url>
# Example
influx pkg summary -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
influx template -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
```
{{% /code-tab-content %}}
{{% /code-tabs-wrapper %}}
## Validate a template
To validate a template before you install it or troubleshoot a template, use
the [`influx pkg validate` command](/v2.0/reference/cli/influx/pkg/validate/).
the [`influx template validate` command](/v2.0/reference/cli/influx/template/validate/).
Validate a template stored in your local filesystem or from a URL.
{{% code-tabs-wrapper %}}
@ -89,99 +91,99 @@ Validate a template stored in your local filesystem or from a URL.
{{% code-tab-content %}}
```sh
# Syntax
influx pkg validate -f <template-file-path>
influx template validate -f <template-file-path>
# Example
influx pkg validate -f /path/to/template.yml
influx template validate -f /path/to/template.yml
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
```sh
# Syntax
influx pkg validate -u <template-url>
influx template validate -u <template-url>
# Example
influx pkg validate -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
influx template validate -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
```
{{% /code-tab-content %}}
{{% /code-tabs-wrapper %}}
## Install templates
Use the [`influx pkg` command](/v2.0/reference/cli/influx/pkg/) to install templates
## Apply templates
Use the [`influx apply` command](/v2.0/reference/cli/influx/apply/) to install templates
from your local filesystem or from URLs.
- [Install a template from a file](#install-a-template-from-a-file)
- [Install all templates in a directory](#install-all-templates-in-a-directory)
- [Install a template from a URL](#install-a-template-from-a-url)
- [Install templates from both files and URLs](#install-templates-from-both-files-and-urls)
- [Apply a template from a file](#apply-a-template-from-a-file)
- [Apply all templates in a directory](#apply-all-templates-in-a-directory)
- [Apply a template from a URL](#apply-a-template-from-a-url)
- [Apply templates from both files and URLs](#apply-templates-from-both-files-and-urls)
- [Define environment references](#define-environment-references)
- [Include a secret when installing a template](#include-a-secret-when-installing-a-template)
### Install a template from a file
### Apply a template from a file
To install templates stored on your local machine, use the `-f` or `--file` flag
to provide the **file path** of the template manifest.
```sh
# Syntax
influx pkg -o <org-name> -f <template-file-path>
influx apply -o <org-name> -f <template-file-path>
# Examples
# Install a single template
influx pkg -o example-org -f /path/to/template.yml
# Apply a single template
influx apply -o example-org -f /path/to/template.yml
# Install multiple templates
influx pkg -o example-org \
# Apply multiple templates
influx apply -o example-org \
-f /path/to/this/template.yml \
-f /path/to/that/template.yml
```
### Install all templates in a directory
To install all templates in a directory, use the `-f` or `--file` flag to provide
### Apply all templates in a directory
To apply all templates in a directory, use the `-f` or `--file` flag to provide
the **directory path** of the directory where template manifests are stored.
By default, this only installs templates stored in the specified directory.
To install all templates stored in the specified directory and its subdirectories,
include the `--recurse` flag.
By default, this only applies templates stored in the specified directory.
To apply all templates stored in the specified directory and its subdirectories,
include the `-R`, `--recurse` flag.
```sh
# Syntax
influx pkg -o <org-name> -f <template-directory-path>
influx apply -o <org-name> -f <template-directory-path>
# Examples
# Install all templates in a directory
influx pkg -o example-org -f /path/to/template/dir/
# Apply all templates in a directory
influx apply -o example-org -f /path/to/template/dir/
# Install all templates in a directory and its subdirectories
influx pkg -o example-org -f /path/to/template/dir/ --recurse
# Apply all templates in a directory and its subdirectories
influx apply -o example-org -f /path/to/template/dir/ -R
```
### Install a template from a URL
To install templates from a URL, use the `-u` or `--url` flag to provide the URL
### Apply a template from a URL
To apply templates from a URL, use the `-u` or `--template-url` flag to provide the URL
of the template manifest.
```sh
# Syntax
influx pkg -o <org-name> -u <template-url>
influx apply -o <org-name> -u <template-url>
# Examples
# Install a single template from a URL
influx pkg -o example-org -u https://example.com/templates/template.yml
# Apply a single template from a URL
influx apply -o example-org -u https://example.com/templates/template.yml
# Install multiple templates from URLs
influx pkg -o example-org \
# Apply multiple templates from URLs
influx apply -o example-org \
-u https://example.com/templates/template1.yml \
-u https://example.com/templates/template2.yml
```
### Install templates from both files and URLs
To install templates from both files and URLs in a single command, include multiple
### Apply templates from both files and URLs
To apply templates from both files and URLs in a single command, include multiple
file or directory paths and URLs, each with the appropriate `-f` or `-u` flag.
```sh
# Syntax
influx pkg -o <org-name> -u <template-url> -f <template-path>
influx apply -o <org-name> -u <template-url> -f <template-path>
# Example
influx pkg -o example-org \
influx apply -o example-org \
-u https://example.com/templates/template1.yml \
-u https://example.com/templates/template2.yml \
-f ~/templates/custom-template.yml \
@ -191,14 +193,14 @@ influx pkg -o example-org \
### Define environment references
Some templates include [environment references](/v2.0/influxdb-templates/create/#include-user-definable-resource-names) that let you provide custom resource names.
The `influx pkg` command prompts you to provide a value for each environment
The `influx apply` command prompts you to provide a value for each environment
reference in the template.
You can also provide values for environment references by including an `--env-ref`
flag with a key-value pair comprised of the environment reference key and the
value to replace it.
```sh
influx pkg -o example-org -f /path/to/template.yml \
influx apply -o example-org -f /path/to/template.yml \
--env-ref=bucket-name-1=myBucket
--env-ref=label-name-1=Label1 \
--env-ref=label-name-2=Label2
@ -212,18 +214,18 @@ with the secret key-value pair.
```sh
# Syntax
influx pkg -o <org-name> -f <template-file-path> \
influx apply -o <org-name> -f <template-file-path> \
--secret=<secret-key>=<secret-value>
# Examples
# Define a single secret when installing a template
influx pkg -o example-org -f /path/to/template.yml \
# Define a single secret when applying a template
influx apply -o example-org -f /path/to/template.yml \
--secret=FOO=BAR
# Define multiple secrets when installing a template
influx pkg -o example-org -f /path/to/template.yml \
# Define multiple secrets when applying a template
influx apply -o example-org -f /path/to/template.yml \
--secret=FOO=bar \
--secret=BAZ=quz
```
_To add a secret after installing a template, see [Add secrets](/v2.0/security/secrets/manage-secrets/add/)._
_To add a secret after applying a template, see [Add secrets](/v2.0/security/secrets/manage-secrets/add/)._