Skip to content

Commit

Permalink
feat: add windows firewall settings
Browse files Browse the repository at this point in the history
  • Loading branch information
antmelekhin committed Sep 14, 2024
1 parent 15e04b4 commit 06876b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ postgres_exporter_log_format: 'logfmt'
postgres_exporter_tls_server_config: {}
postgres_exporter_http_server_config: {}
postgres_exporter_basic_auth_users: {}

# The Postgres Exporter firewall settings:
postgres_exporter_win_firewall_rule_profiles: 'domain,private,public'
postgres_exporter_win_firewall_rule_remoteip: 'any'
postgres_exporter_win_firewall_rule_state: 'present'
18 changes: 16 additions & 2 deletions meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ argument_specs:
short_description: 'Postgres Exporter'
description:
- 'An Ansible role to install, configure and update the L(Postgres Exporter,https://github.com/prometheus-community/postgres_exporter).'
author:
- 'Melekhin Anton'
author: 'Melekhin Anton'
options:
postgres_exporter_version:
type: 'str'
Expand Down Expand Up @@ -115,3 +114,18 @@ argument_specs:
postgres_exporter_basic_auth_users:
type: 'dict'
description: 'Users and password for basic authentication. Passwords are automatically hashed with bcrypt.'
postgres_exporter_win_firewall_rule_profiles:
type: 'str'
description: 'The profile this rule applies to.'
default: 'domain,private,public'
postgres_exporter_win_firewall_rule_remoteip:
type: 'str'
description: 'The remote ip address/range this rule applies to.'
default: 'any'
postgres_exporter_win_firewall_rule_state:
type: 'str'
description: 'Should this rule be added or removed.'
choices:
- 'present'
- 'absent'
default: 'present'
5 changes: 3 additions & 2 deletions tasks/Win32NT/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
description: 'Inbound rule for Postgres Exporter'
program: '{{ postgres_exporter_install_path }}\postgres_exporter.exe'
localport: '{{ postgres_exporter_web_listen_port }}'
remoteip: '{{ postgres_exporter_win_firewall_rule_remoteip }}'
action: 'allow'
direction: 'in'
protocol: 'tcp'
profiles: 'domain,private,public'
profiles: '{{ postgres_exporter_win_firewall_rule_profiles }}'
enabled: true
state: 'present'
state: '{{ postgres_exporter_win_firewall_rule_state }}'

0 comments on commit 06876b1

Please sign in to comment.