Skip to content

Commit

Permalink
Update to 15.0.2 / 8.4.8 + linter pass
Browse files Browse the repository at this point in the history
  • Loading branch information
guidograzioli committed May 17, 2024
1 parent 0a5b789 commit 3812262
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 69 deletions.
2 changes: 1 addition & 1 deletion roles/infinispan/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
infinispan_version: "14.0.21.Final"
infinispan_version: "15.0.2.Final"
infinispan_bundle: "infinispan-server-{{ infinispan_version }}.zip"
infinispan_download_url: "https://downloads.jboss.org/infinispan/{{ infinispan_version }}/{{ infinispan_bundle }}"
infinispan_dest: /opt/infinispan
Expand Down
4 changes: 2 additions & 2 deletions roles/infinispan/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ argument_specs:
description: "Ensure firewalld is running and configure infinispan/datagrid ports"
type: "bool"
infinispan_version:
default: "14.0.19.Final"
default: "15.0.2.Final"
description: "Infinispan version to install"
type: "str"
infinispan_bundle:
Expand Down Expand Up @@ -203,7 +203,7 @@ argument_specs:
downstream:
options:
data_grid_version:
default: "8.4.6"
default: "8.4.8"
description: "Red Hat Data Grid version to install"
type: "str"
data_grid_installation_path:
Expand Down
9 changes: 5 additions & 4 deletions roles/infinispan/tasks/fastpackages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
- name: "Check if packages are already installed" # noqa command-instead-of-module this runs faster
ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}"
register: rpm_info
changed_when: False
failed_when: False
changed_when: false
failed_when: false

- name: "Add missing packages to the yum install list"
ansible.builtin.set_fact:
packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | default([]) | flatten }}"
packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | \
map('regex_findall', 'package (.+) is not installed$') | default([]) | flatten }}"

- name: "Install packages: {{ packages_to_install }}"
become: True
become: true
ansible.builtin.yum:
name: "{{ packages_to_install }}"
state: present
Expand Down
6 changes: 3 additions & 3 deletions roles/infinispan/tasks/firewalld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
- firewalld

- name: Enable and start the firewalld service
become: yes
become: true
ansible.builtin.systemd:
name: firewalld
enabled: yes
enabled: true
state: started

- name: "Configure firewall for {{ infinispan.name }} ports"
become: yes
become: true
ansible.posix.firewalld:
port: "{{ item }}"
permanent: true
Expand Down
38 changes: 19 additions & 19 deletions roles/infinispan/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
name: "{{ infinispan.group.name }}"
state: present
gid: "{{ infinispan.group.id | default(omit) }}"
become: yes
become: true

- name: "Create user {{ infinispan.user.name }}"
ansible.builtin.user:
name: "{{ infinispan.user.name }}"
state: present
uid: "{{ infinispan.user.id | default(omit) }}"
become: yes
become: true

- name: "Create download directory"
ansible.builtin.file:
path: "{{ infinispan_app_download_dir }}"
state: directory
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0750
become: yes
mode: '0750'
become: true

## check remote archive
- name: Set download archive path
Expand All @@ -31,7 +31,7 @@
ansible.builtin.stat:
path: "{{ archive }}"
register: archive_path
become: yes
become: true

- name: Check local download archive path
ansible.builtin.stat:
Expand All @@ -44,7 +44,7 @@
ansible.builtin.get_url: # noqa risky-file-permissions delegated, uses controller host user
url: "{{ infinispan_download_url }}"
dest: "{{ local_path.stat.path }}/{{ infinispan.bundle }}"
mode: 0644
mode: '0644'
delegate_to: localhost
when:
- archive_path is defined
Expand All @@ -55,7 +55,7 @@

- name: Download Red Hat Data Grid from RHN using JBoss Network API
delegate_to: localhost
run_once: yes
run_once: true
when:
- archive_path is defined
- archive_path.stat is defined
Expand All @@ -73,13 +73,13 @@
product_category: "{{ data_grid_product_category }}"
register: rhn_products
delegate_to: localhost
run_once: yes
run_once: true

- name: Determine install zipfile from search results
ansible.builtin.set_fact:
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_path', 'match', '.*/redhat-datagrid-' + data_grid_version + '-server.zip') }}"
delegate_to: localhost
run_once: yes
run_once: true

- name: Download Data Grid
middleware_automation.common.product_download:
Expand All @@ -89,13 +89,13 @@
dest: "{{ local_path.stat.path }}/{{ infinispan.bundle }}"
no_log: "{{ omit_rhn_output | default(true) }}"
delegate_to: localhost
run_once: yes
run_once: true

