add handle of ufw

This commit is contained in:
Antonio J. Delgado 2023-03-19 17:49:19 +02:00
parent c42d451b89
commit 75b8a003d4
2 changed files with 9 additions and 1 deletions

View file

@ -2,3 +2,7 @@
# Default values for variables of the role
# variable_name: value
motion_config: {}
handle_ufw: false
localnetworks:
- 192.168.1.0/24
- 192.168.2.0/24

View file

@ -97,12 +97,16 @@
ufw:
rule: allow
port: "{{ item.stream_port }}"
loop: "{{ motion_config['cameras'] | selectattr('stream_port', 'defined') }}"
with: "{{ motion_config['cameras'] | selectattr('stream_port', 'defined') }}"
when: handle_ufw
- name: Enable motion web control in ufw
ufw:
rule: allow
from_ip: "{{ item }}"
port: "{{ motion_config['webcontrol_port'] }}"
with: "{{ localnetworks }}"
when: handle_ufw
- name: Ensure motion can read signal configuration
ansible.posix.acl: