Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

zarf_package_deploy

Deploy a zarf package onto an initialised cluster.

Write it as colonel_byte.zarf.zarf_package_deploy. It runs zarf on the node the task is delegated to; nothing is installed on the cluster’s nodes.

Added in colonel_byte.zarf 0.0.1.

Runs zarf package deploy against the cluster a kubeconfig names, and follows the deployment component by component.

The module is a compiled binary with zarf linked into it. It renders the zarf package deploy command line from these parameters, executes zarf’s own command in its own process, reads the component boundaries back out of zarf’s log stream, and reports one JSON result. It needs no zarf on the node.

It is the companion of colonel_byte.zarf.zarf_init. A cluster whose init package has no StorageClass to claim cannot finish initialising until a storage provider is deployed, and the provider cannot be deployed until the cluster is initialised far enough to hold it, so a playbook alternates between the two.

Parameters

ParameterTypeRequiredFlagDescription
packagestryesNoneThe package to deploy: a path to a tarball, an oci:// reference, or an https:// URL. A relative path is resolved against the working directory the module was invoked from unless directory names one, because that directory belongs to Ansible rather than to the operator. The positional argument of the command, so it renders no flag.
directorystrnoNoneThe working directory to run zarf in. A relative package is resolved against it.
kubeconfigstrnoNoneThe kubeconfig of the cluster to deploy onto. Zarf has no --kubeconfig flag, so it is passed as KUBECONFIG in zarf’s environment.
zarf_configstrnoNoneA zarf config file, passed as ZARF_CONFIG. It is how a playbook keeps credentials out of the argument vector.
wrapper_binarystrnoNoneThe module wrapper to run, resolved on the path when it holds no separator. The action plugin consumes this parameter; the wrapper never sees it.
status_filestrnoNoneWhere the wrapper writes live component progress. The action plugin creates a private temporary file and overrides this.
parametersdictnoNoneFurther module parameters, merged into the ones given directly. A parameter given both directly and inside parameters is an error naming it. The action plugin consumes this key; the wrapper never sees it.
componentsstrno--componentsWhich components to deploy, as a comma-separated list. It is also what lets the progress display report component 2/4 rather than component 2: the wrapper cannot otherwise know how many components the package holds.
namespacestrno--namespaceDeploy into this namespace instead of the one the package names. Alpha in zarf.
shasumstrno--shasumThe SHA256 checksum of a package fetched over https://.
connectedboolno--connectedWhether to deploy without pushing the package’s images and repositories, for a cluster that can already reach them.
take_ownershipboolno--take-ownershipWhether zarf adopts Kubernetes resources that already exist.
force_conflictsboolno--force-conflictsWhether zarf forces Helm ownership during server-side apply.
skip_values_schema_validationboolno--skip-values-schema-validationWhether zarf skips validating values files against their schema.
insecure_skip_tls_verifyboolno--insecure-skip-tls-verifyWhether zarf skips verifying TLS certificates it connects to.
plain_httpboolno--plain-httpWhether zarf talks to OCI registries over plain HTTP.
retriesintno--retriesHow many times zarf retries a failed operation.
oci_concurrencyintno--oci-concurrencyHow many OCI operations zarf runs at once.
architecturestrno--architectureThe architecture of the package being deployed.
cachestrno--cacheZarf’s cache directory.
tmpdirstrno--tmpdirThe directory zarf unpacks the package into.
timeoutstrno--timeoutHow long zarf waits for a Helm operation or health check, as a Go duration such as 15m.
public_keystrno--keyThe public key the package signature is verified against.
verifystrno--verifyWhen to verify the package signature. One of never, if-possible, always.
valueslist of strno--valuesValues files to apply, one flag per entry.
set_valuesdictno--set-valuesValues to set, as a mapping. Rendered one flag per entry, sorted, so the same parameters always render the same command line.
set_variablesdictno--set-variablesZarf variables to set, as a mapping.
log_levelstrno--log-levelZarf’s log level.
log_formatstrno--log-formatZarf’s log format. Defaults to json, which is the format the component progress is read out of.

Notes

  • Set run_once: true and delegate_to on the task. One deploy puts the package on the whole cluster, so a play over the cluster’s own inventory would otherwise deploy it once per host.
  • Set no_log: true on the task when any parameter carries a credential. A binary module has no per-parameter no_log.
  • Check mode reports the task as skipped. zarf package deploy has no dry run, so there is nothing honest to report instead.
  • A parameter left unset renders no flag, so whatever zarf’s own config file sets still applies.
  • The zarf that does the work is the one linked into the module, and its version is reported as zarf.version, so a failed run says which zarf produced it. There is no installed version to be too old.

Example

- name: Deploy a storage provider so the registry has a StorageClass to claim
  colonel_byte.zarf.zarf_package_deploy:
    package: oci://ghcr.io/colonel-byte/zarf/csi-local-path-provider:0.0.37-upstream
    components: local-path-images,local-path-chart
    kubeconfig: /etc/rancher/rke2/rke2.yaml
    public_key: /etc/zarf/colonel-byte-zarf-packages.pub
    verify: always
  delegate_to: localhost
  run_once: true

- name: Deploy a staged package
  colonel_byte.zarf.zarf_package_deploy:
    package: /srv/staging/zarf-package-monitoring-amd64.tar.zst
    kubeconfig: /etc/rancher/rke2/rke2.yaml
    set_variables:
      DOMAIN: bubbles.test
  delegate_to: localhost
  run_once: true
  no_log: true
  register: deploy_result

- name: Report which components the package deployed
  ansible.builtin.debug:
    var: deploy_result.zarf.componentsRan