MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Chef Tutorials: chef-automate commands line reference

chef-automate is the single command-line tool used to install, configure, back up, upgrade and troubleshoot Chef Automate. Below is the full list of its subcommands, followed by the ones you will use most often, grouped by task, with runnable examples and fixes for common errors.

Usage:
chef-automate [command]


Available Commands:
  airgap
  applications               Manage applications observability features
  backup                     Chef Automate backup
  config                     Chef Automate configuration
  deploy                     Deploy Chef Automate
  external-cert              Manage Chef Automate's external certificate
  gather-logs                Gather system diagnostics and logs
  help                       Help about any command
  iam                        Chef Automate iam commands
  info                       Info about Automate HA
  infrastructure             Chef Automate infrastructure
  init-config                Initialize default config
  init-config-ha             Initialize default config for Automate HA
  internal-ca                Manage Chef Automate's internal certificate authority
  license                    Chef Automate license management
  maintenance                Put Chef Automate into or out of maintenance mode
  migrate-from-v1            Migrate from Chef Automate v1
  migrate-from-v1-status     Watch the status of the migration to Chef Automate 2
  preflight-check            Perform preflight check
  provision-infra            Provision Automate HA infra.
  restart-services           restart deployment services
  secrets                    Set secrets to Automate HA
  service-versions           Retrieve the versions of the individual Chef Automate services
  ssh                        SSH into Automate HA servers
  start                      Start Chef Automate
  status                     Retrieve Chef Automate status
  stop                       Stop deployment
  system-logs                Tail Chef Automate logs
  test                       Run Automate HA smoke tests
  uninstall                  Uninstall Chef Automate
  upgrade                    upgrade automate to the latest version
  version                    Show CLI version
  workspace                  Set workspace env for Automate HA.
Code language: PHP (php)

What the chef-automate CLI manages

The listing above contains two kinds of commands. Most of them manage a standalone Chef Automate server. The rest, such as init-config-ha, provision-infra, info, ssh, test, secrets and workspace, only apply to Automate HA, where they run from a bastion host and manage a cluster of frontend and backend nodes. The exact list depends on the CLI version you have, so chef-automate --help is the authoritative reference on your own system.

TaskCommands
Install and removeinit-config, preflight-check, deploy, uninstall
Check healthstatus, service-versions, version
Configureconfig show, config patch, config set
Licensing and accesslicense, iam
Data protectionbackup
Lifecyclestart, stop, restart-services, maintenance, upgrade, airgap
Troubleshootingsystem-logs, gather-logs
Certificates and nodesexternal-cert, internal-ca, infrastructure, applications
Legacymigrate-from-v1, migrate-from-v1-status (Automate 1 is end-of-life)

Note: Any command will print its own subcommands and flags if you add --help, for example chef-automate backup --help. The global --debug flag adds verbose output, which helps when a command fails without a clear message.

Download the CLI and deploy a standalone server

Chef Automate runs on a 64-bit Linux host with systemd. Run the commands as root or with sudo. Before you deploy, the preflight check makes sure the kernel settings and ports are correct.

# Download the CLI
curl https://packages.chef.io/files/current/latest/chef-automate-cli/chef-automate_linux_amd64.zip \
  | gunzip - > chef-automate && chmod +x chef-automate

# Kernel settings the preflight check requires
sudo sysctl -w vm.max_map_count=262144
sudo sysctl -w vm.dirty_expire_centisecs=20000

# Check the host, then generate config.toml
sudo ./chef-automate preflight-check
sudo ./chef-automate init-config

# Deploy Automate (add --product infra-server to also install Chef Infra Server)
sudo ./chef-automate deploy config.toml --accept-terms-and-mlsaCode language: PHP (php)

init-config writes a config.toml that includes the FQDN, the TLS certificate settings and the deployment channel. Edit the fqdn before deploying if the host name is not the one users will browse to. When the deployment finishes, the admin username and password are stored in automate-credentials.toml in the current directory. Deploy also installs the CLI to /bin/chef-automate, so later commands no longer need ./.

Note: sysctl -w changes are lost on reboot. To keep them, add vm.max_map_count=262144 and vm.dirty_expire_centisecs=20000 to /etc/sysctl.conf or a file in /etc/sysctl.d/, then run sudo sysctl -p.

Check status and change configuration

chef-automate status            # health of every internal service
chef-automate service-versions  # package version of each service
chef-automate version           # CLI and server versions

chef-automate license apply <LICENSE_STRING_OR_FILE>
chef-automate license statusCode language: PHP (php)

config show prints the current configuration. To change it, the safest command is config patch, which merges only the keys you supply. config set replaces the entire user configuration with the file you pass, so any setting left out of that file goes back to its default.

# patch.toml
[global.v1]
  fqdn = "automate.example.com"Code language: PHP (php)
chef-automate config show > current-config.toml   # keep a copy first
sudo chef-automate config patch patch.toml
chef-automate statusCode language: CSS (css)

Back up and restore

By default, backups go to /var/opt/chef-automate/backups. You can also set a filesystem or S3 location under [global.v1.backups] in the configuration. Each backup gets a timestamp ID.

sudo chef-automate backup create          # prints the new backup ID
chef-automate backup list
chef-automate backup show <BACKUP_ID>
sudo chef-automate backup restore <BACKUP_ID>
sudo chef-automate backup delete <BACKUP_ID>Code language: HTML, XML (xml)

