roles and with_fileglobs

Hi all,

As I found, the lookup plugin with_fileglobe do not support roles.
I reviewed the plugin but I have a problem how to implement this feature.

The file globe is lookup plugin a could be used with copy or template
module.
Each of these ovules is using different directory for searching when using
the roles /files, templates/.

So any idea how to implement the role bases lookup into this lookup plugin?

Maybe question for Michael. Is there any reason for "files" and
"templates" directory. Why there could not be only files? It would be
easier to implement various lookup plugins.

  Best regards
    Peter

As I found, the lookup plugin with_fileglobe do not support roles.
I reviewed the plugin but I have a problem how to implement this feature.

There was a patch that implements this very recently, can you test the
latest git checkout?​​

The file globe is lookup plugin a could be used with copy or template
module.
Each of these ovules is using different directory for searching when using
the roles /files, templates/.

So any idea how to implement the role bases lookup into this lookup plugin?

Maybe question for Michael. Is there any reason for "files" and
"templates" directory. Why there could not be only files? It would be
easier to implement various lookup plugins.

​This patch ​ actually assumes files/ only.

Hi Serge,

Thanks, I had typo in playbook ;(
It’s working with files. As I see it generates absolute path, so it should be working also with template module.

Thanks, my mistake …

Anyway I still prefer one folder for for files /files or templates/.
My directory structure for playbook is: roles//files/<task/tag name>/
Where task/tag name is common name for group of tasks: zabbix, package_apt, resolve, ntp, nginx, apache, …

Some of the modules have files and templates an in actual directory structure I have to split into different folders ;(
Mayby symbolic link would help :wink:

Peter

Many of us find keeping files, tasks, and templates seperate quite useful for organization, so we are not going to merge them into one directory.

Hi Michael,

I’m OK with the organisation when using the roles.
I was just surprised, why there is serrate directory for ‘files’ and ‘templates’.
I did symbolic link to be happy with my layout :wink:

Peter

To me, files and templates are two very different things. Files are resources that need to be copied over, such as GPG keys for repos, or fully created scripts. Templates are something that is programatically created then placed on the managed server. This distinction is important to me because I can do some smart things with sharing roles with others, while keeping private things like SSL/GPG keys separate.

For example, if I have a role for Apache that I created, and my friend Bob wants to use it, I can send him the role without my file’s directory and he still has a fully usable role without all my private materials. I am currently working on that now so I can start pushing our configs to a public repo.

Of course that may not be of use to you, but this is just one reason why there’s a difference between files and templates.