On 10.10.2019 21:02, David McPherson wrote:
I am attempting to copy a file from the local ansible server to the managed
hosts (oracle linux).
I would like to push the file out to the different managed hosts because if
I call back to the Ansible server from the hosts them I have to login,
provide password etc.
Pushing from the ansible host is easier because the ssl keys have been
copied to all the hosts and therefore is passwordless.

I haven't found another way to do it other than using shell or command,
copy seems to be for transfering files within the client file system

This is exactly what the copy module does, it copy a file from Ansible controller aka localhost to the remote host. The only way to transferring files within the client is to set "remote_src: True" on the copy module.


This is what I have so far but it's reaching back to the ansible server for
the file which requires a login.

Any help would be appreciated.

Dave

---
- hosts: 'ud-mgmt-srv'
  become: true
  get_info: false
  tasks:
  - name: Check httpdate rpm
    stat: path=/tmp/htpdate-1.1.0-1.el7.rf.x86_64.rpm
    register: st

This is not needed, copy module handles this.


  - name: Copy httpdate rpm
command: scp 10.236.1.57:/tmp/htpdate-1.1.0-1.el7.rf.x86_64.rpm /tmp/.
    when: not st.stat.exists

  - name: Copy httpdate rpm
    copy:
      src: /tmp/htpdate-1.1.0-1.el7.rf.x86_64.rpm
      dest: /tmp


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b2b67290c54653930949f74df42c8867%40olstad.com.

Reply via email to