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

system/service module initctl location usage #19712

Merged
merged 3 commits into from
Jun 12, 2017
Merged

system/service module initctl location usage #19712

merged 3 commits into from
Jun 12, 2017

Conversation

ademmers
Copy link
Contributor

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/system/service

ANSIBLE VERSION
ansible 2.2.0.0
SUMMARY

Fall back on using initctl command to manage services in preference of start/stop/restart binaries.
Main reason is to use a resolved binary location as service command. Start's location eg is resolved to see if it exists, but the full location is not used to launch the command, as at that point in code not the service command is beeing used but the bare action.

Before:

$ ansible <host>-i <inventory> -sKo -m service -a 'name=<service> state=started enabled=yes'
SUDO password:
<host> | FAILED! => {"changed": false, "cmd": "initctl version", "failed": true, "msg": "[Errno 2] No such file or directory", "rc": 2}

After:

$ ansible <host> -i <inventory> -sKo -m service -a 'name=<service> state=started enabled=yes'
SUDO password:
<host>| SUCCESS => {"changed": false, "enabled": true, "name": "<service>", "state": "started"}

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 bugfix_pull_request module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Dec 28, 2016
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jan 4, 2017
@jimi-c jimi-c removed the plugin label Jan 4, 2017
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jan 4, 2017
@abadger abadger requested a review from bcoca January 5, 2017 01:26
@abadger abadger removed needs_triage Needs a first human triage before being processed. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jan 5, 2017
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jan 5, 2017
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 11, 2017
@atosatto
Copy link
Contributor

I confirm that the issue is also affecting ansible 2.2.3 and ansible 2.3.0 on Oracle Linux 6.
I've been able to successfully workaround it with the changes proposed in this PR.

@binhrobles
Copy link

In the meantime, I've been manually setting the environment for the task/play and referencing the initctl path like so:

    environment: 
      PATH: '/sbin'

@bcoca bcoca merged commit 025b529 into ansible:devel Jun 12, 2017
@netsandbox
Copy link
Contributor

@bcoca just hit this bug today in 2.3.3.0.
This PR was tagged affects_2.3 but was never merged in branch stable-2.3, only in stable-2.4.
Any chances to get this in 2.3?

jimi-c pushed a commit that referenced this pull request Feb 26, 2018
* Call initctl version based on initctl's retrieved location

* Remove the use of start/stop/restart in favor of initctl

* Provide correct argument order for initctl usage
@ansibot ansibot added the bug This issue/PR relates to a bug. label Mar 5, 2018
@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.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants