Delete
Drop the config osapi has of a network interface.
Removes the interface's netplan file and applies what is left. netplan apply leaves the link of a dummy, so delete then deletes the link with ip link delete. An interface osapi does not configure does not change.
osapi client node interface delete [flags]
Examples
# A dummy interface osapi configures
osapi client node interface delete --target web-01 --name osapi0
# An interface osapi does not configure
osapi client node interface delete --target web-01 --name osapi0
Result
A dummy interface osapi configures, on one host:
$ osapi client node interface delete --target web-01 --name osapi0 Results: HOSTNAME STATUS NAME web-01 changed osapi0 1 host: 1 changed job 550e8400-e29b-41d4-a716-446655440000 trace 26e448c9dbe1c4a8d216a98c675079c9
On each host, where one cannot run it:
$ osapi client node interface delete --target _all --name osapi0 Results: HOSTNAME STATUS NAME web-01 changed osapi0 web-02 changed osapi0 3 hosts: 2 changed, 1 skipped job 550e8400-e29b-41d4-a716-446655440000 trace 26e448c9dbe1c4a8d216a98c675079c9 Details: mac-01 skipped operation not supported on this OS family
With --json, the API's response:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"results": [
{
"changed": true,
"hostname": "web-01",
"name": "osapi0",
"status": "ok"
}
]
}
An interface osapi does not configure, on one host:
$ osapi client node interface delete --target web-01 --name osapi0 Results: HOSTNAME STATUS NAME web-01 ok osapi0 1 host: 1 ok job 550e8400-e29b-41d4-a716-446655440000 trace 26e448c9dbe1c4a8d216a98c675079c9
On each host, where one cannot run it:
$ osapi client node interface delete --target _all --name osapi0 Results: HOSTNAME STATUS NAME web-01 ok osapi0 web-02 ok osapi0 3 hosts: 2 ok, 1 skipped job 550e8400-e29b-41d4-a716-446655440000 trace 26e448c9dbe1c4a8d216a98c675079c9 Details: mac-01 skipped operation not supported on this OS family
With --json, the API's response:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"results": [
{
"changed": false,
"hostname": "web-01",
"name": "osapi0",
"status": "ok"
}
]
}
With the default settings, each example does this on the host:
| Example | On the host |
|---|---|
| A dummy interface osapi configures | removes /etc/netplan/osapi-osapi0.yaml; runs netplan apply; runs ip link delete osapi0 |
The command fails in these cases:
| Call | Flags | Fails with |
|---|---|---|
| A name that is not an interface name | --name "eth0;reboot" | Name |
Permission
It needs the interface:write permission.
osapi controller role get --name <role> shows what a role grants.
Flags
| Flag | Description | Default |
|---|---|---|
--name | The interface, such as eth0, or a fact such as @fact.interface.primary (required) | |
-T, --target | Target: _all, _any, hostname, or label (group:web.dev) | _all |
Global flags
| Flag | Description | Default |
|---|---|---|
-d, --debug | Enable or disable debug mode | |
-j, --json | Enable JSON output | |
-f, --osapi-file | Path to config file; without one at the default path, osapi runs on the defaults | /etc/osapi/osapi.yaml |
--url | Base URL the CLI client connects to (controller.client.url) | https://localhost:8080 |
Output tells how the result is printed, and what --json
gives.