# argoctl provision

Source: https://argoctl-docs.pages.dev/docs/reference/cli/provision

> Install Ubuntu on every node over Redfish virtual media with static IPs, and check every node answers SSH.

## Synopsis

```bash
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl provision <site-file> [flags]
```

**Before you start:**

Run [`argoctl ironic install`](https://argoctl-docs.pages.dev/docs/reference/cli/ironic-install) with the same site file first. Provisioning a node writes its disk; nodes that are already installed are left alone unless you pass `--reimage`.

## Description

Installs the site file's OS image on every node and checks each one comes up with the right hostname and addresses. It is safe to re-run: installed, up-to-date nodes are left alone, and an interrupted run resumes.

### What it does

1. **Checks, before changing anything.** Ironic answers, argoctl's login works and Ironic serves this site file's OS image. Per node: the BMC answers and the login works; the Redfish System is the site file's `system_id`, else the BMC's only System, else the one with the node's provisioning MAC; the System's NICs include the site file's MACs; Secure Boot is read and reported. If Ironic already has the node, it must point at the same BMC and System and not be in maintenance; no site-file MAC may belong to another Ironic node. A node Ironic doesn't know but whose provisioning IP already answers SSH isn't touched without `--reimage`, because enrolling it would reinstall it. **Any failure stops the run with nothing changed.**
2. **Converges each node**, in parallel, from whatever state Ironic has it in:
   - not in Ironic: **enrol** it (driver `redfish`, BMC address, System, credentials, virtual-media boot, the agent network config) and add a port per MAC;
   - **manage** (Ironic checks BMC access), **provide**, then **deploy**: Ironic builds an ISO for the node (agent plus its network config), inserts it over Redfish and boots the node from it; the agent writes the image and the config drive; Ironic ejects the ISO and boots the disk;
   - a deploy Ironic is still running (an interrupted run) is waited for; a failed one is retried once per run;
   - `active` with the same settings: **left alone**. Settings are fingerprinted (image checksum, agent network config, config drive). If the site file changed (IPs, keys, image), the node is reported **out of date** and still left alone: reinstalling wipes the disk, so it takes `--reimage`.
3. **Checks it's up**: for each of the node's static IPs (provisioning and frontend) the SSH server answers, and logging in as `ubuntu` with mgmt's provisioning key shows the site file's hostname and every static address. This runs on every run, so re-running is also a health check.

Settings in Ironic that drift from the site file (BMC address, System, user, agent network config, ports) are corrected on the next run.

**Reimage and resume.** `--reimage` marks every selected, installed node and rebuilds it with a fresh config drive; each mark is cleared once that node is back and passes the SSH check. Ctrl-C (or a lost SSH session) stops argoctl but not Ironic: re-run the same command and it waits for deploys Ironic is still running and finishes only the still-marked nodes, so a completed reimage is never repeated.

**Secure Boot** stays as the BMC has it. The whole chain is signed: the deploy ISO (shim signed by the Microsoft UEFI CA, then GRUB and the agent's kernel) and the installed disk (Ubuntu's shim, GRUB and kernel).

## Flags

| Flag | Default | |
|---|---|---|
| `<site-file>` | | Path to the site file. |
| `--node <name>` | all | Only these nodes (repeat the flag). |
| `--reimage` | | Reinstall the selected nodes even if up to date (**wipes their disks**). |
| `--json` | | Print the report as JSON on stdout. |
| `--parallel <n>` | `8` | Nodes deployed at the same time. |
| `--deploy-timeout <d>` | `45m` | Per node, from asking Ironic to deploy to `active`. |
| `--ssh-timeout <d>` | `15m` | Per node, from `active` to SSH answering with the right hostname and addresses. |
| `--request-timeout <d>` | `30s` | One Redfish or Ironic request. |
| `--timeout <d>` | `3h` | The whole run. |

## Examples

```bash
export ARGOCTL_BMC_PASSWORD=...
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl provision /etc/argoctl/site.yaml
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl provision site.yaml --node gpu2 --reimage
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl provision site.yaml --json > provision.json

# log in to a node with mgmt's provisioning key
sudo ssh -i /var/lib/argoctl/ssh/id_ed25519 ubuntu@172.16.1.21 'hostname; ip -br -4 addr; mokutil --sb-state'
```

## Output

First run on blank nodes (`gpu1` shown; other nodes' progress lines left out):

```text
$ sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl provision /etc/argoctl/site.yaml
==> provision /etc/argoctl/site.yaml: site dc1, 3 nodes (cp1, gpu1, gpu2)
    OS image https://cloud-images.ubuntu.com/releases/noble/release-20261017/ubuntu-24.04-server-cloudimg-amd64.img
  site      Ironic is up; OS image http://172.16.1.10:6180/images/os-sha256-04e8f2461a16-ubuntu-24.04-server-cloudimg-amd64.img
  site      checking 3 nodes before changing anything
  gpu1      BMC ok: System /redfish/v1/Systems/1, power Off, Secure Boot on, MACs match
  gpu1      enrol in Ironic: redfish https://172.16.0.21 /redfish/v1/Systems/1
  gpu1      manage: Ironic checks it can reach the BMC
  gpu1        Ironic: manageable
  gpu1      provide: make it available for deploying
  gpu1        Ironic: available
  gpu1      deploy: Ironic boots the deploy agent from virtual media and writes the OS image (up to 45m)
  gpu1        Ironic: wait call-back -> active (deploy step: boot the deploy agent from virtual media)
  gpu1        Ironic: wait call-back -> active (deploy step: the agent writes the image and config drive)
  gpu1        Ironic: deploying -> active (deploy step: make the disk bootable)
  gpu1        Ironic: active (installed)
  gpu1      active after 9m12s
  gpu1        SSH 172.16.1.21: ok, hostname gpu1; 172.16.1.21/24 172.16.2.21/24
  gpu1        SSH 172.16.2.21: ok, hostname gpu1; 172.16.1.21/24 172.16.2.21/24
  gpu1      deployed

✓ provision of site dc1: 3 deployed (11m40s)

  NODE  RESULT    IRONIC  SECURE BOOT  DEPLOY  SSH
  cp1   deployed  active  on           7m03s   172.16.1.11 ok, 172.16.2.11 ok (hostname cp1)
  gpu1  deployed  active  on           9m12s   172.16.1.21 ok, 172.16.2.21 ok (hostname gpu1)
  gpu2  deployed  active  on           9m31s   172.16.1.22 ok, 172.16.2.22 ok (hostname gpu2)
  Full log: /var/log/argoctl/20261130T104512Z-provision.log
```

Running it again changes nothing:

```text
✓ provision of site dc1: 3 unchanged (2s)

  NODE  RESULT     IRONIC  SECURE BOOT  DEPLOY  SSH
  cp1   unchanged  active  on           -       172.16.1.11 ok, 172.16.2.11 ok (hostname cp1)
  gpu1  unchanged  active  on           -       172.16.1.21 ok, 172.16.2.21 ok (hostname gpu1)
  gpu2  unchanged  active  on           -       172.16.1.22 ok, 172.16.2.22 ok (hostname gpu2)
```

Resuming an interrupted `--reimage`:

```text
  site      resuming an interrupted reimage of gpu2 (nodes it already finished aren't reimaged again)
  gpu2      Ironic is busy with it (wait call-back -> active): waiting
  ...
✓ provision of site dc1: 1 reimaged, 2 unchanged (8m27s)
```

## Exit codes

| Code | Meaning |
|---|---|
| `0` | Every node is installed, up to date and reachable. |
| `1` | Anything else, including nodes reported **out of date**. |
| `2` | Usage error. |

## Troubleshooting

| Symptom | Likely cause and fix |
|---|---|
| `reach Ironic: ... connection refused` / `401` | Ironic isn't installed or healthy, or argoctl's password file doesn't match: `sudo argoctl ironic install <site-file>` (repairs both). |
| `check the OS image: ... HTTP 404` | The site file's `os_image` changed since Ironic was installed: run `ironic install` with this site file. |
| `check the BMC: ... MAC ... isn't one of the System's NICs` | Wrong MAC in the site file, or the BMC address belongs to another machine. The message lists the BMC's MACs. |
| `check Ironic: ... is BMC ... but the site file ... says ...` | The site file's BMC or System changed for a node Ironic has. If the hardware really changed, delete the node from Ironic (command in the message) and re-run. |
| `... in maintenance mode` | Ironic stopped managing the node (often a failed power sync: wrong BMC password). Fix the cause, then run the command in the message. |
| Deploy stays `wait call-back` until the timeout | The agent didn't call back. Watch the node's console: Secure Boot "Access Denied" (firmware lacks the Microsoft UEFI CA); the agent booted but has no IP (check `argoctl node-config` MAC and IP); it can't reach `mgmt.provisioning_ip:6385` (firewall). With the agent up you can log in from mgmt: `sudo ssh -i /var/lib/argoctl/ssh/id_ed25519 root@<provisioning ip>`. |
| `deploy failed again: ...` | Ironic's last error says why. Agent logs: `sudo ls /var/lib/argoctl/ironic/shared/log/ironic/deploy/`; Ironic: `sudo docker compose -p argo-ironic logs --tail 200 ironic`. |
| Deploy log says `No space left on device` | Nodes too small for the `http` image download source: `sudo argoctl ironic install <site-file> --image-download-source local`, then provision again. |
| `check SSH: ... no answer` | The disk booted but the network isn't up: the node's console shows cloud-init; `argoctl node-config` shows what it was given. |
| `check SSH: hostname is ...` | The node was installed by something else, or with other settings: `--reimage --node <name>`. |
| `... isn't in Ironic, but ... already answers SSH` | Ironic lost the node (purged or reinstalled). `--reimage --node <name>` brings it back under Ironic. |
| A node is `out of date` | The site file changed after it was installed: `--reimage --node <name>` applies the change (wipes the disk). |

## Related

- [`argoctl node-config`](https://argoctl-docs.pages.dev/docs/reference/cli/node-config): what each node is given.
- [Guide: reimage and recover](https://argoctl-docs.pages.dev/docs/guides/reimage-and-recover)
- [`argoctl create cluster`](https://argoctl-docs.pages.dev/docs/reference/cli/create-cluster): the next step.
