- name: Create directory for python files
file: path=/home/vuser/test/
state=directory
owner={{ user }}
group={{ user }}
mode=755
- name: Copy python file over
copy:
src=sample.py
dest=/home/vuser/test/sample.py
owner={{ user }}
group={{ user }}
mode=777
- name: Execute script
command: python sample.py
args:
chdir: /home/vuser/test/
ignore_errors: yes
错误 致命的:[n]:失败! => {“ changed”:true,“ cmd”:[“ python”,“ sample.py”],“ delta”:“ 0:00:00.003200”,“ end”:“ 2019-07-18 13:57 :40.213252“,” msg“:”非零返回码“,” rc“:1,”开始“:” 2019-07-18 13:57:40.221132“,” stderr“:”“,” stderr_lines“: [],“ stdout”:“ 1”,“ stdout_lines”:[“ 1”]}
无法弄清楚,将不胜感激
答案 0 :(得分:1)
按如下所示更改缩进量,并删除ignore_errors。
zrangebyscore
答案 1 :(得分:0)
- name: Create directory for python files
file: path=/home/vuser/test/
state=directory
owner={{ user }}
group={{ user }}
mode=755
- name: Copy python file over
copy:
src=/home/vuser/sample.py
dest=/home/vuser/test/
owner={{ user }}
group={{ user }}
mode=777
- name: Execute script
command: python sample.py
args:
chdir: /home/vuser/test/
将sample.py正确复制到位于dest = / home / vuser / test /的node1的目标文件夹中。 但是在完成更改后
致命:[node1]:失败! => {“ changed”:true,“ cmd”:[“ python”,“ sample.py”],“ delta”:“ 0:00:00.002113”,“ end”:“ 2019-07-19 10:59 :53.7535351“,” msg“:”非零返回码“,” rc“:1,”开始“:” 2019-07-19 10:59:53.358678548“,” stderr“:”“,” stderr_lines“: [],“ stdout”:“ hello world”,“ stdout_lines”:[“ hello world”]}