This is working as designed. When you define a variable in a role, that role might be something like "common" and package variables that other roles might like to use.
For instance a role could define "production" vs "staging" environment behavior, and a value like "ntp_server" could be used in subsequent roles. When roles look for files, they look for files relative to them first, then at playbook level. However, we don't comb all file paths, as it would be difficult to source where files were drawing from -- as it's not improbable two different files might share the same name and different paths. The files are only searched in two places -- the files (or templates) dir, and the level up. On Tue, May 6, 2014 at 7:17 AM, ProfHase <[email protected]> wrote: > I am using ansible 1.5 . > > It seems inconsistent to me that the variable defined in the role (i.e. > defined in roles/admin_users/vars/main. > yml) > is also available in the task while the files in the role file folder > (i.e. roles/admin_users/files) are not found by the copy module > > Thanks > > > > "It seems inconsistant to me." >> >> What specifically seems inconsistent? >> >> Can you share output and the ansible version you are using? >> >> Thanks! >> >> >> >> On Mon, May 5, 2014 at 4:14 AM, ProfHase <[email protected]> wrote: >> >>> having this playbook (where i'd like to copy the private key to some >>> users): >>> >>> - hosts: my_special_hosts >>> >>> tasks: >>> - name: Copy Private Key >>> copy: >>> src={{item.name ~ "_key" }} >>> dest="/home/{{item.name}}/.ssh/id_rsa" >>> owner="{{item.name}}" >>> mode="0500" >>> with_items: admin_users >>> sudo: true >>> >>> roles: >>> - admin_users >>> >>> I am wondering: >>> The with_items statement works perfectly (the variable admin_users is >>> defined in roles/admin_users/vars/main.yml). >>> On the other hand 'copy' does look up the 'roles/admin_users/files' >>> folder. (The error message is: 'could not find src=/ansibledir/user_key') >>> >>> It seems inconsistant to me. Does anyone know more? >>> >>> Thanks >>> >>> -- >>> 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/6cd93f08-584e-4a2b-81c5- >>> a0ce69b46d2a%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/6cd93f08-584e-4a2b-81c5-a0ce69b46d2a%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> 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/e2ce9e76-b81c-4cff-b82a-e44b02a18fc6%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/e2ce9e76-b81c-4cff-b82a-e44b02a18fc6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > 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/CA%2BnsWgxajwnLYkDDWZxU%2BSoyXj5fbswo_4kJUZ-zdF9F6tAmNg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
