为什么Ansible总是给我错误“;找不到请求的服务httpd:无法检查或设置状态";?
我正在centos 7机箱上进行安装apache web服务器的试运行。 这是webserver.yml文件:为什么Ansible总是给我错误“;找不到请求的服务httpd:无法检查或设置状态";?,ansible,Ansible,我正在centos 7机箱上进行安装apache web服务器的试运行。 这是webserver.yml文件: --- # Outline to Playbook Translation - hosts: apacheWeb user: aleatoire sudo: yes gather_facts: no tasks: - name: date/time stamp for when the playbook starts raw: /bin/date >
--- # Outline to Playbook Translation
- hosts: apacheWeb
user: aleatoire
sudo: yes
gather_facts: no
tasks:
- name: date/time stamp for when the playbook starts
raw: /bin/date > /home/aleatoire/playbook_start.log
- name: install the apache web server
yum: pkg=httpd state=latest
- name: start the web service
service: name=httpd state=started
- name: install client software - telnet
yum: pkg=telnet state=latest
- name: install client software - lynx
yum: pkg=lynx state=latest
- name: log all the packages installed on the system
raw: yum list installed > /home/aleatoire/installed.log
- name: date/time stamp for when the playbook ends
raw: /bin/date > /home/aleatoire/playbook_end.log
当我使用以下设备进行试运行时:
ansible-playbook webserver.yml --check
我不断地发现这个错误:
fatal: [<ip_address>]: FAILED! => {"changed": false, "failed": true, "msg": "Could not find the requested service httpd: cannot check nor set state"}
to retry, use: --limit @/home/aleatoire/Outline/webserver.retry
致命:[]:失败!=>{“changed”:false,“failed”:true,“msg”:“找不到请求的服务httpd:无法检查或设置状态”}
要重试,请使用:--limit@/home/aleatooire/Outline/webserver.retry
我尝试添加忽略问题:true,但也不起作用。--如果httpd包还没有安装,check将不会实际安装它。因此,如果尚未安装httpd单元文件,那么服务:
调用将失败
您可以改为使用选项。--check
将不会实际安装httpd包,如果它还不存在的话。因此,如果尚未安装httpd单元文件,服务:
调用将失败。..ahh!。。那么,在Ansible中创建yaml文件后,检查语法错误的最佳方法是什么呢?使用@GrishaLevit,您可以将您的响应作为答案发布,以便我检查它。非常感谢。