community.general.openwrt_init (8.5.0) — module

Manage services on OpenWrt

Authors: Andrew Gaffney (@agaffney)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Controls OpenWrt services on remote hosts.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Start service httpd, if not running
  community.general.openwrt_init:
    state: started
    name: httpd
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop service cron, if running
  community.general.openwrt_init:
    name: cron
    state: stopped
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Reload service httpd, in all cases
  community.general.openwrt_init:
    name: httpd
    state: reloaded
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable service httpd
  community.general.openwrt_init:
    name: httpd
    enabled: true

Inputs

    
name:
    aliases:
    - service
    description:
    - Name of the service.
    required: true
    type: str

state:
    choices:
    - started
    - stopped
    - restarted
    - reloaded
    description:
    - V(started)/V(stopped) are idempotent actions that will not run commands unless necessary.
    - V(restarted) will always bounce the service.
    - V(reloaded) will always reload.
    type: str

enabled:
    description:
    - Whether the service should start on boot. B(At least one of state and enabled are
      required.)
    type: bool

pattern:
    description:
    - If the service does not respond to the 'running' command, name a substring to look
      for as would be found in the output of the C(ps) command as a stand-in for a 'running'
      result.  If the string is found, the service will be assumed to be running.
    type: str