#Ansible module to use for `file_info` REST calls

1 messages · Page 1 of 1 (latest)

odd kindle
#

Hi,

I need to write some data to a file on a netapp cmode volume. Look at REST library, there is FileInfo() REST calls to netapp filer. From document, it's equavalent to below:

GET /api/storage/volumes/{volume.uuid}/files/{path}?byte_offset=0&length=40 -H "Accept: multipart/form-data"
POST /api/storage/volumes/{volume.uuid}/files/{path} -H "Content-Type: multipart/form-data" –form "file=the data to be written to the new file"
PATCH /api/storage/volumes/{volume.uuid}/files/{path}?byte_offset=10 -H "Content-Type: multipart/form-data" –form "file=the new data to be written or overwritten to the existing file starting at byte_offset"

However, how do I use ansible module to create a file? I tried restit, it does not work.

      netapp.ontap.na_ontap_restit:
        <<: *login
        api: "storage/volumes/{{ vol_uuid }}/files/{{ dfsFileName }}"
        method: POST
        files:
          data: "some data"

well, it is probably not right way to use na_ontap_restit.

odd kindle
#

Well, different question. Above seems to work if dfsFileName: somefile, the file is written to volume level. But if dfsFileName: aqtree/somefile, then I got error:
TASK [Push a file into an ONTAP volume via REST] ********************************************************* fatal: [sitcoms-mgmt]: FAILED! => {"changed": false, "error_code": "3", "error_message": "API not found", "msg": "Error when calling 'storage/volumes/ddaed188-6bf0-11f0-82b6-d039eac0cf94/files/aqtree/afile'
why would it fail on a deeper qtree path? qtree exists.

acoustic solar