hussainarslan / proj-hnr-assignment3

0 stars 0 forks source link

Reusability #6

Closed hussainarslan closed 1 year ago

hussainarslan commented 1 year ago

What is it? Reusability is the use of existing assets in some form within the software product development process. These assets are products and by-products of the software development life cycle and include code, software components, test suites, designs and documentation. The opposite concept of reusability is leverage, which modifies existing assets as needed to meet specific system requirements.

Ansible Ansible has implemented reusability in a very intuitive and effective way. Ansible offers two ways to reuse files and roles in a playbook: dynamic and static. Ansible offers four distributed, reusable artefact: variable files, task files, playbooks, and roles.

A variables file contains only variables. A task file contains only tasks. A playbook contains at least one play, and may contain variables, tasks, and other content. You can reuse tightly focused playbooks, but you can only reuse them statically, not dynamically. A role contains a set of related tasks, variables, defaults, handlers, and even modules or other plugins in a defined fil-tree. Unlike variable files, task files, or playbooks, roles can be easily uploaded and shared through Ansible Galaxy.

In ansible, you can even incorporate multiple playbooks into a main playbook. However, you can only use imports to reuse playbooks. Importing incorporates playbooks in other playbooks statically. Ansible runs the plays and tasks in each imported playbook in the order they are listed, just as if they had been defined directly in the main playbook.