Skip to content

Commit 5b543fb

Browse files
authored
Add Docker network configuration for pgadmin role (#304)
Signed-off-by: Jim Enright <[email protected]>
1 parent c39591c commit 5b543fb

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

roles/pgadmin/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The role will:
3838
| `pgadmin_default_email` | `str` | `False` | `[email protected]` | Email account for the default user to access the pgAdmin web UI. This user is created on first launch of the container. |
3939
| `pgadmin_default_password` | `str` | `False` | `pgadmin` | Password for the default user to access the pgAdmin web UI. **It is highly recommended to change this default password for production environments.** |
4040
| `pgadmin_docker_exe` | `str` | `False` | `/usr/bin/docker` | The full path to the Docker executable on the target host. |
41+
| `pgadmin_docker_network_subnet_cidr` | `str` | `False` | `172.21.0.0/16` | Subnet CIDR for the Docker bridge network used by pgadmin. |
42+
| `pgadmin_docker_network_subnet_gateway` | `str` | `False` | `172.21.0.1` | Gateway for the Docker bridge network subnet used by pgadmin. |
4143

4244
# Example Playbook
4345

roles/pgadmin/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ pgadmin_default_email: "[email protected]"
3838
pgadmin_default_password: "pgadmin"
3939

4040
pgadmin_docker_exe: /usr/bin/docker
41+
42+
pgadmin_docker_network_subnet_cidr: 172.21.0.0/16
43+
pgadmin_docker_network_subnet_gateway: 172.21.0.1

roles/pgadmin/meta/argument_specs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,13 @@ argument_specs:
8181
type: str
8282
required: false
8383
default: "/usr/bin/docker"
84+
pgadmin_docker_network_subnet_cidr:
85+
description: Subnet CIDR for the Docker bridge network used by pgadmin.
86+
type: str
87+
required: false
88+
default: "172.21.0.0/16"
89+
pgadmin_docker_network_subnet_gateway:
90+
description: Gateway for the Docker bridge network subnet used by pgadmin.
91+
type: str
92+
required: false
93+
default: "172.21.0.1"

roles/pgadmin/templates/pgadmin-docker-compose.yml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ services:
33
image: dpage/pgadmin4:latest
44
container_name: pgadmin4_container
55
restart: always
6+
networks:
7+
- pg_network
68
ports:
79
- "{{ pgadmin_port }}:80"
810
entrypoint: /bin/sh -c "chmod 600 /pgpass; /entrypoint.sh;"
@@ -19,3 +21,11 @@ services:
1921

2022
volumes:
2123
pgadmin-data:
24+
25+
networks:
26+
pg_network:
27+
driver: bridge
28+
ipam:
29+
config:
30+
- subnet: {{ pgadmin_docker_network_subnet_cidr }}
31+
gateway: {{ pgadmin_docker_network_subnet_gateway }}

0 commit comments

Comments
 (0)