ansible-middleware / ansible-middleware/wildfly

Allow for installing/enabling JBoss EAP XP (Microprofile Extensions)

Aperta
#159 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement good first issue hacktoberfest
Lingua principale
Jinja
Stelle
16
Fork
29
Merge medio
3g 11h
PR unite (30g)
7

Descrizione

##### SUMMARY
It would be useful if the wildfly_install/eap_install could also install the XP extensions and enable them

Here's an example I have used to do this:

```yaml
- name: Retrieve XP manager jar download using JBoss Network API
redhat.runtimes_common.product_search:
client_id: "{{ rhn_username }}"
client_secret: "{{ rhn_password }}"
product_category: "appplatform.xp"
register: rhn_products
no_log: "{{ omit_rhn_output | default(true) }}"
delegate_to: localhost
run_once: yes
tags:
- eap_xp
when:
- eap_xp_install | bool

- name: "Determine XP manager jar from search results."
ansible.builtin.set_fact:
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_path', 'match', '[^/]*/jboss-eap-xp-' + eap_xp_version + '-manager.jar$') }}"
delegate_to: localhost
run_once: yes
tags:
- eap_xp
when: eap_xp_install | bool

- name: Debug XP manager jar
ansible.builtin.debug:
msg: "Search Results: {{ rhn_products.results }}"
delegate_to: localhost
run_once: yes
tags:
- eap_xp
when: eap_xp_install | bool

- name: Download XP manager jar
redhat.runtimes_common.product_download: # noqa risky-file-permissions delegated, uses controller host user
client_id: "{{ rhn_username }}"
client_secret: "{{ rhn_password }}"
product_id: "{{ (rhn_filtered_products | last).id }}"
dest: "/tmp/jboss-eap-xp-manager.jar"
no_log: "{{ omit_rhn_output | default(true) }}"
delegate_to: localhost
run_once: yes
tags:
- eap_xp
when: eap_xp_install | bool

- name: "Determine XP patch zip from search results."
ansible.builtin.set_fact:
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_path', 'match', '[^/]*/jboss-eap-xp.*-patch.zip$') }}"
delegate_to: localhost
run_once: yes
tags:
- eap_xp
when: eap_xp_install | bool

- name: Download XP patch zip
redhat.runtimes_common.product_download: # noqa risky-file-permissions delegated, uses controller host user
client_id: "{{ rhn_username }}"
client_secret: "{{ rhn_password }}"
product_id: "{{ (rhn_filtered_products | last).id }}"
dest: "/tmp/jboss-eap-xp-patch.zip"
no_log: "{{ omit_rhn_output | default(true) }}"
delegate_to: localhost
run_once: yes
tags:
- eap_xp
when: eap_xp_install | bool

- name: Copy EAP XP Manager To Target
ansible.builtin.copy:
src: "{{ eap_xp_manager_local_file | default('/tmp/jboss-eap-xp-manager.jar') }}"
dest: "{{ eap_xp_manager_local_file | default('/tmp/jboss-eap-xp-manager.jar') }}"
owner: "{{ eap_user }}"
group: "{{ eap_group }}"
mode: 755
tags:
- eap_xp
when: eap_xp_install | bool

- name: Copy EAP XP Patch To Target
ansible.builtin.copy:
src: "{{ eap_xp_patch_local_file | default('/tmp/jboss-eap-xp-patch.zip') }}"
dest: "{{ eap_xp_patch_local_file | default('/tmp/jboss-eap-xp-patch.zip') }}"
owner: "{{ eap_user }}"
group: "{{ eap_group }}"
mode: 755
tags:
- eap_xp
when: eap_xp_install | bool

- name: Check EAP XP Status
ansible.builtin.shell:
cmd: "java -jar {{ eap_xp_manager_local_file | default('/tmp/jboss-eap-xp-manager.jar') }} status --jboss-home={{ eap_install_workdir }}/jboss-eap-7.4 | grep 'Available commands' | awk -F':' '{print $2}'"
register: eap_xp_status
tags:
- eap_xp
when: eap_xp_install | bool

- name: Debug XP Manager Status
ansible.builtin.debug:
msg: "XP Manager Status: {{ eap_xp_status }}"
verbosity: 0
tags:
- eap_xp
when: eap_xp_install | bool

- name: Run EAP XP setup if needed
ansible.builtin.shell:
cmd: "java -jar {{ eap_xp_manager_local_file | default('/tmp/jboss-eap-xp-manager.jar') }} setup --jboss-home={{ eap_install_workdir }}/jboss-eap-7.4 --accept-support-policy"
tags:
- eap_xp
when:
- eap_xp_install | bool
- eap_xp_status.stdout is search('setup')

- name: Install EAP XP Extension
ansible.builtin.shell:
cmd: "java -jar {{ eap_xp_manager_local_file | default('/tmp/jboss-eap-xp-manager.jar') }} patch-apply --jboss-home={{ eap_install_workdir }}/jboss-eap-7.4 --patch={{ eap_xp_patch_local_file | default('/tmp/jboss-eap-xp-patch.zip') }}"
tags:
- eap_xp
when:
- eap_xp_install | bool
- eap_xp_status.stdout is search('patch-apply')
notify: Restart JBoss EAP
```

##### ISSUE TYPE
- Feature Idea

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.