Open w3bservice opened 2 years ago
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!
I need to solve the same issue. Currently I'm doing this, but would be nice to have a salty method.
httpd-enable-module-mod_auth_openidc:
cmd.run:
- name: /bin/dnf module enable mod_auth_openidc
Also curius about this feature for saltstack yumpkg module and state module.
Has anyone found a clean way to check if a module is already enabled? Something that could be used with onlyif
or unless
? A not great solution requires some grep regex magic from dnf module list --enabled -q
.
This is what I do to get the latest available nginx installed being that the default module in RHEL8 is old.... shows the unless/onlyif.
disable_php_module:
cmd.run:
- name: dnf module disable php
- onlyif: dnf module list --enabled | grep php
enable_nginx_1_20_module:
cmd.run:
- name: dnf module enable nginx:1.20
- unless: dnf module list --enabled | grep nginx | grep 1.20
required_packages:
pkg.installed:
- pkgs:
- nginx
Great solution, although I agree this should be a Salt-native solution. I'd like to suggest a small change in your onlyif and unless statements, which eliminates the use of pipes and grep:
disable_php_module:
cmd.run:
- name: dnf module -y disable php
- onlyif: dnf module list --enabled php
enable_nginx_1_20_module:
cmd.run:
- name: dnf module -y enable nginx:1.20
- unless: dnf module list --enabled nginx:1.20
required_packages:
pkg.installed:
- pkgs:
- nginx
i am currently creating an sls and desperately searching how to map "dnf module list...." or "dnf module enable/disable ..." in salt. the enable/disable feature is in CentOS/Alma Linux/Rocky Linux and Oracle respectively since rhel 8. with cmd.run it works. is there another more elegant way besides using a native command?
current salt-version 3004.1 Rocky Linux 8.6