delegate_to from inventory? copy between remote hosts

1,582 views
Skip to first unread message

pixel fairy

unread,
Aug 1, 2015, 2:01:34 AM8/1/15
to Ansible Project
making a playbook to set up ceph clients, so want to transfer a client key from server (a monitor host) to client. since the server and client are both far away and sitting next to each other, id like to copy between them, so of course, i tried

   - name: make sure the client key is in place
     copy: src=/etc/ceph/ceph.client.admin.keyring dest=/etc/pve/priv/ceph/rbd.keyring
     delegate_to: mons[0]

and to make sure it knew what i wanted,

$ ansible mons[0] --list-hosts
    c1

ran the playbook and got this,

failed: [proxbox -> mons[0]] => {"failed": true}
msg: could not find src=/etc/ceph/ceph.client.admin.keyring

(maybe it was looking on the local filesystem?)

then i tried synchronize, as suggested here, http://stackoverflow.com/questions/25505146/how-to-copy-files-between-two-nodes-using-ansible
but got this,

fatal: [proxbox -> mons[0]] => SSH Error: ssh: Could not resolve hostname mons[0]: nodename nor servname provided, or not known

does delegate_to not use the inventory?



Timothy Appnel

unread,
Aug 3, 2015, 11:47:54 AM8/3/15
to Ansible Project
Try wrapping your mons variable in {{ }} like this...

delegate_to: {{ mons[0] }}

I'm pretty sure without them your variable is being interpreted as a literal.


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/27bc3f75-6222-4c8d-bf0a-89068317bb9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Coca

unread,
Aug 3, 2015, 12:46:03 PM8/3/15
to Ansible Project
quote it

delegate_to: "{{ mons[0] }}"




--
Brian Coca

Timothy Appnel

unread,
Aug 3, 2015, 3:33:32 PM8/3/15
to Ansible Project
Right. Thanks bcoca. Always forget that one until I run. <tim/>


photo
Timothy Appnel
Senior Solutions Architect

Ansible, Inc.  www.ansible.com

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages