Skip to content

Commit

Permalink
lint: for a fistful of fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rpelisse committed Sep 11, 2024
1 parent 528c0a0 commit 5b02142
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 36 deletions.
9 changes: 5 additions & 4 deletions roles/wildfly_install/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ argument_specs:
description: "Enable install of Red Hat JBoss EAP"
type: "bool"
eap_install_use_prospero:
default: "{{ (eap_version is version('8.0.0', '>=', strict=true)) | ternary(true,false) }}"
description:
default: "{{ (eap_version is version('8.0.0', '>=', strict=true)) | ternary(true, false) }}"
description: "Whether or not installation should use JBoss Installation Manager"
type: "str"
eap_apply_cp:
default: "{{ (eap_version is version('8.0.0', '>=', strict=true)) | ternary(false,true) }}"
default: "{{ (eap_version is version('8.0.0', '>=', strict=true)) | ternary(false, true) }}"
description: "Whether to apply the latest cumulative patch on top of baseline version"
type: "bool"
eap_version:
Expand Down Expand Up @@ -139,7 +140,7 @@ argument_specs:
description: "Specifiy if Ansible should skip the check that the provided OpenJDK version is supported for the EAP server used."
type: bool
eap_supported_configuration:
type: struct
type: json
description: "Supported OpenJDK and RHEL version for EAP"
default:
eap7:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

- name: "Determine supported configurations for EAP {{ eap_version }}"
ansible.builtin.set_fact:
supported_configuration: "{{ eap_supported_configuration['eap' + eap_version[:1] ] }}"
supported_configuration: "{{ eap_supported_configuration['eap' + eap_version[:1]] }}"

- name: "Ensure target RHEL version is supported: {{ supported_configuration.rhel }}"
ansible.builtin.assert:
Expand Down
4 changes: 2 additions & 2 deletions roles/wildfly_install/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
become: true

- name: Perform installation
when:
- not wildfly_install.rpm is defined
block:
- name: "Check target archive: {{ full_path_to_archive }}"
ansible.builtin.stat:
Expand Down Expand Up @@ -115,8 +117,6 @@
msg: "{{ wildfly_install.home }} already exists and version unchanged, skipping decompression"
when:
- not new_version_downloaded.changed and path_to_workdir.stat.exists
when:
- not wildfly_install.rpm is defined

- name: "Read information on server home directory: {{ wildfly_install.home }}"
ansible.builtin.stat:
Expand Down
4 changes: 2 additions & 2 deletions roles/wildfly_install/tasks/prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@

- name: "Add JDK package {{ wildfly_install.java.package_name }} to packages list"
ansible.builtin.set_fact:
wildfly_prereqs_packages: "{{ wildfly_prereqs_packages + [ wildfly_install.java.package_name ] }}"
wildfly_prereqs_packages: "{{ wildfly_prereqs_packages + [wildfly_install.java.package_name] }}"
when:
- wildfly_install.java is defined
- wildfly_install.java.package_name is defined
- wildfly_install.java.package_name | length > 0

- name: "Add selinux package {{ wildfly_install.java.package_name }} to packages list"
ansible.builtin.set_fact:
wildfly_prereqs_packages: "{{ wildfly_prereqs_packages + [ 'policycoreutils' ] }}"
wildfly_prereqs_packages: "{{ wildfly_prereqs_packages + ['policycoreutils'] }}"
when:
- wildfly_selinux_enabled

Expand Down
16 changes: 7 additions & 9 deletions roles/wildfly_subs/tasks/disable_repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
fail_msg: "Missing required parameters"

- name: "Uninstall group package"
when:
- wildfly_subs is defined
- wildfly_subs.skip_group_remove is defined
- not wildfly_subs.skip_group_remove
block:

- name: "Ensure group package {{ eap_group_install_name }} is removed"
Expand All @@ -24,12 +28,11 @@
- wildfly_subs.remove_root_dir is defined
- wildfly_subs.remove_root_dir

- name: "Disable repository"
when:
- wildfly_subs is defined
- wildfly_subs.skip_group_remove is defined
- not wildfly_subs.skip_group_remove

- name: "Disable repository"
- wildfly_subs.check_repo_disabled is defined
- wildfly_subs.check_repo_disabled
block:
- name: "Check that required parameters are provided"
ansible.builtin.assert:
Expand All @@ -50,8 +53,3 @@
- name: "Ensure JBoss EAP {{ eap_version }} repos are disabled."
ansible.builtin.command: "subscription-manager repos --disable={{ eap_repos_name }}"
changed_when: False

when:
- wildfly_subs is defined
- wildfly_subs.check_repo_disabled is defined
- wildfly_subs.check_repo_disabled
7 changes: 3 additions & 4 deletions roles/wildfly_subs/tasks/enable_repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
- not eap_repo_state_file is defined

- name: "Enable repository."
when:
- installed_eap_source is defined
- installed_eap_source
block:
- name: "Ensure JBoss repos for {{ eap_version }} are enabled."
ansible.builtin.command: "subscription-manager repos --enable={{ eap_repo_name }}"
Expand All @@ -47,7 +50,3 @@
ansible.builtin.command: "dnf groupinstall -y {{ eap_group_install_name }}"
args:
creates: /opt/rh/eap7/

when:
- installed_eap_source is defined
- installed_eap_source
3 changes: 1 addition & 2 deletions roles/wildfly_systemd/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ wildfly_service_config_file_template: 'templates/wfly.conf.j2'
wildfly_service_config_file_location: '/etc/sysconfig'

