Skip to content

Add Valkey support via new valkey role - #374

Closed
Amunagala-itential wants to merge 5 commits into
devfrom
add-valkey-support
Closed

Amunagala-itential wants to merge 5 commits into
devfrom
add-valkey-support

Conversation

@Amunagala-itential

Copy link
Copy Markdown
Contributor

Body:

Summary

Adds roles/valkey as a Remi-free, non-source-compiled alternative to
roles/redis, per the scoping/decision thread on
PE-1948:

  • Installed exclusively via the native EL9 AppStream package
    (dnf install valkey) — no Remi, no source compile, ever.
  • EL8 is explicitly unsupported. A host placed in valkey_master/
    valkey_replica/valkey_sentinel on EL8 fails validate-vars.yml
    immediately with a clear error, rather than silently falling back to
    EPEL8 or attempting a source build.
  • No role-level SELinux configuration. Confirmed via upstream
    fedora-selinux/selinux-policy's redis.fc: standard Valkey paths
    (/usr/bin/valkey-server, /etc/valkey, /var/lib/valkey,
    /var/log/valkey) are already file-context-equivalenced onto the
    existing redis_exec_t/redis_conf_t/redis_var_lib_t/
    redis_log_t types by the base OS policy — no custom types or .te
    module needed.
  • Wires playbooks/valkey.yml, verify_valkey.yml, certify_valkey.yml,
    and download_packages_valkey.yml in alongside the existing Redis
    playbooks in platform_site.yml, verify.yml, certify.yml, and
    download_packages_platform_site.yml (unconditional parallel imports —
    a play with zero matching hosts simply skips, so no branching logic
    is needed at the root-playbook level for engine selection).
  • Adds valkey/valkey_secondary to os.yml's host list.
  • Adds example_inventories/valkey/ and docs/valkey_guide.md.
  • Updates root CLAUDE.md and README.md so Valkey is discoverable
    alongside every existing Redis reference (playbook inventory, roles
    summary, TLS table, ports/firewall table, certificates table, a
    Valkey Accounts table, verify/certify examples, HA appendix).

"Dual support" concretely means: operator selects Redis or Valkey
per host group, with Valkey gated to EL9 only. Redis remains the only
option on EL8.

Test plan

All tested live in a 4-architecture AWS lab deployment (AIO, Minimal,
HA2, ASA) on Rocky 9.8:

  • ansible-lint roles/valkey clean at parity with roles/redis
    (warnings only, 0 failures)
  • Deployed successfully on all 4 architectures (12 hosts total)
  • verify_valkey.yml and certify_valkey.yml run clean
    (failed=0) on every host across all 4 architectures
  • SELinux enforcing on every host, zero AVC denials (full audit
    history, not just recent)
  • TLS handshake, ACL users, data read/write round-trip confirmed
  • Replication confirmed correct on HA2 and ASA (INFO replication
    roles, online state, low lag)
  • Live Sentinel failover tested on both HA2 (colocated
    sentinels) and ASA (dedicated sentinels across 3 DCs):
    automatic promotion (~9-13s), automatic replica re-pointing,
    data continuity across the failover, automatic rejoin-as-replica
    when the old master returns — no manual intervention in either
    case
  • Itential Platform connectivity confirmed in both single-node
    (AIO) and Sentinel-fronted (HA2) modes, including live
    confirmation that Platform's own ioredis client survived the
    HA2 failover test automatically (brief ~2s reconnect blip,
    self-healed, zero further errors)

Adds roles/valkey as a Remi-free, non-source-compiled alternative to
roles/redis, installed exclusively via the native EL9 AppStream package.
EL8 is explicitly unsupported and fails validate-vars with a clear error
rather than falling back to EPEL8 or a source build.

Wires in playbooks/valkey.yml, verify_valkey.yml, certify_valkey.yml, and
download_packages_valkey.yml alongside the existing Redis playbooks in
platform_site.yml, verify.yml, certify.yml, and
download_packages_platform_site.yml, plus adds valkey/valkey_secondary to
os.yml's host list. Also adds example_inventories/valkey and
docs/valkey_guide.md.

