Skip to content

Ansible plugin using JetBrains MPS for technology-agnostic deployments

License

Notifications You must be signed in to change notification settings

UST-DeMAF/ansible-mps-plugin

Repository files navigation

ansible-mps-plugin

The ansible-mps-plugin is one of many plugins of the DeMAF project. It is designed to transform Ansible deployment models into an EDMM representation. The transformation rules are described in the TRANSFORMATION_RULES.md.

The plugin only works (without adaptions) in the context of the entire DeMAF application using the deployment-config. The documentation for setting up the entire DeMAF application locally is here.

Build and Run Application

You can run the application without the deployment-config, but it will not run as it needs to register itself at the analysis-manager.

If you want to boot it locally nevertheless use the following commands.

./mvnw spring-boot:run

or to use the built package:

./mvnw package
java -jar target/ansible-plugin-0.2.0-SNAPSHOT.jar

Init and Update Submodule

This plugin uses JetBrains MPS to facilitate the model-to-model transformation from Ansible to EDMM. The matching MPS project is located in another git repository and must be added as a submodule (you can also clone via https):

git submodule add git@github.com:UST-DeMAF/mps-transformation-ansible.git mps-transformation-ansible

To update the MPS application to a new version, execute:

git submodule update --remote

Ansible-Specific Configurations

This plugin has some minor specialities compared to other DeMAF transformation plugins:

  1. No directories: Ansible projects are created in a folder structure, where it is possible to have multiple overlapping main files. Therefore, it is not possible to scan directories, but always only one main file. Of course, matching subdirectories, e.g. for roles are possible to read.
  2. Host-file: If available one host.yaml can be read, but it must be in the same folder as the main.yaml and be named host.y(a)ml.
  3. Variable replacement: Ansible uses variables to create re-usable templates. Those variables are replaced with their values after parsing the files by the ansible-mps-plugin before handing it over to MPS.

Debugging

When running the project locally using e.g. IntelliJ IDEA or from the command-line, make sure that the plugin is not also running in a Docker container, launched by the deployment-config, otherwise the port is blocked.