通过Ansible从A nexus repo获取最新的war文件

时间:2016-06-10 21:55:54

标签: ansible nexus

在nexus中,我的快照仓库里有一堆.war文件版本。作为自动化管道的一部分,我们希望通过ansible获取这些.war文件的最新版本。当机器上没有.war文件时,它会获取最新版本。 (以下代码)。

- name: Deploy War File
  maven_artifact: group_id=com.company artifact_id=sales-ui extension=war repository_url=http://ddnexusrepo:8081/nexus/content/repositories/{{repo}} username={{ nexus_user }} password={{ nexus_password }}  dest=/usr/share/tomcat/webapps/sales-ui.war

当它已经在系统上时,当较新的版本在nexus中时,它不会更新。我如何才能获得最新消息?

我能想到的唯一方法是下载(通过相同的maven_artifact模块).war.md5并将其与服务器上的.war的md5进行比较,看看是否有变化。我真正想要的是state=latest,但唯一的功能是存在或不存在。任何想法,将不胜感激。

由于

1 个答案:

答案 0 :(得分:0)

您可以使用ansible 2.2.1.0

中提供的version = latest标记