diff --git a/cmd/commands_servers.go b/cmd/commands_servers.go index 2e8fdf9..06a65c9 100644 --- a/cmd/commands_servers.go +++ b/cmd/commands_servers.go @@ -29,6 +29,7 @@ func serversCreate(cmd *cli.Cmd) { hostname := cmd.StringOpt("hostname", "", "Hostname to assign to this server") tag := cmd.StringOpt("tag", "", "Tag to assign to this server") appID := cmd.StringOpt("a app", "", "If launching an application (OSID 186), this is the APPID to launch") + reservedIP := cmd.StringOpt("ip", "", "IP address of the floating IP to use as the main IP of this server") ipv6 := cmd.BoolOpt("ipv6", false, "Assign an IPv6 subnet to this virtual machine (where available)") privateNetworking := cmd.BoolOpt("private-networking", false, "Add private networking support for this virtual machine") autoBackups := cmd.BoolOpt("autobackups", false, "Enable automatic backups for this virtual machine") @@ -41,6 +42,7 @@ func serversCreate(cmd *cli.Cmd) { Script: *script, Snapshot: *snapshot, SSHKey: *sshkey, + ReservedIP: *reservedIP, IPV6: *ipv6, PrivateNetworking: *privateNetworking, AutoBackups: *autoBackups, diff --git a/lib/servers.go b/lib/servers.go index 280082d..e3a7054 100644 --- a/lib/servers.go +++ b/lib/servers.go @@ -51,6 +51,7 @@ type ServerOptions struct { UserData string Snapshot string SSHKey string + ReservedIP string IPV6 bool PrivateNetworking bool AutoBackups bool @@ -288,6 +289,10 @@ func (c *Client) CreateServer(name string, regionID, planID, osID int, options * values.Add("SSHKEYID", options.SSHKey) } + if options.ReservedIP != "" { + values.Add("reserved_ip_v4", options.ReservedIP) + } + values.Add("enable_ipv6", "no") if options.IPV6 { values.Set("enable_ipv6", "yes")