Skip to content

Commit

Permalink
Parametrizing prospero got downstream conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Wildfly.org CI authored and rpelisse committed Dec 13, 2023
1 parent 8e605d4 commit b907f91
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 11 deletions.
4 changes: 2 additions & 2 deletions roles/wildfly_install/tasks/prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
- name: Validate credentials
ansible.builtin.assert:
that:
- (rhn_username is defined and eap_enable is defined and eap_enable) or not eap_enable is defined or not eap_enable or wildfly_offline_install
- (rhn_password is defined and eap_enable is defined and eap_enable) or not eap_enable is defined or not eap_enable or wildfly_offline_install
- (rhn_username is defined and eap_enable is defined and eap_enable) or not eap_enable is defined or not eap_enable or wildfly_offline_install or eap_install_use_prospero
- (rhn_password is defined and eap_enable is defined and eap_enable) or not eap_enable is defined or not eap_enable or wildfly_offline_install or eap_install_use_prospero
quiet: True
fail_msg: "Cannot install Red Hat Enterprise Application Platform without RHN credentials. Define rhn_username and rhn_password are defined or set eap_offline_install"

Expand Down
7 changes: 3 additions & 4 deletions roles/wildfly_prospero/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
wildfly_prospero_version: 1.2.0.Final
wildfly_version: 29.0.0.Final
wildfly_prospero_name: prospero
wildfly_prospero_install_dir: /opt/prospero
wildfly_prospero_profile_name: wildfly
ldfly_prospero_scenario_enable: True
wildfly_prospero_home: "/opt/prospero/prospero-{{ wildfly_prospero_version }}"
wildfly_install_workdir: '/opt/wildfly/'
wildfly_prospero_scenario_enable: True
wildfly_prospero_home: "{{ wildfly_prospero_install_dir }}/{{ wildfly_prospero_name }}-{{ wildfly_prospero_version }}"
wildfly_install_manifest_dir: "{{ wildfly_install_workdir }}/manifest"
wildfly_prospero_download_url: "https://github.com/wildfly-extras/prospero/releases/download/{{ wildfly_prospero_version }}/prospero-{{ wildfly_prospero_version }}.zip"
40 changes: 36 additions & 4 deletions roles/wildfly_prospero/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
group: "{{ wildfly_install.group }}"
owner: "{{ wildfly_install.user }}"
mode: '0640'
become: yes
when:
- not eap_enable is defined or not eap_enable

- name: "Generate Wildfly manifest"
ansible.builtin.template:
Expand All @@ -54,11 +57,35 @@
group: "{{ wildfly_install.group }}"
owner: "{{ wildfly_install.user }}"
mode: 0750
become: yes
when:
- not eap_enable is defined or not eap_enable

- name: Set install command arguments
block:
- name: Set default command arguments
ansible.builtin.set_fact:
prospero_command_args: ''
- name: Override repositories parameter
ansible.builtin.set_fact:
prospero_command_args: "{{ prospero_command_args }} --repositories {{ eap_prospero_override_repos }}"
when:
- eap_prospero_override_repos is defined
- name: Override provisioning manifest
ansible.builtin.set_fact:
prospero_command_args: "{{ prospero_command_args }} --manifest {{ wildfly_install_manifest_dir }}/wildfly-{{ wildfly_version }}-manifest.yaml"
when:
- not eap_enable is defined or not eap_enable
- name: Display prospero command arguments
ansible.builtin.debug:
var: prospero_command_args
when:
- wildfly_prospero_debug_enabled is defined and wildfly_prospero_debug_enabled

- name: "Run Prospero to install server in {{ wildfly_home }}."
ansible.builtin.include_tasks: run_cli.yml
vars:
wildfly_prospero_run_args: "install --dir {{ wildfly_home }} --profile {{ wildfly_prospero_profile_name }} --manifest {{ wildfly_install_manifest_dir }}/wildfly-{{ wildfly_version }}-manifest.yaml"
wildfly_prospero_run_args: "install --dir {{ wildfly_home }} --profile {{ wildfly_prospero_profile_name }} --accept-license-agreements {{ prospero_command_args }}"
when:
- not path_to_workdir.stat.exists

Expand All @@ -76,12 +103,16 @@
register: updates_available
ignore_errors: True
changed_when: False
when:
- wildfly_prospero_update is defined

- name: "Verify results from update query."
ansible.builtin.assert:
that:
- updates_available is defined and updates_available.rc is defined
quiet: True
when:
- wildfly_prospero_update is defined

- name: "Run prospero to update server in {{ wildfly_home }}."
ansible.builtin.include_tasks: run_cli.yml
Expand All @@ -96,7 +127,8 @@
ansible.builtin.file:
path: "{{ wildfly_home }}"
recurse: yes
owner: "{{ wildfly_install_user }}"
group: "{{ wildfly_install_group | default(wildfly_install_user) }}"
owner: "{{ wildfly_install.user }}"
group: "{{ wildfly_install.group | default(wildfly_install.user) }}"
become: yes
when:
- wildfly_install_user is defined
- wildfly_install.user is defined
2 changes: 1 addition & 1 deletion roles/wildfly_prospero/tasks/run_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

- name: "Run tool to install server in {{ wildfly_home }}."
ansible.builtin.command: >
{{ wildfly_prospero_home }}/bin/prospero.sh {{ wildfly_prospero_run_args }}
{{ wildfly_prospero_home }}/bin/{{ wildfly_prospero_name }}.sh {{ wildfly_prospero_run_args }}
register: prospero_run_results
become: true
changed_when: False # TODO: fix idempotency by parsing tool output
Expand Down

0 comments on commit b907f91

Please sign in to comment.