Hi Dick,

Thank you for your attention, but what you mean when you says "host var"?

INVENTORY:
[webserver] 
hosta
hostb


TASK1:
- name: copy script to server A
  copy: src=jboss.sh dest=/usr/app/abc/dir mode=u+rwx

TASK2:
- name: copy script to server B
  copy: src=jboss.sh dest=/usr/app/def/dir mode=u+rwx


COMMAND:
ansible-playbook -i inventory environment --limit webserver


The destination is different on both hosts and I can't reduce those tasks 
to only one, because of subdirectories "abc" and "def".

Thank you again,
Guilherme.

On Monday, December 12, 2016 at 2:22:23 PM UTC-2, Dick Davies wrote:
>
> If they're in different groups, make the path a group var. 
> If they're in the same groups, make the path a host var. 
>
> On 12 December 2016 at 14:29, Guilherme Ueno <[email protected] 
> <javascript:>> wrote: 
> > Hi all, 
> > 
> > I have to copy a file into a directory to specific hosts, but the path 
> > changes for specific hosts. 
> > 
> > Ex.: 
> > 
> > Inventory: 
> > 
> > [webserver] 
> > hosta 
> > hostb 
> > 
> > 
> > 
> > task: Copy a file into: 
> > 
> > hosta: /usr/app/abc/dir 
> > hostb: /usr/app/def/dir 
> > 
> > 
> > But, I don't know how to use those variables in the "same task" using 
> > "webserver" as target. 
> > 
> > thank you, 
> > Guilherme. 
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/a4ec4ad0-6432-40a1-a45b-6e908b506e77%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1daaf38f-f39e-4995-92a7-20752a86f398%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to