From 68ca81c8c2a69350bee199bb38c35dbab1e999e5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 17 Apr 2021 11:41:49 +0300 Subject: [PATCH] Attempt to fix docker_network result discrepancy between Ansible versions Supposedly fixes https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/907 --- roles/matrix-prometheus/tasks/setup_install.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/matrix-prometheus/tasks/setup_install.yml b/roles/matrix-prometheus/tasks/setup_install.yml index 8aee5178c..3d6867985 100644 --- a/roles/matrix-prometheus/tasks/setup_install.yml +++ b/roles/matrix-prometheus/tasks/setup_install.yml @@ -30,8 +30,10 @@ driver: bridge register: matrix_docker_network_info + # The `matrix_docker_network_info.ansible_facts.docker_network` workaroudn is for Ansible <= 2.8. + # See: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/907 - set_fact: - matrix_prometheus_scraper_node_targets: ["{{ matrix_docker_network_info.network.IPAM.Config[0].Gateway }}:9100"] + matrix_prometheus_scraper_node_targets: ["{{ matrix_docker_network_info.network|default(matrix_docker_network_info.ansible_facts.docker_network).IPAM.Config[0].Gateway }}:9100"] when: "matrix_prometheus_scraper_node_enabled|bool and matrix_prometheus_scraper_node_targets|length == 0"