unarchive task works with root user but fails with other users

Hi all,

I’m trying to run a playbook but I’m having some trouble.

If in the playbook I have:

  • name: spark installation playbook
    hosts: SPARK
    become_user: root
    become: yes
    vars:

spark_folder_name: “spark-1.6.0-bin-hadoop2.6”

tasks:

  • name: unarchiving the zip file
    unarchive: src=./spark.tgz dest=./ copy=yes mode=0777

the task works.

But if instead I have the following in the playbook:

  • name: spark installation playbook
    hosts: SPARK
    become_user: ubuntu
    become: yes
    vars:

spark_folder_name: “spark-1.6.0-bin-hadoop2.6”

tasks:

  • name: unarchiving the zip file
    unarchive: src=./spark.tgz dest=./ copy=yes mode=0777

Then the task fails and I get the following message:

TASK [unarchiving the zip file to target machine] ******************************
fatal: [VMSPARK]: FAILED! => {“changed”: false, “failed”: true, “msg”: “dest ‘./’ must be an existing dir”}

How can I get the playbook to work with user ubuntu?

I have ssh key-enabled access to the server with user ubuntu, so accessing it is not the problem.

Any help will be much appreciated!
Best regards,
Noelia