Problema de módulo de shell ansível

0

eu preciso limpar o conteúdo de um arquivo em hosts remotos usando o módulo shell em ansible, mas incapaz de fazê-lo

---
 - hosts: ansi1
   become: yes
   gather_facts: no
   tasks:
   - name: checking shell power
     shell:
        >/tmp/1.txt
     args:
      executable: /bin/bash

Erro:

ERROR! Syntax Error while loading YAML.


The error appears to have been in '/etc/ansible/shell.yml': line 8, column 10, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

     shell:
        >/tmp/1.txt
         ^ here
    
por Mohd 03.06.2017 / 07:17

1 resposta

0

@Jeff Schaller isso ajudou a resolver o problema,

---
 - hosts: ansi2
   become: yes
   gather_facts: no
   tasks:
   - name: checking shell power
     shell:
             '>/tmp/1.txt'
     args:
      executable: /bin/bash

Agora, o que acontece se eu tiver vários comandos para executar

    
por 03.06.2017 / 08:58

Tags