Skip to main content

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:

ExampleOn the host
Move an interface to DHCPruns 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:

CallFlagsFails with
An interface osapi does not configure--name osapi0 --dhcp4not found
An address without a prefix--name osapi0 --addresses 10.0.1.5Addresses
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/24Addresses
An IPv4 gateway that is not IPv4--name osapi0 --gateway4 fe80::1Gateway4
An IPv6 gateway that is not IPv6--name osapi0 --gateway6 10.0.1.1Gateway6
An MTU below 68--name osapi0 --mtu 10MTU
An MTU above 9000--name osapi0 --mtu 9001MTU
A MAC address netplan does not take--name osapi0 --mac-address 0000.5e00.5301MACAddress
A name that is not an interface name--name "eth0;reboot"Name
A type osapi does not know--name osapi0 --type vlanType

Permission​

It needs the interface:write permission. osapi controller role get --name <role> shows what a role grants.

Flags​

FlagDescriptionDefault
--addressesThe static addresses, in CIDR notation, such as 10.0.0.5/24
--dhcp4Take an IPv4 address from DHCP
--dhcp6Take an IPv6 address from DHCP
--gateway4The IPv4 default gateway
--gateway6The IPv6 default gateway
--mac-addressThe MAC address to set
--mtuThe MTU, from 68 to 9000
--nameThe interface, such as eth0, or a fact such as @fact.interface.primary (required)
-T, --targetTarget: _all, _any, hostname, or label (group:web.dev)_all
--typeThe type: ethernet, the default, for an interface the host has, or dummy for a dummy interface that netplan makes (ethernet, dummy)
--wakeonlanTurn on wake-on-LAN

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file; without one at the default path, osapi runs on the defaults/etc/osapi/osapi.yaml
--urlBase URL the CLI client connects to (controller.client.url)https://localhost:8080

Output tells how the result is printed, and what --json gives.