Ansible 中复制模块不支持的参数

Ansible 中复制模块不支持的参数

我尝试将几个文件从本地服务器复制到远程服务器并出现此错误:

    "ansible_loop_var": "item",
    "changed": false,
    "checksum": "7fc8ff2de203d603caf90e2b50a557cf176e5b3d",
    "diff": [],
    "invocation": {
        "module_args": {
            "_original_basename": "snmp_exporter/snmp.yml",
            "checksum": "7fc8ff2de203d603caf90e2b50a557cf176e5b3d",
            "dest": "/home/mesadmin/check1/snmp_exporter/",
            "follow": false,
            "force": true,
            "mode": "0644",
            "src": "/home/mesadmin/.ansible/tmp/ansible-tmp-1566620501.8182452-257658154385730/source",
            "state": "present"
        }
    },
    "item": "snmp_exporter",
    "msg": "Unsupported parameters for (copy) module: state 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"
}

这是该剧本的一部分,我收到所有项目的错误,我只是在上面粘贴了一个实例:

 - name: Status Check for Configuration Files, Exporters and RPMs
     copy:
      src: /Users/file_path/{{item}}
      dest: /home/dest_path/check1/{{item}}
      state: present
      force: yes
      mode: "0644"
     with_items:
      - prometheus
      - grafana
      - alertmanager
      - start.sh
      - snmp_exporter

我尝试将模式从 0644 改为 0777、2775 等。我也尝试将状态改为触摸,我也尝试将模块从 改为,copyfile效果不佳

All these files are present at my local machine and there is a check1 directory at the remote server where i am trying to copy these files

我找到了几张对我不起作用的票:

https://github.com/ansible/ansible/issues/23521

https://github.com/ansible/ansible/issues/48645

答案1

该消息表明您使用了不受支持的参数,并列出了有效的参数。

当我们查看你的剧本时,我们可以看到你确实使用了无效的参数:

      state: present

您需要将其删除。

相关内容