异步任务未返回有效的JSON 易变版本 ansible --version ansible 2.0.2.0 config file = configured module search path = Default w/o overrides 操作系统/环境 MacOS 10.9 总结
我想启动shell命令以异步生成docker映像,生成成功,但出现以下错误:异步任务未返回有效的JSON 易变版本 ansible --version ansible 2.0.2.0 config file = configured module search path = Default w/o overrides 操作系统/环境 MacOS 10.9 总结,ansible,ansible-playbook,ansible-2.x,Ansible,Ansible Playbook,Ansible 2.x,我想启动shell命令以异步生成docker映像,生成成功,但出现以下错误: fatal: [192.168.0.1]: FAILED! => {"changed": false, "failed": true, "msg": "The async task did not return valid JSON: No JSON object could be decoded"} 复制步骤 <!--- For bugs, show exactly how to reprodu
fatal: [192.168.0.1]: FAILED! => {"changed": false, "failed": true, "msg": "The async task did not return valid JSON: No JSON object could be decoded"}
复制步骤
<!---
For bugs, show exactly how to reproduce the problem.
For new features, show how the feature would be used.
-->
结果是
{
"changed": true,
"end": "2016-06-05 07:12:38.323820",
"stdout": "Sending build context to Docker daemon 12.8 kB\r\r
Step 1 : FROM centos:6.6
---> 87dd25f5ba5c
Step 2 : RUN yum groupinstall -y development
---> Using cache
---> dc1b778350d5
Step 3 : RUN yum install -y vim bzip2-devel hostname tar zlib-dev
---> Using cache
---> d4538794340e
Step 4 : RUN curl https://bootstrap.pypa.io/get-pip.py | python -
---> Using cache
---> cd3cd13b11db
Step 5 : RUN pip install envtpl
---> Using cache
---> 574514eb6d91
Step 6 : WORKDIR /tmp
---> Using cache
---> 3750674900e6
Step 7 : ENV SCALA_VERSION 2.11
---> Using cache
---> 8316460b0264
Step 8 : ENV KAFKA_VERSION 0.9.0.1
---> Using cache
---> aa8f9cf12288
Step 9 : ENV KAFKA_HOME /usr/share/kafka_\"$SCALA_VERSION\"-\"$KAFKA_VERSION\"
---> Using cache
---> 38c1243614ac
Step 10 : RUN yum install -y tar libcurl libcurl-devel rrdtool rrdtool-devel perl-devel libgcrypt-devel gcc make gcc-c++ yajl-devel libxml2-devel libxml-2.0 java-1.7.0-openjdk java-1.7.0-openjdk-devel
---> Using cache
---> 8350d7ba311a
Step 11 : RUN curl -L -O http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/\"$KAFKA_VERSION\"/kafka_\"$SCALA_VERSION\"-\"$KAFKA_VERSION\".tgz && tar xfz kafka_\"$SCALA_VERSION\"-\"$KAFKA_VERSION\".tgz -C /usr/share/
---> Using cache
---> 485916280855
Step 12 : RUN mkdir -p /usr/local/bin/
---> Using cache
---> 2a3427511ef0
Step 13 : ADD start-kafka.sh /usr/local/bin/start-kafka.sh
---> Using cache
---> 6cd1ae0c2abc
Step 14 : RUN chmod +x /usr/local/bin/start-kafka.sh
---> Using cache
---> 4ba3e949839e
Step 15 : ADD zookeeper.properties.j2 \"$KAFKA_HOME\"/config/
---> Using cache
---> db8bfa4cce0d
Step 16 : ADD server.properties.j2 \"$KAFKA_HOME\"/config/
---> Using cache
---> b2d93fd06892
Step 17 : EXPOSE 2181 9092
---> Using cache
---> 25f1e2136c2c
Step 18 : RUN mv /etc/localtime /etc/localtime.bak
---> Using cache
---> 1cf4fc533f3a
Step 19 : RUN ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
---> Using cache
---> b6bae747bc32
Step 20 : CMD /usr/local/bin/start-kafka.sh
---> Using cache
---> 9920101ececa
Successfully built 9920101ececa",
"cmd": "docker build -t elk/kafka /tmp/dockerfile/kafka",
"rc": 0,
"start": "2016-06-05 07:12:38.253244",
"stderr": "",
"delta": "0:00:00.070576",
"invocation": {
"module_args": {"warn": true,
"executable": null,
"chdir": null,
"_raw_params": "docker build -t elk/kafka /tmp/dockerfile/kafka",
"removes": null,
"creates": null,
"_uses_shell": true
}
},
"warnings": []
}
我终于努力解决了这个问题。我在文件
executor/task\u executor.py下的第445行中添加了打印结果的代码:
return dict(failed=True, msg=u"The async task did not return valid JSON: error:%s result:%s" % (to_unicode(e), result))
然后我发现一些无效的json文本:/etc/profile.d/lang.sh:第19行:警告:setlocale:LC\u CTYPE:无法更改区域设置(UTF-8):没有这样的文件或目录\\r\\n
在我用这个解决了这个区域设置问题之后,这个问题消失了。我终于努力解决了这个问题。我在文件executor/task\u executor.py下的第445行中添加了打印结果的代码:
return dict(failed=True, msg=u"The async task did not return valid JSON: error:%s result:%s" % (to_unicode(e), result))
然后我发现一些无效的json文本:/etc/profile.d/lang.sh:第19行:警告:setlocale:LC\u CTYPE:无法更改区域设置(UTF-8):没有这样的文件或目录\\r\\n
在我修复了这个区域设置问题后,这个问题消失了
return dict(failed=True, msg=u"The async task did not return valid JSON: error:%s result:%s" % (to_unicode(e), result))