0

i am using ansible unarchive module,,

cassandraDir = /opt/con/cassandra
cassandra package = /tmp/apache-cassandra-3.7-bin.tar.gz

I need to unzip the cassandra package in the "cassandraDir"

    - name: Extract Cassandra package
      unarchive:
        src:  "{{ download_dir }}/{{ package_name }}-{{ package_version }}.tar.gz"
        dest: "{{ cassandraDir }}"
        owner: ubuntu
        group: ubuntu
        copy:  no
        extra_opts:
        - "--strip-components=1"
      environment:
        LANG: C
        LC_ALL: C
        LC_MESSAGES: C

which basically extracting in a particular location now the directory exist, and it even un zips it in that localtion but after that throws a error like this

TASK [Extract Cassandra package] ***********************************************
fatal: [172.28.48.177]: FAILED! => {"changed": false, "failed": true, "msg": "Unexpected error when accessing exploded file: [Errno 2] No such file or directory: '/opt/con/cassandra/apache-cassandra-3.7/bin'"}
ubuntu@ip-172-28-48-177:/opt/con/cassandra$
ubuntu@ip-172-28-48-177:/opt/con/cassandra$ ll
total 456
drwxrwxr-x 10 ubuntu ubuntu   4096 Apr  1 05:03 ./
drwxr-xr-x  7 root   root     4096 Apr  1 04:49 ../
-rw-r--r--  1 root   root   312867 Jun  6  2016 CHANGES.txt
-rw-r--r--  1 root   root    11609 Jun  6  2016 LICENSE.txt
-rw-r--r--  1 root   root    91959 Jun  6  2016 NEWS.txt
-rw-r--r--  1 root   root     2730 Jun  6  2016 NOTICE.txt
drwxr-xr-x  2 root   root     4096 Apr  1 05:04 bin/
drwxr-xr-x  3 root   root     4096 Apr  1 05:03 conf/
drwxr-xr-x  3 root   root     4096 Apr  1 05:03 doc/
drwxr-xr-x  2 root   root     4096 Apr  1 05:03 interface/
drwxr-xr-x  3 root   root     4096 Apr  1 05:03 javadoc/
drwxr-xr-x  5 root   root     4096 Apr  1 05:04 lib/
drwxr-xr-x  3 root   root     4096 Apr  1 05:04 pylib/
drwxr-xr-x  4 root   root     4096 Apr  1 05:04 tools/

it is un extracting from temp directory

$ ls -l /tmp/
total 34776
-rw-rw-r-- 1 ubuntu ubuntu 35592452 Apr  1 04:48 apache-cassandra-3.7-bin.tar.gz
drwxr-xr-x 2 root   root       4096 Apr  1 04:44 hsperfdata_root

any one else faced this issue

fatal: [172.28.48.177]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"backup": null, "content": null, "copy": false, "creates": null, "delimiter": null, "dest": "/opt/con/cassandra", "directory_mode": null, "exclude": [], "extra_opts": ["--strip-components=1"], "follow": false, "force": null, "group": "ubuntu", "keep_newer": false, "list_files": false, "mode": null, "original_basename": "apache-cassandra-3.7-bin.tar.gz", "owner": "ubuntu", "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/tmp/apache-cassandra-3.7-bin.tar.gz"}}, "msg": "Unexpected error when accessing exploded file: [Errno 2] No such file or directory: '/opt/con/cassandra/apache-cassandra-3.7/bin'"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.