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

Ansible's service module fails on Ubuntu 18.04 #37551

Closed
holta opened this issue Mar 17, 2018 · 9 comments
Closed

Ansible's service module fails on Ubuntu 18.04 #37551

holta opened this issue Mar 17, 2018 · 9 comments
Labels
affects_2.11 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category

Comments

@holta
Copy link

holta commented Mar 17, 2018

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Ansible's service module

ANSIBLE VERSION
ansible 2.5.0rc3
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/sbin/ansible
  python version = 2.7.14+ (default, Feb  6 2018, 19:12:18) [GCC 7.3.0]
CONFIGURATION
OS / ENVIRONMENT

It's true that Ubuntu 18.04 is unreleased, but it's entered final beta, for final release in April:

root@box:~# cat /etc/*elease
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu Bionic Beaver (development branch)"
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu Bionic Beaver (development branch)"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
SUMMARY

Fails to create a link in /etc/systemd/system/multiuser.target.wants

As originally reported in: iiab/iiab#698

STEPS TO REPRODUCE

The following Ansible code fails on Ubuntu 18.04, with Ansible version 2.5.0 RC3 and similar:

- name: Start iiab-cmdsrv service
  service: name=iiab-cmdsrv
           state=restarted
           enabled=yes

The above fails to create a link in /etc/systemd/system/multiuser.target.wants

The following format also fails to create the link:

- name: Start iiab-cmdsrv service
  service: 
    name: iiab-cmdsrv
    state: restarted
    enabled: yes
EXPECTED RESULTS

The link should have been created in /etc/systemd/system/multiuser.target.wants — as does work on Raspbian and Ubuntu 16.04

ACTUAL RESULTS

On Ubuntu 18.04, no link is created in /etc/systemd/system/multiuser.target.wants

@ansibot
Copy link
Contributor

ansibot commented Mar 17, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Mar 17, 2018
@Akasurde Akasurde removed the needs_triage Needs a first human triage before being processed. label Mar 19, 2018
@alikins
Copy link
Contributor

alikins commented Mar 19, 2018

@holta

As originally reported in: iiab/iiab#698

That references a role in that repo that no longer exists (cmdsrv).

Could you update the bug with an example playbook and 'ansible-playbook' output with '-vvv' level verbosity?

@alikins alikins added the needs_info This issue requires further information. Please answer any outstanding questions. label Mar 19, 2018
@holta
Copy link
Author

holta commented Mar 19, 2018

That references a role in that repo that no longer exists (cmdsrv).

CLARIF: The production code does exist, but apologies that may not have been obvious as it's in Internet-in-a-Box's other repo here: https://github.com/iiab/iiab-admin-console/blob/master/roles/cmdsrv/tasks/main.yml#L252-L255 (the last 4 lines)

@ansibot ansibot removed the needs_info This issue requires further information. Please answer any outstanding questions. label Mar 19, 2018
@ergonlogic
Copy link

I've seen similar behaviour recently. service_facts reports that mysql is stopped, but - service: name=mysql state=started results in "ok".

The service can be forced to start with:

- command: service mysql start

@decentral1se
Copy link
Contributor

Oh yes, been bitten by this one just now. Thanks for reporting.

@ctorgalson
Copy link
Contributor

It's possible there is more than one bug here.

I'm seeing the same issue as @ergonlogic on Ubuntu Xenial in Docker, but in this case, the expected link (/etc/systemd/system/multi-user.target.wants/mysql.service) exists (contrary to the OP's description of the issue).

@ansibot ansibot added the system System category label Feb 17, 2019
@ansibot
Copy link
Contributor

ansibot commented May 16, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@TheBlackMini
Copy link

This is still happening in Ubuntu 20.04 in docker. Service isn't starting the service.

  • name: Start MySQL
    service: name=mysql status=started

or

  • name: Start MySQL
    service:
    name: mysql
    status: started

Had to use

  • name: Start MySQL
    command: service mysql start

@s-hertel s-hertel added needs_verified This issue needs to be verified/reproduced by maintainer affects_2.11 and removed affects_2.5 This issue/PR affects Ansible v2.5 labels Aug 20, 2021
@sivel
Copy link
Member

sivel commented Dec 1, 2022

I cannot replicate this issue. Using apache2 as the service creates the symlink:

$ ls -al /etc/systemd/system/multi-user.target.wants/apache2.service
lrwxrwxrwx 1 root root 35 Dec  1 21:51 /etc/systemd/system/multi-user.target.wants/apache2.service -> /lib/systemd/system/apache2.service

If you are still having problems, feel free to open a new issue with a full contained reproducer.

If you have further questions please stop by IRC or the mailing list:

@sivel sivel closed this as completed Dec 1, 2022
@sivel sivel removed the needs_verified This issue needs to be verified/reproduced by maintainer label Dec 5, 2022
@ansible ansible locked and limited conversation to collaborators Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category
Projects
None yet
Development

No branches or pull requests

10 participants