Ansible – 剧本dynamic冗长

我想从Dockerfile构build一个Dockerfile 。 我可以通过使用这样的bash来做到这一点:

 [root@srv01 ~]# docker build -t appname/tomcat:someTag /root/Documents/myDockerfiles/tomcat 

使用bash构build图像的好处在于,它会逐步stdout执行的内容:

 Step 1 : FROM tomcat:8.0.32-jre8 8.0.32-jre8: Pulling from library/tomcat fdd5d7827f33: Already exists ... 

当从bash以下列方式使用Ansible时:

[root@localhost ansiblescripts]# ansible-playbook -vvvvv build-docker-image.yml

其中build-docker-image.yml文件包含以下内容:

 - name: "my build-docker-image.yml playbook" hosts: myHost tasks: - name: "simple ping" ping: - name: "build the docker image" become: yes become_method: root become_method: su command: /bin/docker build -t something/tomcat:ver1 /home/docker/tomcat #async: 1 #poll: 0 

它等待整个构build命令完成,然后将所有stdout作为详细输出打印在一起。

async:1poll:0注释poll:0不能解决我的问题,因为它根本不打印stdout

Interesting Posts