Skip to content

Commit b5a0deb

Browse files
boxrickangstwad
authored andcommitted
Flush fixes and adjustment to default bridge ip option
* Add flush handler at the end of main, this is to allow config options to be picked up once the role has finished. In my case setting proxies and bridge ip. Without this line it requires two Ansible runs due to nature of handlers. * Added configurable option for bridge ip. By default it conflicts with my ip schema. This is now a configurable option.
1 parent 4846bd5 commit b5a0deb

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ docker_http_proxy:
5656
docker_https_proxy:
5757
docker_no_proxy:
5858

59+
# Optionally allow the bridge IP to change, to prevent conflicts or allow more control
60+
docker_bip:
61+
62+
# Flag to determine if we should flush handlers mid way through role. This is useful if we want docker to make use of our new
63+
# options right away
64+
docker_flush_handlers: true
65+
5966
# Flags for whether to install pip packages
6067
pip_install_pip: true
6168
pip_install_setuptools: true

tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,19 @@
330330
setup:
331331
filter: "ansible_docker0"
332332
when: ansible_docker0 is not defined
333+
334+
- name: Add different cidr for docker bridge
335+
copy:
336+
content: |
337+
{
338+
"bip": "{{ docker_bip }}"
339+
}
340+
dest: /etc/docker/daemon.json
341+
when: docker_bip is not none
342+
notify:
343+
- Restart docker
344+
345+
# Flush handlers so things like proxy settings are picked up or new bridge ip
346+
- name: Force handler flush so the config is picked up
347+
meta: flush_handlers
348+
when: docker_flush_handlers

0 commit comments

Comments
 (0)