rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
330 stars 100 forks source link

Add a field to set the path to the Ansible binaries directory #288

Closed pierrecarre closed 2 years ago

pierrecarre commented 3 years ago

Hi all,

I made this PR to resolve the issue #51, and be able to choose the version of Ansible used by a job.

The proposed change is to add an optional variable Ansible binaries directory path to set the path to a specific version of Ansible (e.g. installed within a virtualenv). This variable is then used by the AnsibleRunner to build the command line that is runned by the plugin. This change is made in a backward compatible way, and you can let this field empty to keep the current behavior (i.e. use Ansible binaries from the PATH).

I updated the Dockerfile to use a more recent version of Ansible (2.9), and installed another version of Ansible (2.10) in a virtualenv.

Also, I added a docker-compose file, a Dockerfile-ssh-node file (with priv/pub SSH keys) to make the local testing easier.

Thanks & feel free to comment

Leopol35 commented 3 years ago

Hello Pierre, i am very interested with this PR. I succeed to build from your PR the new plugin version using "gradle clean build". I install the new plugin (snapshot version) but "ansible-binaries-dir-path" doesn't not display when I add a task with ansible_module. Do i do something wrong? Thanks for your help. Regards

pierrecarre commented 3 years ago

Hello @Leopol35, depending on the way you run your Rundeck, and the version you use, a version of rundeck-ansible-plugin could be already provided in rundeck.war. That's why I did some modifications on the Dockerfile, to be able to load the right version of the plugin (here: https://github.com/Batix/rundeck-ansible-plugin/pull/288/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R50).

Leopol35 commented 3 years ago

Hello @pierrecarre,

I am running Rundeck from binaries installed on a virtual machine not from Docker. I create the ansible-plugin-SNAPSHOT.jar using "gradle build" from your forck then I upload the jar file to my rundeck server in plugin folder, eq to "COPY --chown=rundeck:rundeck build/libs/ansible-plugin-*.jar ${RDECK_BASE}/libext/" in your Dockerfile. I remove the old ansible-plugin version 3.1.1. But no change. "3.1.1 jar" plugin and your jar haven't the same size (yours is a little bigger) but no new properties when adding a job in rundeck. I will check again next friday. Thanks for your work, using venv for ansible in rundeck should be great!!

Leopol35 commented 3 years ago

Hello @pierrecarre ,

I uninstall and reinstall properly the plugin, and all is working now. I am able to use ansible binaries installed in a venv. Thanks for your job!!

pierrecarre commented 3 years ago

Hello @Leopol35,

Pleased to hear this is working for you, thanks for your feedback !

frozenice commented 3 years ago

Hi @pierrecarre,

I invited you as a collaborator. Feel free to merge and release a new version. ;) Also, feel free to merge other PRs.

hfinucane commented 2 years ago

Who are the reviewers who would need to review this?

holynakamoto commented 2 years ago

Who are the reviewers who would need to review this?

@pierrecarre @frozenice can you review and merge? Thank you much https://groups.google.com/g/rundeck-discuss/c/HcsfKGFvk0k

holynakamoto commented 2 years ago

@Leopol35 I got this working had to fetch the commit and rebuild

ltamaster commented 2 years ago

moved to https://github.com/rundeck-plugins/ansible-plugin/pull/315