我是安赛的新手。在运行此剧本时,低于错误。虽然我通过网络搜索解决方案,但我无法获得任何针对我的问题的帮助。问题似乎是“notify:”语法,但不确定究竟是什么。请任何人帮助我找出错误的地方。
Ansible playbook -
---
- hosts: droplets
remote_user: root
tasks:
- name: Check if service httpd running
service: name=httpd state=running
notify:
- start apache service
handlers:
- name: start apache
service: name=httpd state=started
...
输出
root@zarvis:/home/luckee/ansible# ansible-playbook servicechk.yml -f 2
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/luckee/ansible/servicechk.yml': line 10, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- start apache service
^ here
任何帮助都会很棒!
答案 0 :(得分:1)
1。)第一行。在三个短划线---
之前不应该有空白字符,也称为Document Boundary Marker:
以“---”开头的行可用于明确表示新YAML文档的开头。
2)。
notify:
- start apache service
替换为
notify:
- start apache
因为您声明start apache
处理程序。
答案 1 :(得分:0)
hosts:host1 remote_user:vagrant
任务:
处理程序: