Feature #21717
closedExtend "Service Action - SSH Default" job template to be able to enable and disable services
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1515671
Description of problem:
The standard job template "Service Action - SSH Default" does not support enabling or disabling services.
Version-Release number of selected component (if applicable): 6.2.12
How reproducible:
Always
Steps to Reproduce:
1. Run job template "Service Action - SSH Default"
2. Notice that there are no option to enable or disable a service
Actual results:
You have to use "Run Command - SSH Default" with "chkconfig <service name> on/off" or "systemctl <service name> enable/disable" depending on the target host.
Expected results:
There should be options in "Service Action - SSH Default" to enable/disable services and the template should handle if it is executed on a system that is using systemd or not.
Implementation suggestion:
Change the template to this:
<% if @host.operatingsystem.family == "Redhat" && @host.operatingsystem.major.to_i > 6 ->
systemctl <= input("action") > <= input("service") >
< elsif input("action") == "enable" ->
chkconfig <= input("service") > on
< elsif input("action") == "disable" ->
chkconfig <= input("service") > off
< else ->
service <= input("service") > <= input("action") >
< end -%>
And in the Job tab under Template input, add "enable" and "disable" to the list of Options so that the list consist of the following options:
restart
start
stop
status
enable
disable
Updated by Adam Ruzicka over 6 years ago
- Target version set to 113
- Difficulty set to trivial
Updated by The Foreman Bot almost 6 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_remote_execution/pull/354 added
Updated by Ido Kanner almost 6 years ago
- Project changed from Foreman Remote Execution to Foreman
changed project, due to comments on the PR by theforeman-bot.
The change was made to the community templates and not to the project itself.
Updated by The Foreman Bot almost 6 years ago
- Pull request https://github.com/theforeman/community-templates/pull/480 added
Updated by Ivan Necas almost 6 years ago
- Status changed from Ready For Testing to Closed
- Pull request deleted (
https://github.com/theforeman/foreman_remote_execution/pull/354)
Updated by Marek Hulán almost 6 years ago
After it's merged in community templates, the change needs to be synced to the rex/ansible codebase too. I don't think this should be considered closed