# Reimage and recover

Source: https://argoctl-docs.pages.dev/docs/guides/reimage-and-recover

> Reinstall nodes, apply site-file changes, resume interrupted runs, replace hardware and collect logs for support.

## Resume an interrupted run

Every argoctl command can be interrupted (Ctrl-C, a dropped SSH session, `--timeout`) and finished by running the **same command** again:

- `provision` waits for deploys Ironic is still doing and continues; an interrupted `--reimage` finishes only the nodes it hadn't done.
- `create cluster` re-runs every phase; each task checks the node first, so finished work is skipped. The report says where the last run stopped.
- `deploy inference` re-applies the same Helm release and waits again.

Running commands inside `tmux` or `screen` on mgmt avoids most interruptions in the first place.

## Apply a site-file change to installed nodes

When you change something a node was installed with (its addresses, SSH keys, the OS image), `provision` reports the node **out of date** and leaves it alone, because reinstalling wipes its disk. To apply the change:

```bash
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl provision /etc/argoctl/site.yaml --reimage --node gpu2
sudo argoctl create cluster /etc/argoctl/site.yaml    # rejoins the reinstalled node
```

Move inference off the node first (`deploy inference ... --node` to place replicas elsewhere, or `delete inference`): its replicas stop while it's reinstalled.

## Add a node

1. Add it to `nodes` in the site file and validate.
2. `argoctl preflight <site-file> --node <new>`.
3. `argoctl provision <site-file>`: only the new node is installed.
4. `argoctl create cluster <site-file>`: only the new node is prepared and joined.

## Replace a server

If a server's hardware is replaced, its BMC, System or MACs change:

1. Update the node's `bmc.address`, `system_id` and `mac`s in the site file.
2. `provision` refuses a node whose BMC or System no longer matches what Ironic has, and prints the command to delete the old node from Ironic. Run it.
3. `provision` again enrols and installs the new server; `create cluster` joins it.

## Reinstall everything

```bash
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl provision /etc/argoctl/site.yaml --reimage
sudo argoctl create cluster /etc/argoctl/site.yaml
```

`--reimage` without `--node` reinstalls **every** node and wipes their disks, the cluster included.

## When Ironic lost track of nodes

After `ironic uninstall --purge` (or a reinstalled mgmt), Ironic no longer knows the installed nodes. `provision` sees their provisioning addresses answering SSH and refuses to enrol them, because enrolling would reinstall them. They keep running as they are. Bring a node back under Ironic only when you need to reinstall it anyway: `--reimage --node <name>`.

## Collect logs for support

Every run's log is in `/var/log/argoctl/` (or the path printed as `Full log:`). Copy them off mgmt with:

```bash
(umask 077; ssh ubuntu@<mgmt> 'sudo tar -C /var/log -czf - argoctl' > argoctl-logs.tar.gz)
```

Logs never contain passwords or tokens (see [Run logs](https://argoctl-docs.pages.dev/docs/reference/logs)), but they do contain addresses, MACs and the site file: share them accordingly. Include `argoctl version`.