wildfly_service_systemd_env_file: "{{ wildfly_service_config_file_location }}/{{ wildfly_service_name }}{{ wildfly_systemd_conf_file_suffix }}"
wildfly_service_systemd_file: "{{ wildfly_systemd_service_config_location}}/{{ wildfly_service_name }}{{ wildfly_systemd_service_config_file_suffix }}"

wildfly_service_systemd_file: "{{ wildfly_systemd_service_config_location }}/{{ wildfly_service_name }}{{ wildfly_systemd_service_config_file_suffix }}"
wildfly_enable_yml_config: false
wildfly_yml_configs: []
wildfly_yml_configs_repository:
Expand Down
6 changes: 2 additions & 4 deletions roles/wildfly_systemd/tasks/systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@
register: daemon_reload_env
vars:
wildfly_rpm_java_home: "{{ rpm_java_home if ansible_os_family == 'RedHat' else rpm_java_home_other.stdout }}"
wildfly_yml_configs_str: "'-y={{ wildfly_yml_configs | flatten | map('regex_replace', '.j2$', '')\
| map('regex_replace', '^', basedir + '/') | list | join(':') }}'"

wildfly_yml_configs_str: "'-y={{ wildfly_yml_configs | flatten | map('regex_replace', '.j2$', '') | map('regex_replace', '^', basedir + '/') | list | join(':') }}'"
- name: "Deploy Systemd unit for service: {{ wildfly_service_systemd_file }}"
ansible.builtin.template:
src: "{{ wildfly_systemd_service_config_file_template }}"
Expand All @@ -152,7 +150,7 @@
seuser: system_u
register: daemon_reload
vars:
jboss_cli_deploy_controller: "{{ wildfly_systemd_jboss_cli_controller_host }}:{{ (wildfly_systemd_jboss_cli_controller_port | default(9990) | int) +(wildfly_port_range_offset | int) }}"
jboss_cli_deploy_controller: "{{ wildfly_systemd_jboss_cli_controller_host }}:{{ (wildfly_systemd_jboss_cli_controller_port | default(9990) | int) + (wildfly_port_range_offset | int) }}"

- name: "Perform daemon-reload to ensure the changes are picked up"
ansible.builtin.systemd:
Expand Down
2 changes: 1 addition & 1 deletion roles/wildfly_utils/tasks/download_from_rhn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
client_id: "{{ rhn_username }}"
client_secret: "{{ rhn_password }}"
product_type: DISTRIBUTION
product_version: "{{ eap_version | regex_replace('([0-9]+)[.]([0-9]+)[.][0-9]+[.]?([A-Za-z]+)?', '\\1.\\2 \\3') }}"
product_version: "{{ eap_version | regex_replace('([0-9]+)[.]([0-9]+)[.][0-9]+[.]?([A-Za-z]+)?', '\\1.\\2 \\3') }}"
product_category: "{{ eap_product_category }}"
register: rhn_products
no_log: "{{ omit_rhn_output | default(true) }}"
Expand Down
6 changes: 3 additions & 3 deletions roles/wildfly_utils/tasks/keycloak_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
delegate_to: localhost

- name: "Check if JBoss Network API access is needed."
when:
- local_archive_path is defined and local_archive_path.stat is defined
- local_archive_path.stat.exists is defined and not local_archive_path.stat.exists
block:
- name: Retrieve product download using JBoss Network API
middleware_automation.common.product_search:
Expand Down Expand Up @@ -73,9 +76,6 @@
when:
- remote_archive_path is defined
- not remote_archive_path.stat.exists
when:
- local_archive_path is defined and local_archive_path.stat is defined
- local_archive_path.stat.exists is defined and not local_archive_path.stat.exists

- name: "Check downloaded archive: {{ patch_filename }}."
ansible.builtin.stat:
Expand Down
2 changes: 1 addition & 1 deletion roles/wildfly_validation/tasks/logfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
quiet: true

- name: "Slurp logfile {{ path_to_file }}"
become: "{{ wildfly_validation_logfile_require_privilege_escalation | default(true) }}"
become: "{{ wildfly_validation_logfile_require_privilege_escalation | default(true) }}"
ansible.builtin.slurp:
src: "{{ path_to_logfile }}"
register: slurped_logfile
Expand Down
2 changes: 1 addition & 1 deletion roles/wildfly_validation/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
ansible.builtin.include_tasks: logfile.yml
vars:
search_pattern: "{{ wildfly_validation_logfile_server_start_pattern }}"
path_to_logfile: "{{ wildfly_validation_logfile_path_to_logfile}}"
path_to_logfile: "{{ wildfly_validation_logfile_path_to_logfile }}"

- name: "Wait for HTTP port {{ wildfly_http_port }} to become available."
ansible.builtin.wait_for:
Expand Down
4 changes: 2 additions & 2 deletions roles/wildfly_validation/tasks/systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

- name: "Verify that PID file has been created."
become: "{{ wildfly_validation_systemd_pidfile_require_privilege_escalation }}"
when:
- wildfly_validation_systemd_pidfile is defined and wildfly_validation_systemd_pidfile | length > 0
block:
- name: "Load metadata on PIDFile: {{ wildfly_validation_systemd_pidfile }}"
ansible.builtin.stat:
Expand All @@ -30,5 +32,3 @@
- pidfile is defined and pidfile.stat is defined and pidfile.stat.exists is defined and pidfile.stat.exists
quiet: true
fail_msg: "PID file {{ wildfly_validation_systemd_pidfile }} has not been created."
when:
- wildfly_validation_systemd_pidfile is defined and wildfly_validation_systemd_pidfile | length > 0

0 comments on commit 5b02142

Please sign in to comment.