- name: Download Data Grid archive from alternate location
ansible.builtin.get_url: # noqa risky-file-permissions delegated, uses controller host user
url: "{{ infinispan_download_url }}"
dest: "{{ local_path.stat.path }}/{{ infinispan.bundle }}"
mode: 0644
mode: '0644'
delegate_to: localhost
when:
- jdg_download_url is defined and jdg_download_url | length > 0
Expand All @@ -120,37 +120,37 @@
dest: "{{ archive }}"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0640
mode: '0640'
register: new_version_downloaded
when:
- local_archive_path.stat is defined
- local_archive_path.stat.exists
become: yes
become: true

- name: "Check target directory: {{ infinispan.installation_path }}"
ansible.builtin.stat:
path: "{{ infinispan.installation_path }}/bin"
register: path_to_workdir
become: yes
become: true

- name: "Create target directory {{ infinispan.installation_path | dirname }}"
ansible.builtin.file:
state: directory
path: "{{ infinispan.installation_path | dirname }}"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0750
become: yes
mode: '0750'
become: true

- name: "Extract {{ infinispan.name }} archive on target {{ infinispan.installation_path }}"

Check warning on line 145 in roles/infinispan/tasks/install.yml

View workflow job for this annotation

GitHub Actions / ci / linter (3.11, 2.15)

name[casing]

Task notify 'restart infinispan' should start with an uppercase letter.
ansible.builtin.unarchive:
remote_src: yes
remote_src: true
src: "{{ archive }}"
dest: "{{ infinispan.installation_path | dirname | dirname }}"
creates: "{{ infinispan.installation_path }}/bin"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
become: yes
become: true
when:
- new_version_downloaded.changed or not path_to_workdir.stat.exists
notify:
Expand All @@ -168,5 +168,5 @@
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
recurse: true
become: yes
become: true
changed_when: false
8 changes: 4 additions & 4 deletions roles/infinispan/tasks/jdg_user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
dest: "{{ infinispan.home }}/server/conf/{{ infinispan.config.users }}"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0644
mode: '0644'
notify:
- restart infinispan
become: yes
become: true

- name: "Ensure {{ infinispan.config.groups }} exists"

Check warning on line 20 in roles/infinispan/tasks/jdg_user.yml

View workflow job for this annotation

GitHub Actions / ci / linter (3.11, 2.15)

name[casing]

Task notify 'restart infinispan' should start with an uppercase letter.
ansible.builtin.template:
src: templates/groups.properties.j2
dest: "{{ infinispan.home }}/server/conf/{{ infinispan.config.groups }}"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0644
mode: '0644'
notify:
- restart infinispan
become: yes
become: true
35 changes: 19 additions & 16 deletions roles/infinispan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
loop: "{{ ansible_play_batch }}"
vars:
host_iface: "{{ 'ansible_' + infinispan_jgroups_iface }}"
host_address: "{{ hostvars[item][host_iface]['address'] | default(hostvars[item][host_iface]['ipv4']['address'] | default(hostvars[item]['ansible_host'])) }}"
host_address: "{{ hostvars[item][host_iface]['address'] | \
default(hostvars[item][host_iface]['ipv4']['address'] | \
default(hostvars[item]['ansible_host']) | \
default(hostvars[item]['inventory_hostname_short'])) }}"
host_port: "{{ (((infinispan_jgroups_port | int + infinispan_port_offset | int) | abs) | string) }}"
host_site: "{{ hostvars[item]['infinispan_jgroups_relay_site'] | default(infinispan_jgroups_relay_site) if infinispan_jgroups_relay else '' }}"
when:
Expand All @@ -86,21 +89,21 @@
dest: "{{ infinispan.home }}/bin/server.conf"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0644
backup: yes
mode: '0644'
backup: true
vars:
jdg_rpm_java_home: "{{ rpm_java_home }}"
notify:
- restart infinispan
become: yes
become: true

- name: "Get xsd schema versions"
ansible.builtin.find:
paths: "{{ infinispan.home }}/docs/schema/"
use_regex: yes
use_regex: true
patterns: ['^.*-server-[0-9.]*[.]xsd$']
register: server_schema
become: yes
become: true

- name: "Set fetched schema version for template"
ansible.builtin.set_fact:
Expand All @@ -112,34 +115,34 @@
dest: "{{ infinispan.home }}/server/conf/{{ infinispan.config.name }}"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0644
backup: yes
mode: '0644'
backup: true
notify:
- restart infinispan
become: yes
become: true

- name: "Ensure {{ infinispan.service.name }} log4j2 configuration is deployed"

Check warning on line 124 in roles/infinispan/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ci / linter (3.11, 2.15)

name[casing]

Task notify 'restart infinispan' should start with an uppercase letter.
ansible.builtin.template:
src: log4j2.xml.j2
dest: "{{ infinispan.home }}/server/conf/log4j2.xml"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0644
backup: yes
mode: '0644'
backup: true
notify:
- restart infinispan
become: yes
become: true

- name: Download database driver jar to target
ansible.builtin.get_url:
url: "{{ infinispan_jgroups_jdbc[infinispan_jdbc_engine].driver_jar_url }}"
dest: "{{ infinispan.home }}/lib/{{ infinispan_jgroups_jdbc[infinispan_jdbc_engine].driver_jar_filename }}"
owner: "{{ infinispan.user.name }}"
group: "{{ infinispan.group.name }}"
mode: 0644
mode: '0644'
when:
- infinispan_jgroups_discovery == 'JDBC_PING'
become: yes
become: true

- name: Include users tasks
ansible.builtin.include_tasks: jdg_user.yml
Expand All @@ -151,7 +154,7 @@

- name: "Ensure {{ infinispan.service.name }} service is running and enabled (first node)"
ansible.builtin.include_tasks: start.yml
run_once: yes
run_once: true
when: infinispan_jgroups_discovery == 'JDBC_PING' or infinispan_keycloak_persistence

- name: "Ensure {{ infinispan.service.name }} service is running and enabled (all nodes)"
Expand All @@ -163,4 +166,4 @@
src: "{{ infinispan.home }}server/log"
dest: "/var/log/infinispan{{ '-' + infinispan_nodename if infinispan_nodename != inventory_hostname else '' }}"
force: true
become: yes
become: true
4 changes: 2 additions & 2 deletions roles/infinispan/tasks/prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
that:
- (rhn_username is defined and data_grid_enable is defined and data_grid_enable) or not data_grid_enable is defined or not data_grid_enable or infinispan_offline_install
- (rhn_password is defined and data_grid_enable is defined and data_grid_enable) or not data_grid_enable is defined or not data_grid_enable or infinispan_offline_install
quiet: True
quiet: true
fail_msg: "Cannot install {{ infinispan.name }} without RHN credentials. Check rhn_username and rhn_password are defined"
success_msg: "Installing {{ infinispan_service_desc }}"

- name: Validate admin console password
ansible.builtin.assert:
that:
- infinispan_supervisor_password | length > 12
quiet: True
quiet: true
fail_msg: "The console administrator password is empty or invalid. Please set the infinispan_supervisor_password variable to a 12+ char long string"
success_msg: "{{ 'Console administrator password OK' }}"

Expand Down
2 changes: 1 addition & 1 deletion roles/infinispan/tasks/query_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
method: "{{ method }}"
user: "{{ jdg_username | default(omit) }}"
password: "{{ jdg_password | default(omit) }}"
force_basic_auth: yes
force_basic_auth: true
status_code: 200
4 changes: 2 additions & 2 deletions roles/infinispan/tasks/restart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
ansible.builtin.systemd:
name: "{{ infinispan.service.unit_file }}"
state: restarted
become: yes
become: true
- name: "Wait for used port to be open"
ansible.builtin.wait_for:
port: "{{ infinispan.port }}"
delay: 0
when:
- infinispan_healthcheck
become: yes
become: true
6 changes: 3 additions & 3 deletions roles/infinispan/tasks/start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
ansible.builtin.systemd:
name: "{{ infinispan.service.unit_file }}"
state: started
enabled: yes
become: yes
enabled: true
become: true
- name: "Wait for used port to be open"
ansible.builtin.wait_for:
port: "{{ infinispan.port }}"
delay: 0
when:
- infinispan_healthcheck
become: yes
become: true
8 changes: 4 additions & 4 deletions roles/infinispan/tasks/systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
dest: "{{ infinispan.service.unit_dir }}/{{ infinispan.service.unit_file }}.service"
owner: root
group: root
mode: 0644
become: yes
mode: '0644'
become: true
register: ispn_daemon_reload
notify:
- restart infinispan

- name: "Perform daemon-reload to ensure the changes on {{ infinispan.service.name }} service are picked up"
ansible.builtin.systemd:
daemon_reload: yes
daemon_reload: true
when:
- ispn_daemon_reload is defined
- ispn_daemon_reload.changed
become: yes
become: true
Loading

0 comments on commit 3812262

Please sign in to comment.