我正在尝试使用ansible在两台服务器之间执行简单的复制任务,我的playbook脚本是:
- hosts: 10.100.12.26
remote_user: myUser
vars:
MERCHANT_API_DEST_DIR: "/tmp/"
MERCHANT_API_SRC_DIR: "/source/folder/"
tasks:
- name: Copy the spring boot jar to the host destiny
become: true
become_method: sudo
copy:
src: "{{item}}"
dest: "{{MERCHANT_API_DEST_DIR}}"
with_fileglob: "{{MERCHANT_API_SRC_DIR}}/file-name-*.jar"
当我执行剧本时:
ansible-playbook my-playbook.yml --ask-pass
我收到消息:
fatal: [10.100.12.26]: FAILED! => {"failed": true, "msg": "Failed to get information on remote file (/tmp/file-name-1.13.jar): MODULE FAILURE"}
我无法弄清楚问题是什么,有人能帮帮我吗?
答案 0 :(得分:4)
我终于找到了如何使其工作,我向执行行添加了一个命令:
ansible-playbook my-playbook.yml --ask-pass --ask-become-pass
答案 1 :(得分:0)
类似的问题可能是由于[成为]布尔错误缩进
造成的