Skip to navigation

iagctl db export

Export resources and services to a file.

The iagctl db export command exports services and resources to a file. Use this command to move services and resources from one gateway instance to another.

The export includes encrypted secrets and users, in addition to services and resources. Consider this before you commit an export file to source control.

Syntax

iagctl db export [flags]

Examples

Export to the terminal

The following example exports all services and resources and displays the output in the terminal:

iagctl db export

Export in a specific format

Use the -f flag to switch between JSON and YAML output. YAML is the default format:

iagctl db export -f json

Export to a file

Use the --file flag to save the output to a file:

iagctl db export --file ./services.yaml

Service file format

The following example shows the structure of an exported service file:

decorators:
- name: ansible-xr
schema:
$id: https://example.com/device.schema.json
$schema: https://json-schema.org/draft/2020-12/schema
properties:
device_type:
description: The type of device
enum:
- ios
- eos
- nxos
type: string
host:
description: The hostname or IP address of the device
type: string
title: Network Device
type: object
repositories:
- name: xr-resources
description: XR Resources for testing
url: git@gitlab.com:jh/xr/resources.git
reference: main
tags:
- cisco
- xr
private-key-name: xr-gitlab-private
- name: xr-https-resources
description: XR resources over HTTPS
url: https://gitlab.com/<org>/xr/resources.git
reference: main
username: gitlab-user
password-name: xr-gitlab-token
services:
- name: Ansible-Example
type: ansible-playbook
description: An ansible playbook to say hello-world
playbooks:
- hello-world.yml
working-directory: ./
repository: xr-resources
decorator: ansible-xr
tags:
- xr
- cisco
runtime:
check: true
diff: true
skip-tags: example-tag
inventory:
- ./inventory.ini
verbose-level: 6
- name: Hello-World
type: python-script
description: A simple hello-world script
filename: hello-world.py
working-directory: python-scripts
repository: xr-resources
decorator: my-special-decorator
secrets:
- name: my-secret
type: env
target: MY_SECRET

Options

--file string File path to save the exported service configuration.
-f, --format string Output format for the export: json or yaml. (default "yaml")
-h, --help Help for export

Options inherited from parent commands

--profile string Specify the client profile to use (case-insensitive, defaults to [client] section)
--config string Path to the configuration file
--raw Display the result of the command in raw format
--verbose Enable verbose output