Restoring onto a new host needs the CLI and access to the backup directory or bucket. It also needs the /hab/svc/deployment-service/data/shared.tar bootstrap file from the original server, which holds secrets that are not stored in the backup itself. For a full walkthrough, including Chef Infra Server data, see Chef Infra Server & Chef Automate Backup and Restore.

Create API tokens and recover admin access

The iam command manages identity and access. The most common use is creating a token for knife, the data collector or a CI pipeline. Recovery is the other: if the built-in admin user is locked out, admin-access restore resets its password and policy membership.

# Token with full admin rights; the value is printed once, so store it securely
chef-automate iam token create ci-pipeline --admin

# Restore the default admin user and set a new password
sudo chef-automate iam admin-access restore 'NewStrongPassword!'Code language: PHP (php)

Note: Only use --admin tokens where you really need full access. For data collection or read-only dashboards, create a token without --admin and add it to a narrow IAM policy in the Automate UI.

Upgrades, maintenance mode and air-gapped installs

Automate can upgrade itself from its release channel. If you want to control when upgrades happen, set upgrade_strategy = "none" in config.toml and run upgrades by hand during a maintenance window. Maintenance mode makes the server return HTTP 503 to clients, so no data is written during the change.

sudo chef-automate backup create
sudo chef-automate maintenance on
sudo chef-automate upgrade run
chef-automate upgrade status
sudo chef-automate maintenance off

The listing above shows airgap without a description. Use it to build an offline installation bundle (.aib) on a machine that has internet access, copy the bundle to the isolated host, and deploy or upgrade from it there.

# On an internet-connected machine
./chef-automate airgap bundle create

# On the air-gapped host
sudo ./chef-automate deploy config.toml --airgap-bundle <BUNDLE>.aib --accept-terms-and-mlsa
sudo chef-automate upgrade run --airgap-bundle <NEW_BUNDLE>.aibCode language: PHP (php)

Troubleshooting and common errors

chef-automate system-logs          # follow the Automate service journal
sudo chef-automate gather-logs     # build a diagnostics tarball for support
sudo chef-automate restart-servicesCode language: PHP (php)
SymptomLikely causeFix
Preflight fails on vm.max_map_count or vm.dirty_expire_centisecsKernel defaults are too low for the embedded search engineSet them with sysctl -w and make them permanent in /etc/sysctl.d/
Preflight reports a port in useAnother web server is listening on 443 or 80Stop or move that service, then rerun preflight-check
Permission or "must run as root" errorsThe command was run as a normal userPrefix the command with sudo
status shows a service as unhealthy after a changeBad config value or not enough memory or diskRead system-logs, revert with config set current-config.toml, check free RAM and disk
Browser certificate warningDefault self-signed certificateAdd your own certificate and key under [[global.v1.frontend_tls]] and apply with config patch

Automate HA commands at a glance

In an Automate HA deployment, you run the CLI on a bastion host. A typical flow is: init-config-ha generates the HA config (for AWS or existing infrastructure), then provision-infra creates cloud resources when you deploy on AWS, then deploy installs the cluster. After that, info shows the node addresses, ssh connects to a node, and test runs smoke tests. Run chef-automate init-config-ha --help to see which topologies your version supports. These commands do nothing useful on a standalone server.

Frequently asked questions

Where is the Chef Automate admin password after installation?

chef-automate deploy writes it to automate-credentials.toml in the directory you ran deploy from. If it is lost, reset it with sudo chef-automate iam admin-access restore <new-password>.

What is the difference between chef-automate config patch and config set?

config patch merges the keys you provide into the existing configuration. config set replaces the whole user configuration, so any setting missing from that file returns to its default.

How do I create an API token for knife or the data collector?

Run chef-automate iam token create <name>, adding --admin only if the token needs full rights. The token value is printed once, so save it in a secrets store straight away.

How do I stop Chef Automate from upgrading automatically?

Set upgrade_strategy = "none" in the deployment section of the configuration and apply it with config patch. Then run chef-automate upgrade run yourself when you choose to upgrade.

Can I use migrate-from-v1 today?

Only if you still have a Chef Automate 1 server to move to Automate 2. Automate 1 is end-of-life, so new installations never need this command.

Related tutorials

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Chef Tutorials: Install and Configure Chef Automate and Infra Server

This tutorial installs Chef Automate and Chef Infra Server together on one Linux host with the chef-automate CLI. It then creates an admin user and an organization…

Read More

Chef Tutorials: Common Resource Functionality in chef Cookbook recipe

Common resource properties are settings that every Chef Infra resource accepts, whatever the resource type: action, ignore_failure, retries, retry_delay, sensitive, guards such as not_if and only_if, and…

Read More

Chef Tutorials: How to looping and iterative in Chef Cookbook recipe?

Chef recipes are Ruby, so you loop with ordinary Ruby iterators such as each, and each pass declares one Chef resource. This page explains how the loop…

Read More

Chef Tutorials: How to set Conditions in Chef Cookbooks recipe using Guard?

Chef guards are the not_if and only_if properties, which decide during the converge phase whether a resource runs. A guard can be a shell command string or…

Read More

Chef Tutorials: template Resource with example

The Chef template resource renders an Embedded Ruby (ERB) file from a cookbook's templates/ directory and writes the result to a path on the node. This page…

Read More

Chef Tutorials: Create multiple resources in Chef recipe

A Chef recipe is Ruby, so you can create many resources of the same type by looping over an array with .each and declaring one resource per…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x