Documentation

win_service - Manages Windows services

New in version 1.7.

Synopsis

Manages Windows services

Options

parameter required default choices comments
name
yes
    Name of the service
    start_mode
    no
    • auto
    • manual
    • disabled
    Set the startup type for the service
    state
    no
    • started
    • stopped
    • restarted
    started/stopped are idempotent actions that will not run commands unless necessary. restarted will always bounce the service.

    Examples

    # Restart a service
    win_service:
      name: spooler
      state: restarted
    
    # Set service startup mode to auto and ensure it is started
    win_service:
      name: spooler
      start_mode: auto
      state: started
    

    This is a Core Module

    For more information on what this means please read Core Modules

    For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.