diff --git a/tasks/haproxy_conf.yml b/tasks/haproxy_conf.yml index 17e9799..481f435 100644 --- a/tasks/haproxy_conf.yml +++ b/tasks/haproxy_conf.yml @@ -8,5 +8,5 @@ template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg owner=root group=root mode='0444' notify: Reload the HAPROXY configuration - when: docker_swarm_manager_main_node + when: docker_swarm_manager_main_node | bool tags: [ 'haproxy', 'docker_haproxy', 'docker_swarm', 'docker', 'haproxy_conf' ] diff --git a/tasks/haproxy_networks.yml b/tasks/haproxy_networks.yml new file mode 100644 index 0000000..1005674 --- /dev/null +++ b/tasks/haproxy_networks.yml @@ -0,0 +1,18 @@ +--- +- name: Create the networks that haproxy will attach to + block: + - name: Create the overlay networks + docker_network: + name: '{{ item }}' + driver: overlay + with_items: '{{ docker_swarm_haproxy_networks }}' + + - name: Connect haproxy to the overlay networks + docker_network: + name: '{{ item }}' + connected: + - 'haproxy_haproxy' + append: yes + + when: docker_swarm_manager_main_node | bool + tags: [ 'haproxy', 'docker_haproxy', 'docker_swarm', 'docker', 'docker_network' ] diff --git a/tasks/main.yml b/tasks/main.yml index 58a386b..a034acb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,6 @@ --- +- import_tasks: haproxy_networks.yml + when: docker_swarm_cluster_haproxy_install - import_tasks: haproxy_conf.yml when: docker_swarm_cluster_haproxy_install - import_tasks: portainer.yml diff --git a/tasks/portainer.yml b/tasks/portainer.yml index 72242fa..936de60 100644 --- a/tasks/portainer.yml +++ b/tasks/portainer.yml @@ -12,5 +12,5 @@ - /srv/portainer-agent-stack.yml run_once: True - when: docker_swarm_manager_main_node + when: docker_swarm_manager_main_node | bool tags: [ 'portainer', 'docker_portainer', 'docker_swarm', 'docker' ] diff --git a/templates/portainer-agent-stack.yml.j2 b/templates/portainer-agent-stack.yml.j2 index c9e1e42..1be4566 100644 --- a/templates/portainer-agent-stack.yml.j2 +++ b/templates/portainer-agent-stack.yml.j2 @@ -45,7 +45,8 @@ services: - '{{ constraint }}' {% endfor %} {% if docker_log_to_journal %} - log_driver: 'journald' + logging: + driver: 'journald' {% endif %} networks: