jia_xue 2021-06-21 10:57 采纳率: 0%
浏览 59
已结题

ansible 报错,麻烦大神看一下

 

---
  - hosts: test
    remote_user: root
    gather_facts: Y

    tasks:
      - name: "copy file"
        ansible.builtin.copy:
          src: "{{ item }}"
          dest: "/home"
          backup: yes
          owner: root
          group: root
          when: "'{{ item }}'.split('_')[0].split('/')[3] == ansible_nodename"

        with_items:
        - "/home/chj/ansible/node1_abc.txt"
        - "/home/chj/ansible/node2_abc.txt"
        - "/home/chj/ansible/hub.atguigu.com_abc.txt"

这个报错如下:

failed: [node1] (item=/home/chj/ansible/node1_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/node1_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [hub.atguigu.com] (item=/home/chj/ansible/node1_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/node1_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [node2] (item=/home/chj/ansible/node1_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/node1_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [hub.atguigu.com] (item=/home/chj/ansible/node2_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/node2_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [node1] (item=/home/chj/ansible/node2_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/node2_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [node2] (item=/home/chj/ansible/node2_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/node2_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [hub.atguigu.com] (item=/home/chj/ansible/hub.atguigu.com_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/hub.atguigu.com_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [node2] (item=/home/chj/ansible/hub.atguigu.com_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/hub.atguigu.com_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
failed: [node1] (item=/home/chj/ansible/hub.atguigu.com_abc.txt) => {"ansible_loop_var": "item", "changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "item": "/home/chj/ansible/hub.atguigu.com_abc.txt", "msg": "Unsupported parameters for (copy) module: when Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
怎么解决

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      问题事件

      • 系统已结题 10月6日
      • 已采纳回答 9月28日

      悬赏问题

      • ¥15 关于#C语言#的问题,如何解决?
      • ¥20 Vs2017 Help Viewer2.3 问题
      • ¥35 基于嵌入式linux的日程管理软件
      • ¥50 如何将list字符串添加到CSV文件表头?
      • ¥15 关于#javascript#的问题:通过ajax实现的局部刷新 如何将项目打包
      • ¥15 海思uboot USB3.0无法识别
      • ¥15 无法调用库文件,自己可以找到,但编译时显示没有
      • ¥15 安装PyQt5的时候这里创建虚拟环境是哪里?具体是怎么的?能录个视频吗
      • ¥20 php程序设计题不会!求解答!
      • ¥50 关于#python#的问题,如何解决?