Skip to content

Commit

Permalink
netbox: add netbox_postgres_volume_type parameter (#1245)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt committed Dec 22, 2023
1 parent 2f9a09c commit 9fd88f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
With the parameter `netbox_postgres_volume_type` in the netbox role
it is now possible to use a tmpfs volume for the postgres service
This is intended for use in the CI to speed up processes there.
2 changes: 2 additions & 0 deletions roles/netbox/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ netbox_postgres_password: password
netbox_postgres_username: netbox
netbox_postgres_databasename: netbox

netbox_postgres_volume_type: volume

netbox_postgres_init_sql: "{{ configuration_directory }}/environments/infrastructure/files/netbox/init.sql"

##########################
Expand Down
7 changes: 7 additions & 0 deletions roles/netbox/templates/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ services:
- "{{ netbox_configuration_directory }}/postgres.env"
volumes:
- "{{ netbox_configuration_directory }}/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro"
{% if netbox_postgres_volume_type == 'volume' %}
- postgres:/var/lib/postgresql/data
{% elif netbox_postgres_volume_type == 'tmpfs' %}
tmpfs:
- /var/lib/postgresql/data
{% endif %}
secrets:
- POSTGRES_PASSWORD
healthcheck:
Expand Down Expand Up @@ -90,7 +95,9 @@ services:
{% endif %}

volumes:
{% if netbox_postgres_volume_type == 'volume' %}
postgres:
{% endif %}
redis:

secrets:
Expand Down

0 comments on commit 9fd88f8

Please sign in to comment.