-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* issue #100 - configd actions task and handler * issue #100 - doc configd_actions for cron task * linted service module
- Loading branch information
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
|
||
# see: | ||
# https://docs.opnsense.org/development/backend/configd.html | ||
# | ||
# configd_actions: | ||
# template_name: # example myservice -> will create /usr/local/opnsense/service/conf/actions.d/actions_myservice.conf | ||
# actionname: # something like start, stop, ... | ||
# command: | ||
# parameters: | ||
# type: | ||
# message: | ||
# description: | ||
# | ||
# scripts required for the configd_actions commands can be listed in | ||
# configd_actions_scripts | ||
# and will be uploaded to | ||
# /usr/local/sbin/ | ||
|
||
- name: upload custom scripts for configd actions | ||
ansible.builtin.copy: | ||
src: "{{ item }}" | ||
dest: "/usr/local/sbin/{{ item }}" | ||
mode: '0750' | ||
owner: root | ||
group: wheel | ||
with_list: "{{ configd_actions_scripts | default([]) }}" | ||
|
||
- name: install action templates | ||
ansible.builtin.template: | ||
src: configd_action.j2 | ||
dest: /usr/local/opnsense/service/conf/actions.d/actions_{{ _configd_action.key }}.conf | ||
mode: '0644' | ||
owner: root | ||
group: wheel | ||
with_dict: "{{ configd_actions | default({}) }}" | ||
loop_control: | ||
loop_var: _configd_action | ||
label: "{{ _configd_action.key }}" | ||
notify: service configd restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#jinja2: lstrip_blocks: True | ||
{% for action, params in _configd_action.value.items() %} | ||
[{{ action }}] | ||
{% for k, v in params.items() %} | ||
{{ k }}:{{ v }} | ||
{% endfor %} | ||
{% if not loop.last %} | ||
|
||
{% endif %} | ||
{% endfor %} |