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

Deps for needs-restarting #14

Open
Tronde opened this issue Feb 10, 2022 · 2 comments
Open

Deps for needs-restarting #14

Tronde opened this issue Feb 10, 2022 · 2 comments
Assignees

Comments

@Tronde
Copy link
Owner

Tronde commented Feb 10, 2022

I would like to start this issue to a follow up on a comment from @Klaas-:

you can use needs-restarting, but it uses shell/command

- name: check if reboot is needed
  shell: "{{ needs_restarting_command[ansible_distribution_major_version | int] }}"
  failed_when: False
  register: needs_restarting
  changed_when: False

definition of the var

needs_restarting_command:
  7: /usr/bin/needs-restarting -r
  8: /usr/bin/dnf needs-restarting -r

usage in the reboot task:
when: needs_restarting.rc is defined and needs_restarting.rc != 0

on rhel7 deps are yum-utils, on rhel8 python3-dnf-plugins-core

Originally posted by @Klaas- in #12 (comment)

@Klaas- Can you confirm the following? While python3-dnf-plugins-core seems to be included in the minimal install environment of RHEL 8 providing /usr/bin/dnf needs-restarting -r you have to install yum-utils on RHEL 7 based on minimal install envirionment to be able to use the command, right?

@Tronde Tronde self-assigned this Feb 10, 2022
@Tronde
Copy link
Owner Author

Tronde commented Feb 10, 2022

The package yum-utils exists in RHEL 7, 8 and 9. I tend to declare it as a role dependency for this role and relinquish the use of needs_restarting_command var I would need otherwise.

@Klaas-
Copy link

Klaas- commented Feb 16, 2022

if you don't want to go the minimal way you can just make sure yum-utils is present via your role, that's going to be the easiest solution. I personally like to avoid the yum compatibility layer.

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