|
| 1 | +--- |
| 2 | +- name: Download JWS 5.5 Documentation |
| 3 | + hosts: localhost |
| 4 | + gather_facts: no |
| 5 | + connection: local |
| 6 | + vars: |
| 7 | + client_id: ee77a54c-a8eb-4ced-a1a7-aba57cdcef4e |
| 8 | + client_secret: Eaa5rRFe7UM2xaGuWQtivNqbFgsiLvby |
| 9 | + #product_version: '7.10.1' |
| 10 | + product_version: '7.4' |
| 11 | + product_category: appplatform |
| 12 | + #product_category: core.service.rhsso |
| 13 | + #product_category: data.grid |
| 14 | + #prduct_category: jboss.amq.broker |
| 15 | + #product_type: DISTRIBUTION |
| 16 | + product_type: BUGFIX |
| 17 | + #producttype: SECURITY |
| 18 | + tasks: |
| 19 | + - name: Search EAP Product |
| 20 | + middleware_automation.common.product_search: |
| 21 | + client_id: "{{ client_id }}" |
| 22 | + client_secret: "{{ client_secret }}" |
| 23 | + product_version: "{{ product_version|default(omit) }}" |
| 24 | + product_type: "{{ product_type|default(omit) }}" |
| 25 | + product_category: "{{ product_category|default(omit) }}" |
| 26 | + #product_id: 104526 |
| 27 | + register: product_results |
| 28 | + |
| 29 | + - name: Filter install zipfile |
| 30 | + ansible.builtin.set_fact: |
| 31 | + #filtered_products: "{{ product_results.results | json_query('[?title==join(`\" \"`,[name,version])]') | list }}" |
| 32 | + #filtered_products: "{{ product_results.results | selectattr('file_path', 'equalto', 'JBEAP-7.4.9/jboss-eap-7.4.9-patch.zip') }}" |
| 33 | + #filtered_products: "{{ product_results.results | selectattr('file_path', 'equalto', 'rhsso-7.4.1/rh-sso-7.4.1-patch.zip') }}" |
| 34 | + #filtered_products: "{{ product_results.results | map(attribute='file_path') | map('regex_replace','[^/]*/jboss-eap-([0-9.]*)-patch.zip','\\1' ) | list }}" |
| 35 | + #filtered_products: "{{ product_results.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\\1' ) | list | unique }}" |
| 36 | + filtered_versions: "{{ product_results.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\\1' ) | list | unique }}" |
| 37 | + |
| 38 | + - name: Determine latest version |
| 39 | + set_fact: |
| 40 | + eap_latest_version: "{{ filtered_versions | community.general.version_sort | last }}" |
| 41 | + |
| 42 | + - name: Filter results |
| 43 | + ansible.builtin.set_fact: |
| 44 | + filtered_products: "{{ product_results.results | selectattr('file_path', 'match', '^[^/]*/jboss-eap-' + eap_latest_version + '-patch.zip$') | list }}" |
| 45 | + |
| 46 | + - name: Fail if more than 1 product exists in filtered list |
| 47 | + ansible.builtin.debug: |
| 48 | + var: filtered_products |
| 49 | + |
0 commit comments