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

How to download specific version of war file from nexus using Ansible

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

下面是我的ansible代码

---
- 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/

请告诉我下载特定版本 war 文件的语法,例如 halosys-1.0.war、halosys-5.0.war 在 Ansible 中

- 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 }}"
...