incapaz de executar uma reprodução ansiosa no host remoto

0

Estou tentando executar vários comandos shell em um ansible em um host remoto, mas falhando miseravelmente:

   - name: Mkdir on server and copy packages locally
     shell: |
      mkdir /root/vdbench
      cd /root
      cp vdbench50403.zip /root/vdbench
      cd /root/vdbench
      unzip vdbench50403.zip

Erro:

TASK [Mkdir on server and copy packages locally] *******************************
fatal: [153.254.108.166]: FAILED! => {"changed": true, "cmd": "mkdir /root/vdbench\n cd /root\n cp vdbench50403.zip /root/vdbench\n cd /root/vdbench\n unzip vdbench50403.zip", "delta": "0:00:00.006011", "end": "2017-05-26 07:24:30.518445", "failed": true, "rc": 127, "start": "2017-05-26 07:24:30.512434", "stderr": "mkdir: cannot create directory ‘/root/vdbench’: File exists\n/bin/sh: line 4: unzip: command not found", "stdout": "", "stdout_lines": [], "warnings": ["Consider using file module with state=directory rather than running mkdir"]}
fatal: [153.254.108.165]: FAILED! => {"changed": true, "cmd": "mkdir /root/vdbench\n cd /root\n cp vdbench50403.zip /root/vdbench\n cd /root/vdbench\n unzip vdbench50403.zip", "delta": "0:00:00.005799", "end": "2017-05-26 07:24:30.740551", "failed": true, "rc": 127, "start": "2017-05-26 07:24:30.734752", "stderr": "mkdir: cannot create directory ‘/root/vdbench’: File exists\n/bin/sh: line 4: unzip: command not found", "stdout": "", "stdout_lines": [], "warnings": ["Consider using file module with state=directory rather than running mkdir"]}
fatal: [153.254.108.164]: FAILED! => {"changed": true, "cmd": "mkdir /root/vdbench\n cd /root\n cp vdbench50403.zip /root/vdbench\n cd /root/vdbench\n unzip vdbench50403.zip", "delta": "0:00:00.006032", "end": "2017-05-26 07:24:30.745565", "failed": true, "rc": 127, "start": "2017-05-26 07:24:30.739533", "stderr": "mkdir: cannot create directory ‘/root/vdbench’: File exists\n/bin/sh: line 4: unzip: command not found", "stdout": "", "stdout_lines": [], "warnings": ["Consider using file module with state=directory rather than running mkdir"]}
fatal: [153.254.108.163]: FAILED! => {"changed": true, "cmd": "mkdir /root/vdbench\n cd /root\n cp vdbench50403.zip /root/vdbench\n cd /root/vdbench\n unzip vdbench50403.zip", "delta": "0:00:00.006703", "end": "2017-05-26 07:24:30.832733", "failed": true, "rc": 127, "start": "2017-05-26 07:24:30.826030", "stderr": "mkdir: cannot create directory ‘/root/vdbench’: File exists\n/bin/sh: line 4: unzip: command not found", "stdout": "", "stdout_lines": [], "warnings": ["Consider using file module with state=directory rather than running mkdir"]}
    
por Mohd 26.05.2017 / 09:28

1 resposta

3

Leia o que a saída está dizendo:

  • mkdir falha porque o diretório já existe
  • Os sistemas de destino não possuem o comando unzip.

Para corrigir os erros, faça o seguinte:

  • passa o sinalizador -p para mkdir
  • instale o unzip no servidor de destino

Ou, muito melhor ainda, mude sua cartilha para fazer coisas com ansible modules ao invés de apenas executar comandos shell nos hosts de alvos.

- name: Extract vdbench
  unarchive:
    src: vdbench50403.zip
    dest: /root/vdbench

Note que src é um arquivo no computador em que você está correndo.

    
por 26.05.2017 / 09:55

Tags