Ich habe eine Crontab, die eine Crontab remote bereitstellen soll. Aber es scheint, als würde es sich über einen Syntaxfehler beschweren.YAML Formatierungsfehler für Ansible
ansible Textbuch ist:
---
- hosts: cac
tasks:
# - name: Deploy cron to GZIP old log/out files.
- cron:
name: "Cron entry to gzip rotated log/out files."
minute: "0"
hour: "*"
job: "find /opt/app/log/ -maxdepth 1 \(-name "*out.*[0-9]" -o -name "*.log.[0-9]" \) -type f -size +100M -exec tar -czf {}.tar.gz {} \;"
state: present
disabled: yes
Fehler Ich erhalte ist:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/ansible/playbooks/deploy_cac_cron.yaml': line 9, column 69, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
hour: "*"
job: 'find /opt/app/log/ -maxdepth 1 -name '*out.*[0-9]' -o -name '*.log.[0-9]' -type f -size +100M -exec tar -czf {}.tar.gz {} \; '
^here
We could be wrong, but this one looks like it might be an issue with
unbalanced quotes. If starting a value with a quote, make sure the
line ends with the same set of quotes. For instance this arbitrary
example:
foo: "bad" "wolf"
Could be written as:
foo: '"bad" "wolf"'
Sieht aus wie es den Job Vermischung ist, dass ich das Senden bin. Irgendwelche Ideen was ich hier machen kann?
Ich versuchte dies. Aber es funktioniert nicht. die Antwort, die Samuel gab, arbeitete. Vielen Dank. –