Project

General

Profile

Feature #21717

Extend "Service Action - SSH Default" job template to be able to enable and disable services

Added by Adam Ruzicka about 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
trivial
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

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

Associated revisions

Revision 47de1a56 (diff)
Added by Ido Kanner over 1 year ago

Refs #21717 - Added support for enable and disable

History

#1 Updated by Adam Ruzicka about 2 years ago

  • Difficulty set to trivial
  • Target version set to 113

#2 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_remote_execution/pull/354 added

#3 Updated by Ido Kanner over 1 year 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.

#4 Updated by The Foreman Bot over 1 year ago

  • Pull request https://github.com/theforeman/community-templates/pull/480 added

#5 Updated by Ivan Necas over 1 year ago

  • Status changed from Ready For Testing to Closed
  • Pull request deleted (https://github.com/theforeman/foreman_remote_execution/pull/354)

#6 Updated by Marek Hulán over 1 year 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

Also available in: Atom PDF