K
K
Konstantin Rudenkov2016-06-02 21:47:52
Ansible
Konstantin Rudenkov, 2016-06-02 21:47:52

How to wait for docker job completion in ansible and catch errors?

Dear community! Good day.
There is such an ansible task:

- name: Build projects
  docker_container:
    name: "{{ item.name }}_builder"
    pull: yes
    image: app-builder
    command: install
    interactive: yes
    restart: no
    recreate: yes
    tty: yes
    user: builder
    state: started
    privileged: yes
    detach: False
    volumes:
     - "{{ src_dest }}/{{ item.name }}:/source:rw"
     - "{{ build_dest }}/{{ item.name }}:/build:rw"
  with_items: "{{ projects }}"

I don't understand two things, I think they are related:
1. How to make ansible wait for the container(s) to finish working?
2. How to make ansible fail if the container is not closed from 0?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Puma Thailand, 2016-06-02
@opium

This should be done not with ansible but with jenkins

D
Dmitry, 2015-09-18
@smoklew

You submit a form, and you are trying to send it with Ajax, add to<form action="javascript:void(null);">

$(document).ready(function(){
    $("#form").submit(function() { //устанавливаем событие отправки для формы с id=form
            var form_data = $(this).serialize(); //собераем все данные из формы
            $.ajax({
            type: "POST", //Метод отправки
            url: "../php/script.php", //путь до php фаила отправителя
            data: form_data,
            success: function() {
                   //код в этом блоке выполняется при успешной отправке сообщения
                   alert("Ваше сообщение отпрвлено!");
          },
          error:  function(xhr, str){
                alert('Возникла ошибка: ' + xhr.responseCode);
    
            }
    });
});  
});

E
Evgenii Kaidashov, 2015-09-18
@Evgenii-Kaidashov

To send the form to the address /php/script.php you need to set the action parameter
ready is not closed, this is the correct code

$(document).ready(function () {
        $("#form").submit(function () { //устанавливаем событие отправки для формы с id=form
            var form_data = $(this).serialize(); //собераем все данные из формы
            $.ajax({
                type: "POST", //Метод отправки
                url: "../php/script.php", //путь до php фаила отправителя
                data: form_data,
                success: function () {
                    //код в этом блоке выполняется при успешной отправке сообщения
                    alert("Ваше сообщение отпрвлено!");
                },
                error: function (xhr, str) {
                    alert('Возникла ошибка: ' + xhr.responseCode);

                }
            });
        });
    });

To test the handler
$(document).ready(function () {
        $("#form").submit(function () {
            console.log("Send");
            return false;
        });
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question