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

fix: Fixes for new pcs and ansible #223

Merged

Conversation

tomjelinek
Copy link
Member

This makes the role work with the upcoming version of pcs and cluster stack in general.

It also addresses the removal of password_hash filter due to removal of passlib.

Do not try to configure a resource utilization when no utilization for
the resource is defined.
Fixes warning: conditional statements should not include jinja2
templating delimiters such as {{ }} or {% %}
@tomjelinek tomjelinek requested a review from richm as a code owner August 19, 2024 08:31
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.79%. Comparing base (06093e4) to head (7080069).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #223      +/-   ##
==========================================
+ Coverage   68.50%   76.79%   +8.28%     
==========================================
  Files           3        3              
  Lines         181      181              
  Branches        0       12      +12     
==========================================
+ Hits          124      139      +15     
+ Misses         57       42      -15     
Flag Coverage Δ
sanity 50.54% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tomjelinek
Copy link
Member Author

[citest]

Copy link
Collaborator

@spetrosi spetrosi left a comment

Choose a reason for hiding this comment

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

Thanks for removing dependency for password_hash

tasks/main.yml Outdated Show resolved Hide resolved
- name: Generate a password hash
# The arg `-6` means SHA512 based algorithms.
command:
cmd: >-
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to use cmd parameter here

      command: >-
        openssl passwd
          -6
          -salt {{ ansible_hostname.replace('-', 'x') }}
          {{ ha_cluster_hacluster_password | string }}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ansible supports providing the cmd parameter right with command, if cmd is the only parameter that you need to use.

@tomjelinek tomjelinek force-pushed the fixes-for-new-pcs-and-ansible branch from 0767b82 to 6aa7c7f Compare August 19, 2024 10:10
@tomjelinek
Copy link
Member Author

[citest]

@tomjelinek
Copy link
Member Author

Centos-8 fails with an error that looks like a CI issue to me:

TASK [List packages on the controller to see if OpenSSL is installed] **********
task path: /tmp/collections-1sG/ansible_collections/fedora/linux_system_roles/tests/ha_cluster/tasks/fixture_psks.yml:15
Monday 19 August 2024  06:43:32 -0400 (0:00:00.078)       0:00:02.210 ********* 
[WARNING]: Found "rpm" but Failed to import the required Python library (rpm)
on ip-10-31-46-26.us-east-1.aws.redhat.com's Python /usr/bin/python3.9. Please
read module documentation and install in the appropriate location. If the
required library is installed, but Ansible is using the wrong Python
interpreter, please consult the documentation on ansible_python_interpreter
fatal: [managed_node2 -> localhost]: FAILED! => {
    "changed": false
}

MSG:

Could not detect a supported package manager from the following list: ['rpm', 'apt', 'portage', 'pkg'], or the required Python library is not installed. Check warnings for details.

@spetrosi
Copy link
Collaborator

Right, let's ignore this and I will meanwhile look at the failure

tasks/main.yml Outdated Show resolved Hide resolved
tasks/main.yml Outdated Show resolved Hide resolved
- name: Set hacluster password
user:
name: hacluster
password: "{{ __ha_cluster_openssl_call_result.stdout }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
password: "{{ __ha_cluster_openssl_call_result.stdout }}"
password: "{{ __ha_cluster_openssl_call_result.stdout }}"
no_log: true

Copy link
Member Author

Choose a reason for hiding this comment

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

I can add no_log, but is it necessary? The password is not shown, the user module hides it even without no_log:

TASK [linux-system-roles.ha_cluster : Set hacluster password] ******************
changed: [localhost] => {
    "append": false,
    "changed": true,
    "comment": "cluster user",
    "group": 189,
    "home": "/var/lib/pacemaker",
    "move_home": false,
    "name": "hacluster",
    "password": "NOT_LOGGING_PASSWORD",
    "shell": "/sbin/nologin",
    "state": "present",
    "uid": 189
}

idevat and others added 2 commits August 20, 2024 10:05
The filter `password_hash` is going to be deprecated since Ansible 2.19.
This commit replaces the deprecated `password_hash` filter with CLI tool
`openssl passwd`.
@tomjelinek tomjelinek force-pushed the fixes-for-new-pcs-and-ansible branch from 6aa7c7f to 7080069 Compare August 20, 2024 11:05
@tomjelinek
Copy link
Member Author

[citest]

@richm
Copy link
Contributor

richm commented Aug 20, 2024

The CentOS-Stream-8|ansible-2.9 failures are not related to this PR.

@richm richm merged commit 0c318ff into linux-system-roles:main Aug 20, 2024
27 of 28 checks passed
@tomjelinek tomjelinek deleted the fixes-for-new-pcs-and-ansible branch August 20, 2024 14:51
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.

4 participants