如何使用Ansible剧本从链接将工件下载到远程计算机

时间:2019-01-29 12:58:39

标签: ansible nexus

我的要求是从Nexus 3.x存储库下载安装工件或jar文件,然后使用Ansible剧本将其复制到远程主机。

我可以从Ansible ping通远程主机。下面是剧本代码。

- hosts: 10.0.3.22
  tasks:
    - maven_artifact:
      group_id: com.setup
      artifact_id: customerfile
      repository_url: 'http://10.0.3.11:8081/repository/maven-releases/'
      username: uname
      password: pass
      dest: /tmp/customerfile.jar

获取错误-致命:[10.0.3.22]:失败! => {“更改”:false,“ msg”:“必须设置group_id”}

1 个答案:

答案 0 :(得分:1)

缩进错误:

- maven_artifact:
    group_id: com.setup
    artifact_id: customerfile
    repository_url: 'http://10.0.3.11:8081/repository/maven-releases/'
    username: uname
    password: pass
    dest: /tmp/customerfile.jar