arensb.truenas.initscript module – Manage init/shutdown scripts.
Note
This module is part of the arensb.truenas collection (version 1.11.4).
To install it, use: ansible-galaxy collection install arensb.truenas
.
To use it in a playbook, specify: arensb.truenas.initscript
.
New in arensb.truenas 1.10.0
Synopsis
Set up and manage init and shutdown scripts and commands.
Parameters
Parameter |
Comments |
---|---|
Command to execute. Mutually exclusive with |
|
Name of the script. Acts as an identifier. |
|
Path to a script to execute. Mutually exclusive with |
|
Text of the script to execute. When it is time to execute the script, the text will be saved to a temporary file, which will then be executed with Mutually exclusive with |
|
Whether the script should exist or not. Choices:
|
|
Time in seconds that the system should wait for the script to terminate. |
|
When to execute the script:
Choices:
|
Examples
- name: Run a command late once everything has started
initscript:
name: Start Foo
cmd: "service foo start"
when: postinit
- name: Run a script at shutdown
initscript:
name: Cleaning up
script: |
#!/bin/sh
echo "Cleaning up before shutdown."
service foo stop
rm /var/some-lock-file
when: shutdown
- name: Delete an init script
initscript:
name: Remove old cruft
name: Start Foo
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A data structure describing a newly-created init script. Only returned when a script is created. Returned: success |