Update
Change the config osapi has of a network interface.
Writes the interface's netplan file over the one osapi has, as create writes it, and applies it. Without type dummy, the config goes in the section that netplan status gives, which is dummy-devices for a dummy, so a dummy stays a dummy. An interface osapi does not configure is not found: create configures it.
osapi client node interface update [flags]
Examples
# Move an interface to DHCP
osapi client node interface update --target web-01 --name osapi0 --type dummy --dhcp4
Result
Move an interface to DHCP, on one host:
$ osapi client node interface update --target web-01 --name osapi0 --type dummy --dhcp4 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 update --target _all --name osapi0 --type dummy --dhcp4 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"
}
]
}
With the default settings, each example does this on the host:
| Example | On the host |
|---|---|
| Move an interface to DHCP | runs netplan generate; runs netplan apply; writes /etc/netplan/osapi-osapi0.yaml: network:\n version: 2\n dummy-devices:\n osapi0:\n dhcp4: true\n dhcp6: false |
The command fails in these cases:
| Call | Flags | Fails with |
|---|---|---|
| An interface osapi does not configure | --name osapi0 --dhcp4 | not found |
| An address without a prefix | --name osapi0 --addresses 10.0.1.5 | Addresses |
| More than 16 addresses | --name osapi0 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 --addresses 10.0.1.5/24 | Addresses |
| An IPv4 gateway that is not IPv4 | --name osapi0 --gateway4 fe80::1 | Gateway4 |
| An IPv6 gateway that is not IPv6 | --name osapi0 --gateway6 10.0.1.1 | Gateway6 |
| An MTU below 68 | --name osapi0 --mtu 10 | MTU |
| An MTU above 9000 | --name osapi0 --mtu 9001 | MTU |
| A MAC address netplan does not take | --name osapi0 --mac-address 0000.5e00.5301 | MACAddress |
| A name that is not an interface name | --name "eth0;reboot" | Name |
| A type osapi does not know | --name osapi0 --type vlan | Type |
Permission
It needs the interface:write permission.
osapi controller role get --name <role> shows what a role grants.
Flags
| Flag | Description | Default |
|---|---|---|
--addresses | The static addresses, in CIDR notation, such as 10.0.0.5/24 | |
--dhcp4 | Take an IPv4 address from DHCP | |
--dhcp6 | Take an IPv6 address from DHCP | |
--gateway4 | The IPv4 default gateway | |
--gateway6 | The IPv6 default gateway | |
--mac-address | The MAC address to set | |
--mtu | The MTU, from 68 to 9000 | |
--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 |
--type | The type: ethernet, the default, for an interface the host has, or dummy for a dummy interface that netplan makes (ethernet, dummy) | |
--wakeonlan | Turn on wake-on-LAN |
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.