theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
147 stars 163 forks source link

Add module for foreman_templates plugin #677

Closed nesanton closed 4 years ago

nesanton commented 4 years ago
SUMMARY

A lot of people ask how to sync templates from git Wrapping foreman_templates plugin in a module could be a good idea https://github.com/theforeman/foreman_templates

ISSUE TYPE
evgeni commented 4 years ago

IIRC @sean797 wanted to have this too, so CC :)

evgeni commented 4 years ago

please add https://projects.theforeman.org/issues/27680 as a related issue if you end up filing bugs against f_templates

evgeni commented 4 years ago

you can check for a plugin by checking one of its resources: https://github.com/theforeman/foreman-ansible-modules/blob/744e3ba76b941a7253ae22815df1b4b6a48ce747/plugins/module_utils/foreman_helper.py#L69-L70

nesanton commented 4 years ago

from #705:

evgeni: I do wonder if we should split this in two modules, one for import, one for export, as the "direction" sounds weird to me.

@evgeni, this might be a way. I thought originally that there will be something like action: import/export/purge, then realized that purge is not in the plugin logic and also that you might want to delete templates with import/export direction too. So when the plugin learns how to delete items that are not in source, but are present in the destination - we'll just add a param `delete: bool = delete extraneous files from destination" ^^^ This does not contradict your idea of splitting. Export is very clumsy now - it spits everything out even if one file changed and such. Which even supports your idea better.

I'll limit the functionality to import only for now, and we'll see in the future if anyone is at all interested in exporting.

Do you want to adjust the name of the module?

evgeni commented 4 years ago

Yeah, if we split, I'd add _import and _export suffixes to the name.

nesanton commented 4 years ago

omg forman_template_sync_import - sounds confusing. My direction is not much worse. Maybe just foreman_template_import? What I like about the word "sync" - it suggests idempotency. But I'm ok without.

On the side, I'll start a list of good-to-have's for the plugin:

evgeni commented 4 years ago

Heh, I didn't look closely enough. Yeah, the sync in the name is then superfluous. f_template(s)_import or _export sounds good. Not sure about singular or plural.

nesanton commented 4 years ago

let's do plural to mimic the API URLs and to suggest the bulk nature and that no looping required