Skip to content

Commit

Permalink
use ansible.utils.network_in_usable for ip check
Browse files Browse the repository at this point in the history
Signed-off-by: Sеrgiо Nеmirоwski <[email protected]>
  • Loading branch information
Sеrgiо Nеmirоwski committed Sep 25, 2024
1 parent 2afbc57 commit 27b3a7d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ neogo__ferm__dependent_rules:
saddr: '{{ neogo__rpc_allow + neogo__rpc_group_allow + neogo__rpc_host_allow }}'
protocol: 'tcp'
role: 'neogo-legacy'
rule_state: "{{ 'present' if neogo__rpc_enabled and neogo__rpc_address not in ['localhost', '127.0.0.1', '::1'] else 'absent' }}"
rule_state: "{{ 'present' if neogo__rpc_enabled and not ( neogo__rpc_address == 'localhost' or '127.0.0.0/8'|ansible.utils.network_in_usable( neogo__rpc_address ) or '::1/128'|ansible.utils.network_in_usable( neogo__rpc_address ) ) else 'absent' }}"

- type: 'accept'
name: 'neogo{{ neogo__instance }}_tls'
Expand All @@ -189,7 +189,7 @@ neogo__ferm__dependent_rules:
saddr: '{{ neogo__rpc_allow + neogo__rpc_group_allow + neogo__rpc_host_allow }}'
protocol: 'tcp'
role: 'neogo-legacy'
rule_state: "{{ 'present' if neogo__tls_enabled and neogo__tls_address not in ['localhost', '127.0.0.1', '::1'] else 'absent' }}"
rule_state: "{{ 'present' if neogo__tls_enabled and not ( neogo__tls_address == 'localhost' or '127.0.0.0/8'|ansible.utils.network_in_usable( neogo__tls_address ) or '::1/128'|ansible.utils.network_in_usable( neogo__tls_address ) ) else 'absent' }}"

- type: 'accept'
name: 'neogo{{ neogo__instance }}_metrics'
Expand All @@ -198,7 +198,7 @@ neogo__ferm__dependent_rules:
saddr: '{{ neogo__metrics_allow + neogo__metrics_group_allow + neogo__metrics_host_allow }}'
protocol: 'tcp'
role: 'neogo-legacy'
rule_state: "{{ 'present' if neogo__metrics_enabled and neogo__metrics_address not in ['localhost', '127.0.0.1', '::1'] else 'absent' }}"
rule_state: "{{ 'present' if neogo__metrics_enabled and not ( neogo__metrics_address == 'localhost' or '127.0.0.0/8'|ansible.utils.network_in_usable( neogo__metrics_address ) or '::1/128'|ansible.utils.network_in_usable( neogo__metrics_address ) ) else 'absent' }}"

- type: 'accept'
name: 'neogo{{ neogo__instance }}_pprof'
Expand All @@ -207,4 +207,4 @@ neogo__ferm__dependent_rules:
saddr: '{{ neogo__pprof_allow + neogo__pprof_group_allow + neogo__pprof_host_allow }}'
protocol: 'tcp'
role: 'neogo-legacy'
rule_state: "{{ 'present' if neogo__pprof_enabled and neogo__pprof_address not in ['localhost', '127.0.0.1', '::1'] else 'absent' }}"
rule_state: "{{ 'present' if neogo__pprof_enabled and not ( neogo__pprof_address == 'localhost' or '127.0.0.0/8'|ansible.utils.network_in_usable( neogo__pprof_address ) or '::1/128'|ansible.utils.network_in_usable( neogo__pprof_address ) ) else 'absent' }}"

0 comments on commit 27b3a7d

Please sign in to comment.