Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 8.4.8 / 15.0.2 and remove deprecated configs #44

Merged
merged 3 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ rules:
commas:
max-spaces-after: -1
level: error
comments: disable
comments:
min-spaces-from-content: 1
comments-indentation: disable
document-start: disable
empty-lines:
Expand All @@ -30,4 +31,7 @@ rules:
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
truthy: disable
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
9 changes: 4 additions & 5 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
infinispan_caches:
- cache_xml: >
<local-cache name="teststaticcachexml" statistics="true">
<encoding media-type="application/x-protostream"/>
<encoding media-type="application/octet-stream"/>
</local-cache>
- cache_config:
name: configuredstaticcache
Expand All @@ -31,7 +31,7 @@
infinispan_caches:
- cache_xml: >
<local-cache name="teststaticcachexml" statistics="true">
<encoding media-type="application/x-protostream"/>
<encoding media-type="application/octet-stream"/>
</local-cache>
- cache_config:
name: configuredstaticcache
Expand All @@ -44,7 +44,7 @@
infinispan_deployer_password: "remembertochangeme"
infinispan_cache_xml: >
<local-cache name="testcachexml" statistics="true">
<encoding media-type="application/x-protostream"/>
<encoding media-type="application/octet-stream"/>
</local-cache>
- role: infinispan_cache
infinispan_deployer_user: "supervisor"
Expand Down Expand Up @@ -81,5 +81,4 @@
statistics: false
indexing: true
indexing_entities:
- org.infinispan.sample.Car
- book_sample.Book
- org.infinispan.server.configuration.AddressType
4 changes: 2 additions & 2 deletions playbooks/infinispan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
infinispan_jgroups_discovery: PING
infinispan_users: []
- role: infinispan_cache
infinispan_deployer_user: "supervisor"

Check warning on line 11 in playbooks/infinispan.yml

View workflow job for this annotation

GitHub Actions / ci / linter (3.11, 2.15)

var-naming[no-role-prefix]

Variables names from within roles should use infinispan_cache_ as a prefix. (vars: infinispan_deployer_user)
infinispan_deployer_password: "remembertochangeme"

Check warning on line 12 in playbooks/infinispan.yml

View workflow job for this annotation

GitHub Actions / ci / linter (3.11, 2.15)

var-naming[no-role-prefix]

Variables names from within roles should use infinispan_cache_ as a prefix. (vars: infinispan_deployer_password)
infinispan_cache_xml: >
<local-cache name="testcache" statistics="true">
<encoding media-type="application/x-protostream"/>
</local-cache>
<encoding media-type="application/octet-stream"/>
</local-cache>
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 @@ -6,24 +6,24 @@
- users | length > 0
quiet: true

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

Check warning on line 9 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/users.properties.j2
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 @@ -80,66 +83,66 @@
ansible.builtin.set_fact:
rpm_java_home: "/etc/alternatives/jre_{{ infinispan_jvm_package | regex_search('(?<=java-)[0-9.]+') }}"

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

Check warning on line 86 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: server.conf.j2
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:
schema_version: "{{ server_schema.files | first | regex_search('[0-9.]*(?=.xsd)') }}"

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

Check warning on line 112 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: "{{ infinispan.config.template }}"
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
Loading