mq-ansible icon indicating copy to clipboard operation
mq-ansible copied to clipboard

Simplify for loop/regex in `Linux_installmq.yml`

Open CharlieParker opened this issue 1 year ago • 5 comments

Discussed early on with @scottcurtis2605, the following Find required package files task is rather confusing:

https://github.com/ibm-messaging/mq-ansible/blob/7243a4a6c20768f8ebd261fc66853f1d00a13087/ansible_collections/ibm/ibmmq/roles/installmq/tasks/Linux_installmq.yml#L18-L60

I'd like to discuss this more, we're fairly sure it can be made cleaner but there might be something we're missing.

Initial Thoughts

  • find files in a certain directory or path /var/MQServer
  • On each iteration the patterns key will have a single value "{{ item }}"
  • What does package_files look like throughout this process? My understanding is it will be rewritten based on the register in every iteration

I think if the intention is to select only files that match a certain regex pattern, then this needs to be rethought.

Luckily it would be simplifying the code/process, I believe find and the following regex should be sufficient:

(?i)(?:.*runtime|gskit|server|java|jre|sdk|samples|man|client|amqp|ams|web|.*(-|_)es|.*(-|_)cn).*

CharlieParker avatar Jul 28 '23 17:07 CharlieParker