Verified against all 4 reference architectures (AIO, Minimal, HA2, ASA)
in a live AWS lab: clean verify_valkey.yml/certify_valkey.yml runs on
every host, live Sentinel failover tested on both HA2 (colocated
sentinels) and ASA (dedicated sentinels) with automatic promotion,
replica re-pointing, and old-master rejoin-as-replica, and confirmed
Itential Platform connects successfully in both single-node and
Sentinel-fronted modes.
Every other role carries an empty README.md alongside its CLAUDE.md;
roles/valkey was missing it.
The playbook inventory, roles summary, TLS overview, and docs index
tables documented Redis but were never updated when Valkey was added,
so Valkey was undiscoverable from the collection's own reference doc.
Mirrors every Redis section with a Valkey equivalent: overview bullet,
HA2/ASA architecture notes, required-repositories table (Valkey needs
none beyond the base OS's own AppStream repo), ports/firewall table,
certificates table, a Valkey Accounts table, verify/certify example
commands, a systemctl status example, the Component Guides link, and
an Appendix A "Highly Available Valkey" section. Root README.md had no
Valkey mentions at all despite the role being fully wired in.
Comment thread playbooks/verify_valkey.yml Outdated
gather_facts: true
become: true
tasks:
- name: Verify Valkey Installation # noqa run-once

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the # noqa run-once can be removed here since run-once is not on the task.

Comment thread playbooks/verify_valkey.yml Outdated
gather_facts: true
become: true
tasks:
- name: Verify Sentinel Installation # noqa run-once

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the # noqa run-once can be removed here since run-once is not on the task.

# The AppStream package creates /etc/valkey, /var/lib/valkey, /var/log/valkey and
# /usr/bin/valkey-server itself (with correct ownership and SELinux file contexts already
# applied by the base OS's selinux-policy), so unlike roles/redis (which also supports a
# from-source install with non-default paths), there is no directory-creation step here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the valkey RPM support relocate? If so, we may still have to run the SELinux stuff.

If it doesn't support relocate, then we will have to document that limitation. Some customers require installations in "non-standard" locations.

Comment on lines +4 to +7
- name: Validate distribution major version
ansible.builtin.assert:
that: ansible_distribution_major_version != "7"
msg: Download not supported for EL 7

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this task.

Comment thread roles/valkey/tasks/validate-vars.yml Outdated
Comment on lines +51 to +60
- name: Check for valid OS for Valkey installation
ansible.builtin.assert:
that:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version == '9'
fail_msg: >-
Deployer does not support installing Valkey on
{{ ansible_distribution }} {{ ansible_distribution_major_version | default('') }}.
Valkey is only supported on RHEL/Rocky/AlmaLinux 9, installed via the native
AppStream module. Use the redis role instead on EL8 or other platforms.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Valkey supported on AL2023?

Comment thread roles/valkey/CLAUDE.md Outdated
Comment on lines +72 to +75
## Design Decisions (PE-1948)

These are deliberate departures from a 1:1 mirror of `roles/redis`, decided during scoping —
see the PE-1948 Jira comment thread for the full research trail:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove references to PE-1948.

Comment thread README.md Outdated
| Redis | <https://dl.fedoraproject.org> | TCP | EPEL YUM RPMs<br>When installing Redis from the Remi repository |
| Redis | <https://github.com> | TCP | Redis source packages <br>When installing Redis from source |
| Redis | <https://codeload.github.com> | TCP | Redis source packages<br>When installing Redis from source |
| Valkey | n/a | n/a | No additional public repository required — Valkey installs via the native EL9 AppStream package, already part of the base OS's own repository set. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to document the repo URL even though it is the standard AppStream.

- Remove dead "# noqa run-once" comments in verify_valkey.yml (no
  run_once on either task)
- Remove the redundant EL7 check in validate-vars-offline.yml; fully
  subsumed by validate-vars.yml's stricter OS assert, which always runs
  first
- Add Amazon Linux 2023 support alongside EL9: AL2023 ships valkey
  natively via its own core repo (confirmed via AWS's ALAS advisories).
  Updates validate-vars.yml's OS assert, platform-release-6.yml's
  package map, and every "EL9 only" doc mention across CLAUDE.md,
  README.md, and docs/valkey_guide.md
- Document that Valkey install paths are not customizable: the RPM has
  no Prefix: tag and is not relocatable, unlike a from-source Redis
  install. Customers needing non-standard paths must use roles/redis
- Populate valkey_required_repositories with a real, checkable URL
  (Rocky/AlmaLinux AppStream mirror) instead of an empty list, and
  update README's Required Public Repositories table to match, noting
  that RHEL/AL2023 resolve their package source differently and aren't
  covered by this specific check
- Remove "(PE-1948)" ticket reference from roles/valkey/CLAUDE.md's
  Design Decisions heading
@Amunagala-itential

Copy link
Copy Markdown
Contributor Author

Addressed in ff3891e:

  • Removed the two dead # noqa run-once comments in verify_valkey.yml.
  • Removed the redundant EL7 check in validate-vars-offline.yml — fully subsumed by validate-vars.yml's stricter OS assert, which always runs first.
  • Relocate question: confirmed the Valkey RPM has no Prefix: tag and isn't relocatable (modern Fedora/RHEL packaging guidelines discourage this for system daemons in general). So no code change there, but documented the limitation explicitly in roles/valkey/CLAUDE.md, docs/valkey_guide.md, and README.md — customers needing non-standard install paths need roles/redis instead.
  • AL2023 question: confirmed AL2023 ships valkey natively via its own core repo (via AWS's ALAS advisories) — good catch, this was a real gap. Added it alongside EL9 in validate-vars.yml's OS assert and platform-release-6.yml's package map, and updated every "EL9 only" doc mention accordingly.
  • Removed "(PE-1948)" from roles/valkey/CLAUDE.md.
  • Populated valkey_required_repositories with a real, checkable URL (Rocky/AlmaLinux AppStream mirror) instead of an empty list, and updated the README table to match — noting that RHEL (subscription-manager CDN) and AL2023 (preconfigured core repo) aren't actually covered by that specific check since neither has a fixed public URL to verify.

@Amunagala-itential

Copy link
Copy Markdown
Contributor Author

Closing in favor of the standalone itential.valkey collection: https://github.com/itential/itential.valkey (PR: itential/itential.valkey#2). Valkey support will be developed there and merged into itential.deployer directly once roles/redis is retired, rather than living here in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants