如何使用Ansible从Nexus下载War文件的特定版本

时间:2020-06-22 15:14:52

标签: maven ansible nexus

我的Nexus存储库中存在不同版本的war文件。

enter image description here

下面是我的验证码

---
- hosts: localhost
  become: True
  tasks:
    - name: Download war file
      maven_artifact:
        group_id: in.flex
        artifact_id: halosys
        repository_url: 'http://34.239.122.5:8081/repository/halosys-release/'
        username: admin
        password: xxxxx
        dest: /tmp/

请让我知道下载特定版本的战争文件的语法,例如Ansible中的 halosys-1.0.war,halosys-5.0.war

1 个答案:

答案 0 :(得分:1)

- name: "Download war file"
  maven_artifact:
    group_id: in.flex
    artifact_id: halosys
    extension: war
    version: 5.0
    repository_url: "http://34.239.122.5:8081/repository/halosys-release/"
    username: admin
    password: xxxxx
    dest: "/tmp/ROOT.war"
    mode: '0644'

源:https://docs.ansible.com/ansible/latest/modules/maven_artifact_module.html#examples

最好有vars文件并使用jinja

例如

...
version: "{{ versions.halosys }}"
...