Skip to content

Module failed: Unsupported parameters for (ansible.legacy.service) module: use #1668

@LucasDemea

Description

@LucasDemea

Version

ansible-13.6.0 ansible-core-2.20.5

What did you expect to happen?

When running trellis roles with packer to provision a docker container based on circleci's cimg/node:lts-browsers image, I expect it to run without errors.

What actually happens?

I get an error about the service module's use parameter in the nginx role:

- name: Enable Nginx to start on boot
  service:
    name: nginx
    enabled: yes
    state: started
    use: service

Relevant part in ansible docs:

https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/service_module.html

The service module actually uses system specific modules, normally through auto detection, this setting can force a specific module.
Normally it uses the value of the ansible_service_mgr fact and falls back to the ansible.legacy.service module when none matching is found.
The ‘old service module’ still uses autodetection and in no way does it correspond to the service command.

Steps to reproduce

run a packer build with "cimg/node:lts-browsers" as the base image

System info

No response

Log output

[ERROR]: Task failed: Module failed: Unsupported parameters for (ansible.legacy.service) module: use. Supported parameters include: arguments, enabled, name, pattern, runlevel, sleep, state (args).
Origin: /tmp/packer-provisioner-ansible-local/6a02de5d-460f-6c1b-6b3b-6d6d1f7f5ea9/roles/nginx/tasks/main.yml:58:3

56   notify: reload nginx
57
58 - name: Enable Nginx to start on boot
     ^ column 3

fatal: [default]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ansible.legacy.service) module: use. Supported parameters include: arguments, enabled, name, pattern, runlevel, sleep, state (args)."}

Please confirm this isn't a support request.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions