Pratim Singha
Pratim Singha

Reputation: 679

maven_artifact comman of ansible is not working in Rundeck

Objective: Download the artifact jar from nexus to a Target server. I have already tried an attempt to download the jar via URL and not via maven_artifact, which was successful anyway. But wanted to try with maven_artifact command

Code in playbook:

---
- name: TestOfMavenArtifactCommand
  hosts: Target_Server_Where_the_Jar_needs_to_be_downloaded
  tasks:   
  - maven_artifact:
    group_id: ab.cdef.group
    artifact_id: artifact_name
    repository_url: 'https://nexusUrl/repository/maven-snapshots'
    dest: /folder/artifact_name.jar
    username: user
    state: present
    mode: 0755

When I run the Rundeck job, it fails. The error is like:

  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 12:19:05) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Using /etc/ansible/ansible.cfg as config file
Parsed /var/lib/rundeck/work/zxcv-folder-services/scpr-inventory_dev/dev/hosts.yml inventory source with ini plugin
 [WARNING]: Ignoring invalid attribute: username

 [WARNING]: Ignoring invalid attribute: artifact_id

 [WARNING]: Ignoring invalid attribute: dest

 [WARNING]: Ignoring invalid attribute: state

 [WARNING]: Ignoring invalid attribute: mode

 [WARNING]: Ignoring invalid attribute: repository_url

 [WARNING]: Ignoring invalid attribute: group_id


PLAYBOOK: main.yml *************************************************************
1 plays in main.yml




fatal: [server00.companyxxx.dev ]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "artifact_id": null, 
            "attributes": null, 
            "backup": null, 
            "classifier": "", 
            "content": null, 
            "delimiter": null, 
            "dest": null, 
            "directory_mode": null, 
            "extension": "jar", 
            "follow": false, 
            "force": null, 
            "group": null, 
            "group_id": null, 
            "keep_name": false, 
            "mode": null, 
            "owner": null, 
            "password": null, 
            "regexp": null, 
            "remote_src": null, 
            "repository_url": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "state": "devsent", 
            "timeout": 10, 
            "unsafe_writes": null, 
            "username": null, 
            "validate_certs": true, 
            "version": "latest"
        }
    }, 
    "msg": "group_id must be set"
}
    to retry, use: --limit @/var/lib/rundeck/work/abcd-batch-services/scpr-servers-operations_dev/deploy-servers/tasks/main.retry

Followed the reference of this: https://docs.ansible.com/ansible/latest/modules/maven_artifact_module.html

Upvotes: 0

Views: 1089

Answers (1)

Matt P
Matt P

Reputation: 2625

This appears to be just an indentation error. Try:

  tasks:   
  - maven_artifact:
      group_id: ab.cdef.group
      artifact_id: artifact_name
      repository_url: 'https://nexusUrl/repository/maven-snapshots'
      dest: /folder/artifact_name.jar
      username: user
      state: present
      mode: 0755

Upvotes: 1

Related Questions