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

Service restart on Solaris 10 broken #20102

Closed
photoninger opened this issue Jan 10, 2017 · 3 comments · Fixed by #20578
Closed

Service restart on Solaris 10 broken #20102

photoninger opened this issue Jan 10, 2017 · 3 comments · Fixed by #20578
Assignees
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. module This issue/PR relates to a module. solaris Solaris community

Comments

@photoninger
Copy link
Contributor

ISSUE TYPE
  • Bug Report
COMPONENT NAME

service module

ANSIBLE VERSION
ansible 2.2.1.0 (detached HEAD d8c9b8d347) last updated 2017/01/10 10:52:47 (GMT +200)
  lib/ansible/modules/core: (detached HEAD a9d844c089) last updated 2017/01/10 11:01:04 (GMT +200)
  lib/ansible/modules/extras: (detached HEAD 19d20ca1a0) last updated 2017/01/10 11:01:04 (GMT +200)
OS / ENVIRONMENT

Running from macOS 10.12
Managing Solaris 10 10/09 s10s_u8wos_08a SPARC

SUMMARY

Service states restarted and reloaded raise an error

STEPS TO REPRODUCE
ansible solaris10-host -m service -a "state=restarted name=system-log" -u root

EXPECTED RESULTS

Service system-log is restarted

ACTUAL RESULTS
solaris10-host | FAILED! => {
    "changed": false, 
    "failed": true, 
    "msg": "svcadm: Pattern '-s' doesn't match any instances\n"
}

The changes introduced with ansible/ansible-modules-core#5406 broke compability to Solaris 10.
On Solaris 10 there is no option "-s" for subcommands restart and refresh:
Only the subcommands enable and disable support option "-s".
man page Solaris 10: https://docs.oracle.com/cd/E23823_01/html/816-5166/svcadm-1m.html
man page Solaris 11: https://docs.oracle.com/cd/E53394_01/html/E54764/svcadm-1m.html

So for Solaris 10 this option should be omitted for restart and refresh.

We need something like

if distribution_version == 10:
  option = ""
else:
  option = " -s"
[...]
 elif self.action == 'reload':
            subcmd = "refresh" + option
 elif self.action == 'restart' and status == 'online':
            subcmd = "restart" + option

I don't know if the service module can get distribution_version from facts.py...

@ansibot ansibot added affects_2.2 This issue/PR affects Ansible v2.2 bug_report module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Jan 10, 2017
@abadger abadger removed the needs_triage Needs a first human triage before being processed. label Jan 11, 2017
@precurse
Copy link
Contributor

FWIW this is also affecting SmartOS instances:

fatal: [haproxy]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "arguments": "", 
            "enabled": null, 
            "name": "rsyslog", 
            "pattern": null, 
            "runlevel": "default", 
            "sleep": null, 
            "state": "reloaded"
        }
    }, 
    "msg": "svcadm: Pattern '-s' doesn't match any instances\n"
}

@ceving
Copy link

ceving commented Jan 23, 2017

Same problem here.

As a work-around it is possible to put two tasks in a playbook:

service: name=ipfilter state=stopped
service: name=ipfilter state=started

@jasperla
Copy link
Contributor

We can use platform.version(); I'll submit a PR shortly.

jasperla added a commit to jasperla/ansible that referenced this issue Jan 25, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@dagwieers dagwieers added the solaris Solaris community label Jan 9, 2019
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. module This issue/PR relates to a module. solaris Solaris community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants