Skip to content

Commit efca97d

Browse files
authored
Merge pull request #158 from MonsterDruide1/maintenance-db
Add `netbox_database_maintenance` variable
2 parents 8054a51 + 7b2df1e commit efca97d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

README.adoc

+8
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ To configure Netbox to keep database connections open longer than a single reque
167167
set `netbox_database_conn_age` to your preferred maximum connection age, in seconds.
168168
300 seconds (5 minutes) is typically a good number to start with.
169169

170+
[source,yaml]
171+
----
172+
netbox_database_maintenance: postgres
173+
----
174+
175+
If the postgres database is configured to only allow access to specific tables of the DB for the user configured with Netbox, you can set `netbox_database_maintenance` to replace the default database used for connection checking to a different table than the default `postgres`. This is an empty table in every postgres database by default, but some configurations might block access to this table, so a different table (i.e. `netbox_prod`) can be used here instead.
176+
170177
[source,yaml]
171178
----
172179
# Example usage, default is empty dict
@@ -501,6 +508,7 @@ installing NetBox on to authenticate with it over TCP:
501508
netbox_database: netbox_prod
502509
netbox_database_user: netbox_prod_user
503510
netbox_database_password: "very_secure_password_for_prod"
511+
netbox_database_maintenance: netbox_prod
504512
redis_bind: 127.0.0.1
505513
redis_version: 6.0.9
506514
redis_checksum: sha256:dc2bdcf81c620e9f09cfd12e85d3bc631c897b2db7a55218fd8a65eaa37f86dd

defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ netbox_database_port: 5432
2424
# netbox_database_socket: /var/run/postgresql
2525
netbox_database_conn_age: 0
2626
netbox_database_options: {}
27+
netbox_database_maintenance: "postgres"
2728

2829
netbox_redis_host: 127.0.0.1
2930
netbox_redis_sentinels: []

tasks/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
name: "{{ netbox_database }}"
4747
login_user: "{{ netbox_database_user }}"
4848
login_unix_socket: "{{ netbox_database_socket }}"
49+
maintenance_db: "{{ netbox_database_maintenance }}"
4950
become: true
5051
become_user: "{{ netbox_database_user }}"
5152
when:
@@ -59,6 +60,7 @@
5960
port: "{{ netbox_database_port }}"
6061
login_user: "{{ netbox_database_user }}"
6162
login_password: "{{ netbox_database_password }}"
63+
maintenance_db: "{{ netbox_database_maintenance }}"
6264
when:
6365
- netbox_database_socket is not defined
6466
- netbox_database_host is defined

0 commit comments

Comments
 (0)