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

Almalinux - Incorrect Package selected for Pre-Reqs #220

Closed
mattd-krystal opened this issue Aug 22, 2024 · 2 comments
Closed

Almalinux - Incorrect Package selected for Pre-Reqs #220

mattd-krystal opened this issue Aug 22, 2024 · 2 comments

Comments

@mattd-krystal
Copy link
Contributor

Describe the bug
When attempting to deploy this role for our galera cluster on AlmaLinux 9, we recieve the following message:

FAILED! => {"changed": false, "failures": ["No package MySQL-python available."], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}

This is due to it selecting the default redhat.yml vars file which uses MySQL-python package which doesn't exist on AlmaLinux

To Reproduce

  1. Run the following command ansible-playbook install_galera.yml -CD

Using the following variable overrides

mariadb_version: "10.11"
galera_cluster_name: 'test-galera'
galera_cluster_bind_interface: 'internal'
mariadb_config_overrides:
  mariadb:
    performance_schema: 'ON'
    server_id: "{{ groups[galera_cluster_nodes_group].index(inventory_hostname) | int }}"
    binlog_format: 'ROW'
    innodb_autoinc_lock_mode: 2
    innodb_buffer_pool_size: "{{ (ansible_memory_mb.real.total//1024*0.5) | int | abs }}G"
    innodb_buffer_pool_instances: "{{ (ansible_memory_mb.real.total//1024*0.5) | int | abs }}"
    innodb_flush_log_at_trx_commit: 2
    innodb_flush_neighbors: 0
    innodb_log_file_size: '1G'
    max_connections: 3000
    open_files_limit: 131072
    skip_name_resolve: 'ON'
    sync_binlog: 1
    wait_timeout: 300
galera_cluster_nodes_group: 'test_db'
galera_mysql_first_node: 'test-db-01'

Expected behavior
Expect it to install the correct package for the selected OS, which is python3-mysqlclient

Ansible
Version: 2.17.1

Additional context
We have made a local fix by adding the following lines to the tasks/main.yml which seems to work, but we are not sure if this is the best way to go about fixing this problem

  with_first_found:
    - "{{ (ansible_distribution == 'AlmaLinux') | ternary('CentOS', ansible_distribution) | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
    - "{{ (ansible_distribution == 'AlmaLinux') | ternary('CentOS', ansible_distribution) | lower }}.yml"
    - "{{ ansible_os_family | lower }}.yml"
@mattd-krystal mattd-krystal changed the title Almalinux - Incorrect Package slected for Pre-Reqs Almalinux - Incorrect Package selected for Pre-Reqs Aug 22, 2024
@eRadical
Copy link
Collaborator

Hi @mattd-krystal,

I don't think you need ternary, you can leave it as is:

with_first_found:
    - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
    - "{{ ansible_distribution | lower }}.yml"
    - "{{ ansible_os_family | lower }}.yml"

and just add the file in vars/ folder.

While you're at it - please create a PR and I'll review it and merge it.

@eRadical
Copy link
Collaborator

Thank you @mattd-krystal!

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

No branches or pull requests

2 participants