我的要求是从 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]: 失败! => {"已更改": 假, "msg": "必须设置group_id"}
缩进问题错误:
- 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