Question: Writing a task to run an install script and normally it would have to be run with : `sudo ./install.sh`

My task looks like:

```
    - name: Run the installer
      shell: "{{ tempdir_output.path }}/device_manager_osx*/install.sh"
      become: true
      become_method: sudo
      become_user: jenkins
      when: dm_version.stdout != device_manager_version

```

The error I am getting is:

```
TASK [Run the installer] **************************************************************************************************************
fatal: [mac-station-xx.firmware.xxxxxxx.com]: FAILED! => {"changed": true, "cmd": "/var/folders/l7/wjqfy72x1p7dd2d11qt6s_6h0000gp/T/ansible.ZuX4_Ttemp/device_manager_osx*/install.sh", "delta": "0:00:00.073814", "end": "2019-04-19 20:47:38.723407", "msg": "non-zero return code", "rc": 1, "start": "2019-04-19 20:47:38.649593", "stderr": "", "stderr_lines": [], "stdout": "ERROR: This script needs to be run as root.\nExample- sudo install.sh", "stdout_lines": ["ERROR: This script needs to be run as root.", "Example- sudo install.sh"]}

```

I have tried:

* Using just `become: true` to just get root permissions, but then the installer fails because it has to be installed under the jenkins user.
* Adding sudo in the shell ansible code block didn't work, it threw an error and said to use become methods.

Would appreciate any insight!

Answer: 
Here is the official spark documentation for the same: <https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html#output-sinks>

As of spark 2.4.1, five formats are supported out of the box: 

* File sink
* Kafka sink
* Foreach sink
* Console sink
* Memory sink

On top of that one can also implement her custom sink by extending `Sink` API of Spark: <https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/Sink.scala>
I found one reference: <https://community.hortonworks.com/questions/89282/structured-streaming-writestream-append-to-file.html>

It seems that `option("path",path)` can be used:

[![enter image description here](https://i.stack.imgur.com/FQRjT.png)](https://i.stack.imgur.com/FQRjT.png)