PBS API - I can't create ZFS pool

HarusKG

Renowned Member
May 28, 2012
8
0
66
Perm, Russia
Hello everyone.

I'm trying to automate the setup of my PBS using Ansible and ran into an issue where I can't create a ZFS pool via the API.
I decided to try creating it using curl for testing. My script looks like this:

Bash:
curl -X POST \
  --insecure --cookie "$(<cookie)" --header "$(<csrftoken)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "pool",
    "devices": ["/dev/sdb", "/dev/sdc"],
    "raidlevel": "mirror",
    "compression": "lz4",
    "ashift": 12
  }' \
  "https://$APINODE:8007/api2/json/nodes/localhost/disks/zfs"

But it gives me this error:
parameter verification failed - 'devices': Expected string value.

I've tried different options but haven't succeeded. Where did I go wrong?
 
Can you show me using my example?
I tested multiple approaches, including
JSON:
    "devices": "/dev/sdb",
    "raidlevel": "single"
None of this worked

#!/bin/bash
export APINODE=pbs
export TARGETNODE=pbs

curl -X POST \
--insecure --cookie "$(<cookie)" --header "$(<csrftoken)" \
-H "Content-Type: application/json" \
-d '{
"name": "pool",
"devices": "/dev/sdb",
"raidlevel": "single",
"compression": "lz4",
"ashift": 12
}' \
"https://$APINODE:8007/api2/json/nodes/$TARGETNODE/disks/zfs"
 
Last edited: