Import kibana dashboard using ansible

Hi, I have exported kibana dashboard in ndjson format. now i want to import it to another instance of kibana. I am doing this using ansible playbook. This is my command

curl -X POST "*Reverse_PROXY_IP/kibana*/api/saved_objects/_import?createNewCopies=true" -H "Content-Type: application/x-ndjson" --form file=@./dashboard.ndjson -u name:pwd

I have put this command in a shell script which is being run by ansible.
Now I am getting this error when running the playbook

The full traceback is:
NoneType: None
fatal: [10.0.2.4]: FAILED! => {
    "changed": true,
    "msg": "non-zero return code",
    "rc": 26,
    "stderr": "OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 10.0.2.4 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 1726\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 26\r\nShared connection to 10.0.2.4 closed.\r\n",
    "stderr_lines": [
        "OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020",
        "debug1: Reading configuration data /etc/ssh/ssh_config",
        "debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files",
        "debug1: /etc/ssh/ssh_config line 21: Applying options for *",
        "debug2: resolve_canonicalize: hostname 10.0.2.4 is address",
        "debug1: auto-mux: Trying existing master",
        "debug2: fd 3 setting O_NONBLOCK",
        "debug2: mux_client_hello_exchange: master version 4",
        "debug3: mux_client_forwards: request forwardings: 0 local, 0 remote",
        "debug3: mux_client_request_session: entering",
        "debug3: mux_client_request_alive: entering",
        "debug3: mux_client_request_alive: done pid = 1726",
        "debug3: mux_client_request_session: session request sent",
        "debug3: mux_client_read_packet: read header failed: Broken pipe",
        "debug2: Received exit status from master 26",
        "Shared connection to 10.0.2.4 closed."
    ],
    *"stdout": "curl: (26) Failed to open/read local data from file/application\r\n",*
*    "stdout_lines": [*
*        "curl: (26) Failed to open/read local data from file/application"*
    ]
}

If i run this command manually from the ansible machine( which is also my reverse proxy machine) it works fine. but not using playbook.
Note kibana is having a private ip only and is using reverse proxy. This same setup worked totally fine with kibana having public ip and no RP. Unable to figure out where the issue is!
Also the same ndjson file is getting imported from d UI

For me it looks like ansible can't access the dashboard.ndjson? you could try an absolute path maybe? or maybe use a tool to convert your curl command Ansible which allows also to provided files with the right path?
Best,
Matthias

i tried changing the path . but no luck. It has given something related to ssh also in the errors. Not able to figure the exact cause!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.