Refactor deploy_wildfly to use wildfly_systemd role provided by middleware_automation.jcliff collection#3
Conversation
…eware_automation.jcliff collection
| state: present | ||
|
|
||
| # Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content | ||
| - name: Download and Add WildFly distribution |
There was a problem hiding this comment.
@kahlai The download Wildfly part I did not change, but I think it needs a rehaul. First, I would not download and directly unzip into jboss_home. It's not idempotent and you need to download the archive every time you run the tasks, even if the content is already deployed.
I would move the download part into the pre_tasks: part of the playbook and save the archive in something like /opt/apps or /opt/artefacts. Then, inside the role, I would check that wildfy_archive is defined and if so unarchive: the zipfile into jboss_home.
There was a problem hiding this comment.
Also, the series of commands in shell: are a bit cluncky. If you have that many commands to run, I would move that into a proper Bash script that I would then run. I also think Ansible has mechanisms to check the sha1sum, decompress tar file and ensure jboss:jboss is the owner of the file.
We are doing just that in this playbook.
This refactoring removes a few operations that are already provided by the wildfly_systemd role coming with the middleware_automation.jcliff collection. I also removed the yum update part to place it into a separate role.
I've tested this changes locally, inside a Podman container, so you may need to tweak a bit for it to work on EC2.
Note: for this change to work, you need to install the collection first: