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

[FEATURE] Enable service without starting it #302

Open
SkypLabs opened this issue Aug 16, 2023 · 0 comments
Open

[FEATURE] Enable service without starting it #302

SkypLabs opened this issue Aug 16, 2023 · 0 comments

Comments

@SkypLabs
Copy link

SkypLabs commented Aug 16, 2023

Is your feature request related to a problem?

It is not possible to enable the Nginx service without starting it as shown here:

{% set service_function = {True:'running', False:'dead'}.get(nginx.service.enable) %}

I would like to be able to enable the service without starting it (useful when creating VM images) or start the service without enabling it.

Describe the solution you'd like

I would suggest dissociating the Salt state function to use (e.g. running, dead) from the value of the enable pillar option:

nginx:
  service:
    enable: true
    start: true

By introducing the new pillar option start, it becomes possible to enable the service without starting it and vice versa:

{% set service_function = {True:'running', False:'dead'}.get(nginx.service.start) %}

...

nginx_service:
  service.{{ service_function }}:
    {{ sls_block(nginx.service.opts) }}
    - name: {{ nginx.lookup.service }}
    - enable: {{ nginx.service.enable }}
    ...

This is made possible because both running and dead functions have the same enable parameter to enable or not the service.

Describe alternatives you've considered

Nothing comes to my mind.

Additional context

Nothing to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant