IBM / ibm_zos_zosmf

Ansible collection to work with z/OS based on z/OS Management Facility (z/OSMF).
21 stars 14 forks source link

z/OSMF Roles as opposed to Modules? #55

Closed dakotaheyman-libertymutual closed 4 years ago

dakotaheyman-libertymutual commented 4 years ago

Hello,

As an avid Ansible user (and Mainframe Sysprog), I am very excited that IBM is working on Ansible content to interface with the mainframe. We're big z/OSMF users so this code seems like it could be a great fit. However, I was a little confused about your code structure.

Why are most of the z/OSMF functions (like zmf_job_complete) presented as YAML roles instead of Python modules? Having all the logic built into YAML makes it more confusing and harder to maintain than having a separate Python Module for it (as discussed here: https://www.ansible.com/blog/make-your-ansible-playbooks-flexible-maintainable-and-scalable). I looked at IBM's other Ansible Content (z/OS + IMS) and most of that code is in the module format. Other companies also tend to use Modules for API-driven functions (VMWare, JIRA, etc.)

Are there any plans down the line to convert roles like zmf_job_complete to a Python Module instead?

Thanks! Dakota Heyman

shreeji818 commented 4 years ago

Hello Dakota,

Glad to hear that you and your team are big z/OSMF users and you are enjoying Ansible support that IBM provided for z/OS. As you noticed most of the z/OSMF Ansible functions are provided as "roles" instead of python modules. Couple of reasons for that. First, z/OSMF has REST APIs that provide the functions needed by the community e.g. REST API for jobs, files, provisioning, workflows etc. All the platform specific logic is covered by z/OSMF code driven by this APIs. Ansible provides URI module that implements logic to drive REST API. So, there won't be a need for a separate z/OSMF Python module. Also, at this point we did not come across any need to provide logic in python modules for the various z/OSMF functions that can not be covered by simple yaml associated with the roles we provided.

If there is a use case that requires to provide module (for example, for workflow we had a use case and we provided python modules), we will certainly look at that.

Thank you for your feedback.

zosmf-Young commented 4 years ago

Hello Dakota,

As Hiren mentioned, the main reason why we provide roles for many z/OSMF functions is that z/OSMF REST APIs cover the most logic. Then in the role, we just need to use the Ansible URI module to drive the REST API and add some additional tasks to do the preparation work.

But just as you noticed, in the role "zmf_job_complete", we were trying to add more fancy functions, such as checking the maximum return code of the job and help to search some special keyword in the job's spool files. And those functions are implemented by tasks. That may be the reason why you feel confused about the role.

So back to your question, we currently are considering providing a separate module to cover the functions in the role "zmf_job_complete" and role "zmf_job_query".

Thank you for your feedback, if there is any other requirement, please let us know.

Young

dakotaheyman-libertymutual commented 4 years ago

I appreciate the comments! That makes sense, I understand letting the REST APIs handle the majority of the logic but since you're adding more functionality on top of that like you mentioned, I personally think it makes more sense in a separate python module. Regardless, I will keep an eye on all your guys' ansible work going forward! Thanks, Dakota Hyeman