Ansible does not execute mvn clean install command

Asked

Viewed 48 times

-1

The problem is that amid a deploy automation for approval, I have to execute the command mvn clean install only that I saw Ansible.

my task is like this:

- name: Build projeto backend
  command:  mvn clean install
  args:
    chdir: "{{ projeto.directory }}{{ projeto.config }}"

the contents of the variables returns the address I normally run mvn install and rotate normally.

The error presented to me:

fatal: [localhost]: FAILED! => {"changed": false, "cmd": "mvn clean install", "msg": "[Errno 2] Arquivo ou diretório inexistente", "rc": 2}

What a hell of a file he’s looking for?

1 answer

0

It is certainly not the best way to solve the problem. But I put the absolute path of Maven and it worked.

Staying:

- name: Build projeto backend
  command: "/home/<USUARIO>/.sdkman/candidates/maven/current/bin/mvn --batch-mode install -DskipTests"
  args:
    chdir: "{{ projeto.directory }}master/"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.