#################### # - Check Variables #################### - name: "[Play] Check that mandatory variables are defined" assert: that: - "stack_name is defined" #################### # - Deploy Configs #################### - name: "Stop Stack: {{ stack_name}}" run_once: true community.docker.docker_stack: state: "absent" name: "{{ stack_name }}" absent_retries: 15 - name: "Wait for Stack to Stop" run_once: true shell: "until [ -z $(docker stack ps {{ stack_name }} -q) ]; do sleep 1; done" - name: "Wait for Stack Networks to Stop" run_once: true shell: "until [ -z $(docker stack ps {{ stack_name }} -q) ]; do sleep 1; done" - name: "Create Docker Configs" community.docker.docker_config: state: "present" name: "{{ item }}" data: "{{ lookup('template', stack_dir ~ '/configs/' ~ item) | b64encode }}" data_is_b64: "true" with_items: "{{ stack_configs }}"