-2

I have tried to copy a file output of the ansible-playbook looks ok , but the file was copied to local machine not to remote machine in the location dest mentioned in yaml file.

bash-4.2# ansible --version
ansible 2.6.3
  config file = /home/build/git/playbook-iam/ansible.cfg

  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']

  ansible python module location = /usr/lib/python2.7/site-packages/ansible

  executable location = /bin/ansible

  python version = 2.7.5 (default, Feb 20 2018, 09:19:12) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

Playbook

---
- hosts: fim-server
  tasks:
  - name: Ansible copy file to remote server
    copy:
      src: test.conf
      dest: /tmp

playbooks/WAS_CODE_COPY.yml

---
 - hosts: fim-server
   tasks:
   - name: unpack IIM code on FIM server
     unarchive:
       src: /tmp/iim_1.8.5_for_op_7.4_linux_ml.zip
       dest: /tmp
       remote_src: yes

Output of run

[build@kvmsbasat01m playbook-iam]$ ansible-playbook playbooks/WAS_CODE_COPY.yml

PLAY [fim-server] *************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************************************************************************
ok: [KVMSBAFIM01M]

TASK [unpack IIM code on FIM server] ******************************************************************************************************************************************************************************
fatal: [KVMSBAFIM01M]: FAILED! => {"changed": false, "msg": "Source '/tmp/iim_1.8.5_for_op_7.4_linux_ml.zip' does not exist"}
    to retry, use: --limit @/home/build/git/playbook-iam/playbooks/WAS_CODE_COPY.retry

PLAY RECAP ********************************************************************************************************************************************************************************************************
KVMSBAFIM01M               : ok=1    changed=0    unreachable=0    failed=1   


[build@kvmsbasat01m playbook-iam]$ ssh kvmsbafim01 "ls -l /tmp/iim*"
build@kvmsbafim01's password: 
-rw-r--r--. 1 build users 171715008 Sep  7 01:52 /tmp/iim_1.8.5_for_op_7.4_linux_ml.zip

[build@kvmsbasat01m playbook-iam]$ 
10
  • 2
    Can you show your playbook?
    – Zoredache
    Sep 7, 2018 at 6:10
  • Please edit your question, don't add additional information in comments. It's unreadable here. Sep 7, 2018 at 6:20
  • Have you tried with the full filename as dest? So /tmp/test.conf
    – Alex Moore
    Sep 7, 2018 at 7:24
  • yes I have tried that ..even unarchive command copies and unzips to local machine Sep 7, 2018 at 7:44
  • formatting tools. Use them
    – Sven
    Sep 7, 2018 at 7:53

1 Answer 1

0

Try with following Unarchive fails to find command

- name: unarchive files
  unarchive:
    src: files.tar.gz
    dest: "/tmp/iim_1.8.5_for_op_7.4_linux_ml.zip"
    owner: "{{ default_user }}"
    group: "{{ default_group }}"
    extra_opts: [--strip-components=1]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .