Skip to content

Commit ff1300d

Browse files
committed
allow defining port for database socket and skipping early database check
1 parent 76610c2 commit ff1300d

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ netbox_database_user: netbox
2222
# netbox_database_host: localhost
2323
netbox_database_port: 5432
2424
# netbox_database_socket: /var/run/postgresql
25+
netbox_database_alt_socket: false
2526
netbox_database_conn_age: 0
2627
netbox_database_options: {}
2728
netbox_database_maintenance: "postgres"

tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
when:
5353
- netbox_database_socket is defined
5454
- netbox_database_host is not defined
55+
- not netbox_database_alt_socket
5556

5657
- name: Ensure Postgres database exists (via TCP)
5758
community.postgresql.postgresql_db:

templates/configuration.py.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ DATABASE = {
2525
{% if netbox_database_password is defined %}
2626
'PASSWORD': '{{ netbox_database_password }}',
2727
{% endif %}
28+
{% if netbox_database_alt_socket and netbox_database_socket is defined %}
29+
'PORT': '{{ netbox_database_port }}',
30+
{% endif %}
2831
'HOST': '{{ netbox_database_socket }}',
2932
{% endif %}
3033
'CONN_MAX_AGE': {{ netbox_database_conn_age }},

0 commit comments

Comments
 (0)