Hi, > I've a collection where I would like to externalize an array of > strings. At run time, the collection will read their content and > create an array based on the file. The idea being that this list can > change without building again the collection.
if the file is included in the collection, how can you update the file without building the collection? > I just wonder where, within my collection directory tree, to put this > data file (it can be txt, csv, or even yml) and which internal API > use to parse it. There's no internal API. You can place it whereever you want in the tree, there is no canonical place for it. I'd suggest to add some module_utils code for reading it, it can use os.path.dirname(__file__) to get hold of the module_utils directory path and load the file relative from there. I did something like that in one of my collections: https://github.com/felixfontein/ansible-tools/blob/main/plugins/filter/domain_suffix.py#L10 https://github.com/felixfontein/ansible-tools/blob/main/plugins/public_suffix_list.dat Cheers, Felix -- 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/20201127083247.133133f7%40rovaniemi.
