Skip to content

Commit 194cd8e

Browse files
committed
readme: instruction for inventory file with scripts/tools
Signed-off-by: Olivier Hoareau <olivier.hoareau@vates.tech>
1 parent 3bd4cc8 commit 194cd8e

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ uv run scripts/tools.py -h
569569
This command performs an update operation on remote targets.
570570

571571
```bash
572-
uv run scripts/tools.py update primary1 primary2
572+
uv run scripts/tools.py update -H primary1 primary2
573573
```
574574

575575
For each primary target :
@@ -578,3 +578,41 @@ For each primary target :
578578
2. Update with repository manager (yum): Optionally enables repositories
579579
3. Reboot
580580
4. Get attached secondary hosts and repeats three previous steps for each secondary
581+
582+
**Inventory file**
583+
584+
`update` command can read an inventory file in [TOML v1.0.0](https://toml.io/en/v1.0.0) format:
585+
586+
```bash
587+
uv run scripts/tools.py update -i my_inventory.toml
588+
```
589+
590+
> [!NOTE]
591+
> You can use either `-i/--inventory` or `-H/--hosts`.
592+
>
593+
> **Above flags can't be used together**
594+
595+
Take a look at an example inventory file:
596+
597+
```toml
598+
# my_inventory.toml
599+
600+
[all]
601+
enablerepos = ["xcp-ng-base"]
602+
603+
[servers]
604+
605+
[servers."ip_or_hostname-1"]
606+
607+
[servers."ip_or_hostname-2"]
608+
609+
enablerepos = ["xcp-ng-updates"]
610+
```
611+
612+
> [!IMPORTANT]
613+
> Config values under `servers` override values under `all`. For instance, the above inventory would produce
614+
> the following python dict:
615+
>
616+
> `{'ip_or_hostname-1': {'enablerepos': ['xcp-ng-base']}, 'ip_or_hostname-2': {'enablerepos': ['xcp-ng-updates']}}`
617+
>
618+
> Using *enablerepo flag* `-e` with inventory is still possible, it won't be used though.

0 commit comments

Comments
 (0)