Let Docker allocate the network subnet again
Reverts the explicit subnets: the pools were freed by deleting five networks, so the network role is back to its single idempotent task - ensure the network exists and Caddy is on it - and the Sites no longer declare a subnet. The deployment readme keeps the note that a new Site needs a config, and therefore a new tag, but no longer asks for a free /24. If the pools fill up again the failure is recognisable: 'all predefined address pools have been fully subnetted', and the choices are deleting stale networks or declaring a subnet per Site.
This commit is contained in:
1 parent
01ce0bd609
commit
2ef044aa45
7 files changed
+4
-45
No files matched your search
@@ -1,29 +1,5 @@
|
||||
---
|
||||
- name: Look for the app network
|
||||
docker_network_info:
|
||||
name: '{{ docker_network }}'
|
||||
register: menu_network
|
||||
|
||||
- name: Fail when this Site declares no subnet
|
||||
fail:
|
||||
msg: >-
|
||||
{{ inventory_hostname }} needs a network_subnet in its vars file. This host's
|
||||
default address pools are exhausted (every 172.17-172.30/16 and every
|
||||
192.168.0-240/20 is taken), so Docker refuses to allocate one and a network
|
||||
has to be created with an explicit subnet.
|
||||
when: network_subnet | default('') == ''
|
||||
|
||||
# An existing network is left exactly as it is: Docker cannot change a network's
|
||||
# subnet in place, and the Sites already running have theirs.
|
||||
- name: Create the app network with this Site's subnet
|
||||
docker_network:
|
||||
name: '{{ docker_network }}'
|
||||
ipam_config:
|
||||
- subnet: '{{ network_subnet }}'
|
||||
state: present
|
||||
when: not menu_network.exists
|
||||
|
||||
- name: Put Caddy on the app network
|
||||
- name: 'Ensure {{ docker_network }} exists and Caddy is on it'
|
||||
docker_network:
|
||||
name: '{{ docker_network }}'
|
||||
state: present
|
||||
|
||||
Reference in new issue
Block a user